This script allows you to remove tracks by a specific artist from all of your Spotify playlists, liked songs and saved albums. It utilizes the Spotify API and requires authentication through OAuth2.
- Remove tracks by a specific artist from all playlists.
- Remove tracks by a specific artist from liked songs.
- Remove albums by a specific artist from saved albums.
-
Install spotipy.
pip install spotipy
-
Create a Spotify Developer account and register your application to obtain
client_id
andclient_secret
. Set the redirect URI ashttp://localhost:8080
. -
Create a
config.json
file in the same directory as the script with the following format:
{
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET"
}
Run the script with the artist name as an argument. With no extra arguments it defaults to playlist removal only.
python main.py ARTIST_NAME
Replace ARTIST_NAME
with the name of the artist whose tracks you want to remove from your playlists.
Note
If you are using a name with a space anywhere you must pass it using quotes. For example: "Band Name"
.
The artist name is also case sensitive.
--playlists
: Remove tracks from all playlists (default behavior if no options are provided).--albums
: Remove albums from saved albums.--liked
: Remove tracks from liked songs.
- Make sure the artist name matches exactly what's listed in Spotify.
- The script will prompt you to authorize access to your Spotify account the first time you run it. The script does not connect to any external database and is all kept locally on your device. Delete
.cache
if you wish to remove your information or reauthenticate with Spotify.