To extract playlist stats from Spotify, you generally need to use the Spotify Web API, which provides access to playlist metadata and track-level statistics. Here’s a step-by-step guide:
1. Set Up a Spotify Developer Account
-
Log in and create a new application to get your Client ID and Client Secret
2. Get Access Token
You’ll need to use OAuth 2.0 to authenticate. For simple data (like public playlists), you can use Client Credentials Flow:
Example Token Request (Python)
3. Access Playlist Data
Use the Playlist Endpoint to get playlist stats:
Example Request:
4. Extract Key Stats
From the playlist object, you can extract:
-
Name
-
Description
-
Owner
-
Number of tracks
-
Follower count (not available directly; requires the Spotify SDK via web scraping or user login)
-
Each track’s popularity (0–100)
-
Artists & Album info
Example Code:
5. (Optional) Get Audio Features
For deeper stats (danceability, energy, tempo, etc.):
Loop through track["id"] to pull stats for each track.
6. Format Output
You can export the results into a dataframe or JSON for analysis:
Summary of What You Can Extract:
| Stat | Available? | Notes |
|---|---|---|
| Playlist Name | ✅ | Basic metadata |
| Description | ✅ | May be empty |
| Owner | ✅ | User display name |
| Total Tracks | ✅ | tracks.total |
| Track Popularity | ✅ | From track object |
| Followers | ❌ | Only available via Spotify SDK or web scraping |
| Audio Features (tempo, valence) | ✅ | Extra API calls |
If you’d like a ready-to-use script or integration with Google Sheets, dashboards, or databases, let me know.