This script ranks your liked songs on Spotify by album and generates a CSV file with the top 100 albums based on the percentage of liked tracks. What an "album" is defined as is up to you, currently it is 6 or more songs.
- Python 3.x
spotipy
library- Spotify Developer account
-
Clone the repository:
git clone https://github.com/nbone455/album-ranker.git cd album-ranker
-
Install the required libraries:
pip install spotipy
-
Set up Spotify API credentials:
- Go to the Spotify Developer Dashboard and create a new application.
- Note down the
Client ID
andClient Secret
. - Set the Redirect URI to
http://localhost:8888/callback
.
-
Create a
.env
file in the project directory and add your Spotify API credentials:SPOTIPY_CLIENT_ID='your_client_id' SPOTIPY_CLIENT_SECRET='your_client_secret' SPOTIPY_REDIRECT_URI='http://localhost:8888/callback'
-
Fetch your liked songs:
- Run the
fetch_liked_songs.py
script to cache your liked songs.
python fetch_liked_songs.py
- Run the
This might take a while but creates a liked songs cache that can be used for other things.
- Run the album ranker script:
python spotify_album_ranker.py
The script will generate a CSV file named spotify_top_100_albums.csv
with the top 100 albums ranked by the percentage of liked tracks.