A useful little Python script which uses Spotify's web API to clean your library.
CAUTION: THE EFFECTS OF USING THIS PROGRAM ARE PERMANENT AND IRREVERSIBLE AS FAR AS I KNOW. I'M NOT RESPONSIBLE IF YOU DELETE YOUR WHOLE LIBRARY BY ACCIDENT. USE AT YOUR OWN RISK. Please read and understand all the instructions in the README prior to use.
This tool can help you remove:
- Saved albums
- Playlists you own
- Liked songs
- All of the above at once
- Python 3.6 or higher
- A Spotify account
- Spotify Developer credentials
- Clone this repository or download the script file (main.py).
- Install the required package using pip:
pip install spotipy
- Visit the Spotify Developer Dashboard
- Log in with your Spotify account
- Click "Create App"
- Fill out the application details:
- App name: Choose any name (e.g., "Library Cleanup Tool")
- App description: Optional
- Redirect URI: Set this to
http://localhost:8888/callback
- Accept the terms of service
- After creation, you'll see your Client ID
- Click "View Client Secret" to reveal your Client Secret
- Open the script in a text editor and replace:
YOUR_CLIENT_ID_HERE!
string with your actual Client IDYOUR_CLIENT_SECRET_HERE!
string with your actual Client Secret
- Run the script:
python3 spotify_cleanup.py
-
On first run, your browser will open asking you to log in to Spotify and authorize the application.
-
Once authorized, you'll see the main menu with these options:
Spotify Library Cleanup Tool
1. Remove all saved albums
2. Remove all owned playlists
3. Remove all liked songs
4. Remove everything
5. Exit
-
Choose an option by entering the corresponding number (1-5)
-
For each action:
- The script will first tell you how many items will be removed by your selected action
- You'll be asked to confirm before deletion begins
- Type 'yes' to proceed or 'no' to cancel
- Progress will be displayed as items are removed
- This tool only removes playlists that you own, not playlists you follow
- Deletions are permanent and cannot be undone
- The script includes rate limiting to comply with Spotify's API guidelines
- You can safely cancel the script at any time by pressing Ctrl+C
-
Invalid Client Credentials:
- Double-check that you've correctly copied your Client ID and Client Secret
- Ensure there are no extra spaces in the credentials
-
Authorization Failed:
- Make sure the redirect URI in your Spotify Developer Dashboard matches exactly:
http://localhost:8888/callback
- Try clearing your browser cookies and cache
- Make sure the redirect URI in your Spotify Developer Dashboard matches exactly:
-
Rate Limiting:
- The script includes built-in rate limiting
- If you still encounter rate limit errors, wait a few minutes before trying again
Invalid Client Secret
: Check your developer dashboard for the correct secretInvalid Redirect URI
: Verify the URI in your dashboard settingsAccess Denied
: Re-authorize the application in your browser
- Confirmation prompts before any deletion
- Rate limiting to prevent API abuse
- Error handling for failed operations
- Progress tracking during deletion
Feel free to submit issues and enhancement requests!