|
| 1 | +# Apple Music Scraper |
| 2 | + |
| 3 | +**Apple Music Scraper** is a powerful tool for extracting rich data from Apple Music web pages using web scraping and reverse-engineered structure of `serialized-server-data`. |
| 4 | + |
| 5 | +This project is unofficial and purely for educational purposes. No official Apple API used. |
| 6 | + |
| 7 | + |
| 8 | +<br> |
| 9 | + |
| 10 | + |
| 11 | +## 🔧 Functions |
| 12 | + |
| 13 | +| Function | Parameters | Description | |
| 14 | +|------------------------|------------------------------|------------------------------------------------------| |
| 15 | +| `search(keyword)` | `keyword: str` | Search Apple Music for artists, songs, albums, playlists, and videos | |
| 16 | +| `song_scrape(url)` | `url: str` | Get metadata and preview URL of a song | |
| 17 | +| `album_scrape(url)` | `url: str` | Get album details including songs, artist, similar albums, and videos | |
| 18 | +| `playlist_scrape(url)` | `url: str` | Extract song URLs from a playlist | |
| 19 | +| `room_scrape(url)` | `url: str` | Extract song URLs from a shared room | |
| 20 | +| `video_scrape(url)` | `url: str` | Get video metadata including direct video URL and related content | |
| 21 | +| `artist_scrape(url)` | `url: str` | Get artist metadata including top songs, albums, videos, bio, and more | |
| 22 | + |
| 23 | +Each function returns structured JSON containing metadata, URLs, images, previews, and related data. |
| 24 | + |
| 25 | + |
| 26 | +<br> |
| 27 | + |
| 28 | +## 🧠 Usage |
| 29 | + |
| 30 | +Just import the scraper and call your function: |
| 31 | + |
| 32 | +```python |
| 33 | + |
| 34 | +result = search('night tapes') |
| 35 | +artists = result['artists'] |
| 36 | + |
| 37 | +artist_url = artists[0]['url'] |
| 38 | +artist = artist_scrape(artist_url) |
| 39 | + |
| 40 | +latest_night_tapes_song_url = artist['latest'] |
| 41 | + |
| 42 | +song = album_scrape(latest_night_tapes_song_url) |
| 43 | +song_name = song['title'] |
| 44 | +song_cover = song['image'] |
| 45 | + |
| 46 | +print(f"\nLatest Night Tapes Song: {song_name}\nCover Art: {song_cover}\n") |
| 47 | + |
| 48 | +``` |
0 commit comments