A way to back up your "Liked Songs" library from Spotify to a JSON file.
-
Set up a virtualenv and install this project into it.
python -m pip install spotify_tracks_archiver
-
Create an app at https://developer.spotify.com/dashboard/applications and save the
Client ID
andClient Secret
into a file called.env
like this (or set them as individual environmental variables):CLIENT_ID="..." CLIENT_SECRET="..."
-
Run
spotify_tracks_archiver --print-secrets --dry-run
and authenticate. This should print your Refresh Token and save it to your.env
file (or set it as an environmental variable):... REFRESH_TOKEN="..."
-
You're done, execute
spotify_tracks_archiver
and pipe it into a file and/or automate the process on some CI (example on GitHub Actions).