At some point in the past few years, Spotify changed how they handle the "Liking" ("Favoriting") of songs and albums. Previously, if you "Liked" ❤️ an album, all tracks in that album would also be "Liked" ❤️ and added to your "Liked Songs" list.
Nowadays, that's no longer the case: "Liking" an album simply adds it to Your Library --> Albums and does nothing to the "Liked Songs" list.
I really dislike (ha!) this change, so I've finally decided to do something about it.
This simple script will query all of your "Liked" albums and then mark each track as "Liked" as well.
Sure, it's got it's downsides - if you "Un-Like" a track from a "Liked" album, this script will "Re-Like" it for you. But that's something we just deal with.
Also, Semantic Satiation of "Like"...
- Make sure you have a Spotify Developer account.
- Create an App. Any name is fine.
- Add
http://127.0.0.1:9090
as a Redirect URI on the App. - Add your client ID and client secret into
.\secrets.sh
:export SPOTIPY_CLIENT_ID="<client_id>" export SPOTIPY_CLIENT_SECRET="<client_secret>" export SPOTIPY_REDIRECT_URI="http://127.0.0.1:9090"
- Source that file:
source secrets.sh
- Clone the repo.
- Make a venv and activate it.
- Install:
pip install -e .
Do the 3 steps above, and then:
- Install dev dependencies:
pip install -e .[develop]
- Install pre-commit hooks:
pre-commit install
- Run tests if you want:
pytest
If you've done Settings Things Up and Installation then you should be able to just call:
python fix_spotify_favorites.py
❗ It's recommended to run with
-n/--dry-run
first!
A browser window will pop up asking for authorization to access your data. Give it the A-OK and the script will do its thing.
Authorization will last for... some amount of time. Maybe a day? I donno, I haven't tested yet. During the active auth period, re-running the program will not pop up the browser window.
If you get
spotipy.oauth2.SpotifyOauthError: error: invalid_grant, error_description: Refresh token revoked
then you might have changed your Spotify password since you last ran this program.
Delete ./.cache
and try again.
View the CLI args/help with python fix_spotify_favorites.py --help
.
Sometimes there are tracks that you intentionally "un-like". These can be
added to a file and then fix_spotify_favorites
will not re-like it.
The skiplist file is a CSV file (named "skiplist.csv" by default). The file must have the following properties:
- column names on row 1
- have a column called
spotify_id
which is the ID of the track to skip - use commas as a column delimiter (if multitple columns are present)
All other columns, along with ordering, are ignored so you can use them for your own notes or whatever.
For example, these are all valid and equivalent skiplist files.
spotify_id,artist,track
6DZLcTwul48FE4aW0xSxbl,Sublime,Raleigh Soliloquy Pt. I
62oXSkYi2CJAz1hoJAvGN0,Sublime,Raleigh Soliloquy Pt. II
3ZBUmaRN1hitj5L0pJTifL,Wicked,No Good Deed (German)
reason,spotify_id,track
"Foo",6DZLcTwul48FE4aW0xSxbl,"Trackname 1"
"Bar",62oXSkYi2CJAz1hoJAvGN0,"Raleigh Soliloquy Pt. II"
"It's in German, man.",3ZBUmaRN1hitj5L0pJTifL,No Good Deed
spotify_id
6DZLcTwul48FE4aW0xSxbl
62oXSkYi2CJAz1hoJAvGN0
3ZBUmaRN1hitj5L0pJTifL
This was built on Python 3.8 and should run on any higher versions.
It uses the Spotipy library and uses the Authorization Code Flow.
Only tested on Linux (WSL) Ubuntu 20.04.