« Spotify Playlists Data Scraper

Spotify API User Playlists Scraper

Download Data to Excel & CSV Files

Steve Spagnola
Written by Steve Spagnola
Last updated April 6, 2022

Scraping Spotify Playlist Tracks, Artists & Popularity via Data API

One of Spotify’s best features (and arguable Spotify algorithm growth hack) is its public & shareable playlists. These allow users to share & discover new music via playlists - and if you’re a music professional you may be very interested in capturing trends to see which artists are making an impact via playlist appearances.

Or more likely, if you want your music to appear at the top of Spotify searches, you’ll need to get in the good graces with influential playlist curators who if they add your song to their favorite songs, can reach millions of potential listeners who are following their playlists.

In this article we’ll discuss how to scrape a user’s playlists (with playlist follower counts), and then how to scrape the individual tracks from those playlists (with Spotify popularity score for each track). This can help you track how well artists are doing on Spotify based on playlist data, or maybe you want to create a playlist based on this scraped data.

We’ll be using the Spotify Web API, specifically the Get User’s Playlists, Get Playlist, and Get Playlist Items endpoints.

Scraping With Stevesie Data

We’ll be using the Stevesie Data Platform to access these API endpoints and extract the data out in easy-to-use CSV files. Stevesie Data is a paid platform and the rest of this article assumes you have the plus plan for running workflows. Disclaimer: I, the author of this article, happen to own the Stevesie Data Platform.

If you don’t want to use the platform, you’re welcome to follow the concepts below and access the endpoints listed above directly with your own software.

1. Scraping Spotify User Playlists

If you don’t already have a list of playlists you want to analyze, you can get a list from a popular account, like the Official Spotify Account artist page - just click on the link “See All” under Public Playlists to see all of Spotify’s Public Playlists. This should work in either the web browser or Spotify desktop app.

Here, we’ll scrape basic information about the playlists, including their names and number of tracks. Simply import the Spotify User Playlists - Pagination workflow into your account and you can then provide a Spotify username (or list of names) to look up the playlists for:

Enter a list of Spotify users to collect playlists for

Let the workflow run and it will scrape 50 playlists per page and then combine all the results together:

Spotify Playlists Results

Open up the CSV file and it will look something like this:

Spotify Playlists CSV File

Note that the only details we get here are the number of tracks per playlist, which isn’t entirely useful. To get more data, we need to copy the items.id column (highlighted above) and look up the details in the next step.

2. Scraping Spotify Playlist Follower Counts

When tracking Spotify popularity index, it typically helps to know the follower count for what you’re tracking. Once you have a list of Playlist IDs (either from step 1 above or from your own methods), you probably want to know how many followers each playlist has before digging too deeply into the tracks in a playlist.

E.g. if you’re looking for up-and-coming artists, you probably care if a very popular playlist includes a relatively unpopular track… then we can expect that track (and respective artist) to grow in popularity.

So to get the Playlist Follower Counts for a list of Playlist IDs, we want to import the Spotify Playlist Details - Multiple Playlist IDs and paste in a list of Playlist IDs:

Paste in a list of Playlist IDs

For this example, we just used the first 100 playlists on Spotify’s page, but you can enter as many as you want. After executing the workflow, we’ll see the results:

Playlist Details Results

And we can download the Spotify_Playlist_Details.csv file (1 row for each playlist), which will contain the follower count for each playlist:

Spotify Playlist Follower Counts

Note that although we see a Spotify_Playlist_Tracks.csv file returned, don’t get too excited. It is not exhaustive and does not contain ALL the tracks per playlist. To ensure we get ALL the tracks for each playlist, we’ll have to do another lookup using our list of 100 Playlist Item IDs below.

3. Scraping Spotify Playlist Tracks, Cover Art & Artists

Now for our final act, we’ll collect ALL of the playlist tracks as well as the associated artists (with album IDs) from all the tracks in the 100 playlist IDs we examined in step 2.

Simply import the Spotify Playlist Tracks - Multiple Playlists formula to add the worlfow into your account, and paste in the list of Playlist IDs like before:

Paste Playlist IDs to look up tracks & artists

Once finished, you’ll see a few results files, including Playlist_Tracks.csv with the full 9,040 rows in it (compared to 7,700 from the previous step):

Playlist Track Results

Now when you open Playlist_Tracks.csv you’ll see details about each track, notably a items.track.popularity field with a score between 0 and 100:

Playlist Track Popularity Scores

Spotify doesn’t reveal exactly how this score is calculated, though the play count most likely has an influence on the score and we can generally assume that tracks with higher popularity scores will tend to have higher play counts. You can use this data as you’d like and it may help you spot up-and-coming tracks (e.g. if you find tracks with low popularity scores on popular playlists, you can put your money on that track getting more popular).

Artist Scraping

While the Playlist_Tracks.csv sheet includes information about artists, it only shows the first artist for each track (since there can be multiple artists). To get all of the artists responsible for tracks (as well as the associated popularity scores), just download the Track_Artists.csv file:

Artist & Track Details Combined

Now you can see that if a track has more than one artist, it is duplicated to provide a row for each artist so you can see the full picutre and identify any up-and-coming artists or track how dominant artists are amongst popular playlists.

How to see Playlist Followers on Spotify

If you need to get playlist followers on Spotify, there is unfortunately no way to do this with the Spotify API. The closest functionality you’ll find is to check if a specific user follows a playlist via this Spotify Check Playlist Following Endpoint.

So in practice, it is not feasible to scrape the entire list of all known Spotify users and then run them against this check to generate a follower list. However, if you have a pre-existing list of known Spotify users you need to check if they follow a set of playlists, say as part of a playlist exchange, then this endpoint may be helpful. If you need help scraping this endpoint for such a use case, please reach out to our support and we can add support for this endpiont and a corresponding workflow to automate these checks.