Spotify doesn't provide any way (as yet) to batch delete things.
This is a simple tool to help you clean up your Spotify account. You can use it to get a list of your liked songs, saved albums, playlists, and podcasts. You can then use this information to clean up your account by removing songs, albums, playlists, and podcasts that you no longer want.
-
Set up a Spotify app to use the API
- In the app settings, add
http://127.0.0.1:8080/callbackas a Redirect URI. - Use Web API as scope.
- In the app settings, add
-
Copy the Client ID and Client Secret and set them as environment variables (see Configuration below)
-
Install dependencies, either with Poetry (uses the checked-in
poetry.lock):poetry install
or with a plain virtual environment:
python3 -m venv .venv source .venv/bin/activate # on Windows: .venv\Scripts\activate pip install bottle requests
A virtual environment keeps these dependencies local to this project instead of installing them system-wide, so you don't need admin rights and won't clash with other Python projects. It only needs to be created once — in new terminal sessions, just run the
source/activateline again before working on the project. Rundeactivateto leave it. -
Run
main.py(with Poetry:poetry run python main.py)
App settings (scopes, redirect URI, API base URL, batch limits) live in config.py, not main.py. config.py contains no secrets itself — it reads your Spotify credentials from environment variables at startup and exits with an error if they're missing:
SPOTIFY_CLIENT_IDSPOTIFY_CLIENT_SECRET
The easiest way to set these is via a .env file, which config.py loads automatically on startup (no extra dependency, no need to source it yourself):
cp .env.example .env
# edit .env with your Client ID/Secret
python main.py.env is excluded via .gitignore, so your secrets never get committed. Real environment variables (e.g. export SPOTIFY_CLIENT_ID=...) still take priority over .env if both are set.
- Token refresh
- Improve error handling
