A Python script that exports all of your Spotify playlists.
Go to file
Ethan Wick 3f17fc84c9 Update README 2023-02-16 15:41:30 +00:00
spotifybackup Code improvements, PEP 8, refactoring, etc. 2023-02-16 15:16:24 +00:00
.gitignore Use standard Python gitignore file 2023-02-16 11:39:49 +00:00
README.md Update README 2023-02-16 15:41:30 +00:00
pyproject.toml Make package pip-installable 2023-02-16 15:16:44 +00:00

README.md

spotify-backup

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!

Usage

To run the script, save it from here, extract the repo and run the module:

python -m spotify-backup

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 a tab-separated file with your playlists that you can open in Excel. You can even copy-paste the rows from Excel into a Spotify playlist.

To get a JSON dump, use the --format option:

python -m spotify-backup --format=json playlists.json

By default, it includes your playlists. To include your liked songs and albums, use the --dump option:

python -m spotify-backup --dump=liked,playlists backup.txt

Passing an OAuth token

If for some reason the browser-based authorization flow doesn't work, you can also generate an OAuth token on the developer site and pass it with the --token option. The token will need these scopes:

  • For playlists: playlist-read-private and playlist-read-collaborative
  • For liked songs and albums: user-library-read

Installation

You can install spotify-export so it can be ran directly instead of as a Python module.

Run this from the root folder:

pip install .

Now you can run spotify-backup like this:

spotify-backup