This Python script creates a new Spotify playlist with the top 5 songs of each artist in your liked songs that match a given list of artist names.
Before running the script, make sure you have:
-
Python 3.x installed
-
A Spotify account
-
Created a Spotify app and obtained a client ID and secret. See here for instructions.
-
Set environment variables
SPOTIPY_CLIENT_ID
,SPOTIPY_CLIENT_SECRET
, andSPOTIPY_REDIRECT_URI
with your app's values. For example, you can add the following lines to your.bashrc
or.bash_profile
file (replaceYOUR_CLIENT_ID
andYOUR_CLIENT_SECRET
with your app's values):export SPOTIPY_CLIENT_ID='YOUR_CLIENT_ID' export SPOTIPY_CLIENT_SECRET='YOUR_CLIENT_SECRET' export SPOTIPY_REDIRECT_URI='https://example.com/callback/'
- Clone or download this repository to your local machine.
- Install the required packages by running
pip install -r requirements.txt
. - Run the script by running
python festival.py
. - Enter your Spotify username and a list of comma-separated artist names when prompted.
- Enter a name for your new playlist when prompted.
- The script will create a new playlist with the top 3 songs of each artist in your liked songs that match the given artist names.
Note: The script saves your liked songs in a file called liked_songs.json
in the same directory as the script. If you run the script again, it will load your liked songs from this file instead of fetching them from Spotify again.
This project is licensed under the MIT License.