Following all the artists in your saved Spotify library


While experimenting with the Spotify API I put together a web app to solve a problem I had with my own music collection.

Some time ago I imported my full iTunes library into Spotify, so I have a massive collection of albums and tracks saved in ‘Your Library’. This was a great first step but I wasn’t following those artists to get notifications when they released new music or posted updates. I could manually open each artist page to follow them individually but that was a painfully slow process.

I searched online to see if anyone else had attempted the same thing. The only API integration I found was was from 2014, which references ’Starred tracks’ and didn’t work with my library: http://reify.vemv.net/

So as I was experimenting with the Spotify API anyway, I decided to build my own solution.
Starting with the excellent My Saved Tracks example by Paul Lamere, I added a number of additional steps and features.

The web app scans all the tracks in your library and fetches the primary artist. It then checks which of those artists you’re already following and presents them with a list of checkboxes. Users can select all the acts they want notifications from and follow them in one click. The app also allows you to bulk unfollow artists if you wish.

Spotify’s API doesn’t have an endpoint to just fetch a users’s saved artists, so the web app needs to run through all saved tracks. During this process the same artist will appear multiple times, I needed to create a unique list of artists and keep fetching new tracks until a worthwhile list was gathered. If other people have libraries as large as mine (9000+ tracks) then the system will also break the list of artists down into manageable chunks. I found that the Spotify API often returned a 502 error for no apparent reason so I needed to write some error handling to keep trying if that error occurs.

I wrote all the code in Javascript and used the standard Bootstrap framework to easily format the layout and design.

It was a fun little project to think about and solved a challenge with my personal Spotify library, hopefully others will find it useful too. All-in-all, a worthwhile weekend project.

View the app now