A paranormal fix for Spotify's "Liked Songs" sync bug.
There is an ongoing problem with the Spotify music player app where the "Liked Songs" playlist fails to sync consistently across devices. Reinstalling the Spotify app usually does not help.
A workaround is to add a new track to the "Liked Songs" playlist, in order to force a cross-device update.
This program performs the same workaround; it adds a new random "ghost" track from the Spotify catalogue to your "Liked Songs" playlist, removes it, and then vanishes, like a ghost.
Schedule it with a job scheduler like cron and let the ghost of you haunt your playlist just long enough to keep it in sync.
Warning
This program is designed to modify the content of your Spotify account.
The credentials in the .env file must be kept safe as they can be used to access your Spotify account.
Tested on Linux x64
- Go 1.24
- Spotify Developer Account (can be the same as your Spotify account)
Run the following
cp --update=none .env.txt .envAlternatively, make a copy of .env.txt and name it .env.
-
Sign in to your Spotify Developer account.
-
Create a spotify app.
-
Fill in the following details
- App name:
The Ghost Of You Spotify - App description:
Keep your liked songs synced up across your devices. - Redirect URIs:
http://127.0.0.1:3000/callback - APIs used: Select
Web API.
- App name:
-
Agree with the Terms of Service and click "Save".
-
In the Spotify dashboard, select your newly created app and copy the
Client IDandClient secretto the .env file in this project's root directory under the fieldsCLIENT_IDandCLIENT_SECRET. -
If your Spotify market country code is not "SG" (Singapore), replace the value of
MARKETin .env file with the correct country code. A list of market country codes is provided by Spotify API (sign-in required).
Important
When running this program for the first time, your web browser will open up a Spotify sign-in webpage for you to sign in and grant your newly created app access permissions to your Spotify account's library.
Sign-in should not be needed for subsequent runs as this program will use a refresh token stored in the .env file for future requests to the Spotify API.
Run the following. If prompted via web browser, sign-in to your Spotify account and grant app access.
go run main.goIf successful, the program should terminate with output similar to the following
🔍 Looking for a suitable ghost track...
🎯 Found track | ID: 0000000000000000000000
📝 Added track | ID: 0000000000000000000000
❌ Removed track | ID: 0000000000000000000000
👻 Boo! Your "Liked Songs" playlist should be synced up now across all devices.
You can use a job scheduler like cron to run this program at regular intervals to keep your Spotify "Liked Songs" playlist in sync across devices.
Build the program.
# This creates an executable program file at ./dist/theghostofyouspotify
make buildExample: Set up the cron job to run every 15 minutes. Ensure that your .env file is in place with the correct values before installing the new cron job.
*/15 * * * * /path/to/dist/theghostofyouspotify- This program is licensed under BSD-3-Clause. There is no warranty.
- This is not an official Spotify product or service.