A Python script that exports all of your Spotify playlists, useful for paranoid Spotify users like me, afraid that one day Spotify will go under and take all of our playlists with it!
It'll ask you for a filename and then pop open a web page so you can authorize access to the Spotify API. Then the script will load your playlists and save tab-separated files with your playlists that you can open in Excel. You can even copy-paste the rows from Excel into a Spotify playlist.
If for some reason the browser-based authorization flow doesn't work, you can also generate an OAuth token on the developer site (with the relevant permissions) and pass it with the --token
option.
Playlist folders don't show up in the API, sadly.
user-library-read
playlist-read-private
playlist-read-collaborative
playlist-modify-private
You can run the script from the command line:
python spotify_backup.py
or, to get a JSON dump, use:
python spotify_backup.py --format=json
By default, it includes your playlists and Likes. To include only your playlists, you can use:
python spotify_backup.py --include=playlists
By default, it creates a file for each playlist, but you can dump to a single file:
python spotify_backup.py playlists.txt --single
By default, it includes all playlists you have followed, but you can choose only those that are owned by you:
python spotify_backup.py --mine
You can check for duplicates in your playlists:
python spotify_backup.py --check-duplicates
Split a playlist by decade:
python spotify_backup.py
Separate songs from compilations (because their release dates are misleading):
python spotify_backup.py --separate-compilations
Split by year added:
python spotify_backup.py --mode date-added
Plot a few graphs using data from your playlist(s):
python spotify_graph.py