April 29, 2012

Exporting Spotify playlists

I'm a real fan of Spotify, Youzee (Spain's Netflix) and a few other services that offer you almost all the content you want for a monthly fee. Especially Spotify!

But while I was playing around with my playlists the other day a terrifying thought passed through my mind: ¿What if Spotify suddenly looses all my songs? The songs I  have been searching and saving for almost 2 years. All the work, the time I spent ordering all the songs, the hours I spent listening every single remix of the songs I like and choosing only the ones I really like... All that would be lost without any possibility of recovering it!

Then I thought I should do something about that, and as I'm currently playing with jQuery I thought doing that backup thingy in javascript is a good idea.

Using Spotify's API there isn't a way to find all playlists a given user has, but there is a way to get the song's name and the artist's name given a spotify uri, and because selecting all songs from a list and then copying their uris is possible, that should do the work for backing up your entire account.

So, just go to the playlist you want to backup, select all the songs and then right click over them and select "Copy Spotify URI". Paste in the textarea of the script I made and click on "Find them all!". The script will show you all the songs, so you can then just copy them in a text file and save them.

I know that this isn't a perfect backup solution, but that's more than nothing.

Here's the result:




Feel free to ask me questions if you don't understand the code or if you have any suggestions. I'd be glad to help you!

Thanks to Yahoo's YQL, Spotify's public API and jQuery