A Python script to fetch all your liked songs from Spotify and export them to CSV format.
-
Install dependencies:
pip install -r requirements.txt
-
Create a Spotify App:
- Go to https://developer.spotify.com/dashboard
- Click "Create app"
- Set the Redirect URI to:
http://127.0.0.1:8080/callback - Save your Client ID and Client Secret
-
Configure credentials:
- Copy
.env.exampleto.env - Add your Spotify Client ID and Client Secret
- Copy
python fetch_liked_songs.pypython fetch_liked_songs.py -l 10python fetch_liked_songs.py -o my_songs.csvpython fetch_liked_songs.py -dpython fetch_liked_songs.py -l 50 -o test_songs.csv -dThe default CSV format is simple:
artist: song
The Beatles: Hey Jude
Queen: Bohemian Rhapsody
The detailed format includes:
- Artist
- Song
- Album
- Date added
The script includes built-in rate limiting:
- 0.1 second delay between requests
- Automatic retry with backoff on rate limit errors
- Respects Spotify's Retry-After header
On first run, you'll be redirected to Spotify to authorize the app. After authorization, the script will save a token for future use.