A Python application to analyze, compare, merge, and build Spotify playlists — with both a terminal (CLI) and graphical (GUI) interface.
| File | Description |
|---|---|
spotify_analyzer.py |
Terminal / CLI version |
spotify_analyzer_gui.py |
Graphical (Tkinter) version |
requirements.txt |
Python dependencies |
- 🎵 Playlist Loading — Load any public Spotify playlist via URL or ID
- 📋 Track Listings — See all songs with artist, album, duration, and popularity
- 📊 Statistics — Genre distribution, duration stats, popularity metrics, top artists
- 🔄 Playlist Comparison — Find common and unique songs between two playlists, with similarity score
- 🔀 Playlist Merging — Combine two playlists into a new one (duplicates removed)
- 📥 YouTube Tracklist Import — Paste a YouTube timestamp tracklist and automatically search each song on Spotify, then add found tracks to a new or existing playlist
py -3.9 -m pip install spotipy==2.23.0- Go to Spotify Developer Dashboard
- Log in and click Create app
- Fill in any name and description
- Set the Redirect URI to exactly:
http://127.0.0.1:8888/callback - Under APIs used, select Web API
- Save, then copy your Client ID and Client Secret from Settings
Note: Spotify no longer allows
localhostas a redirect URI for apps created after April 9 2025. Usehttp://127.0.0.1:8888/callbackexactly.
Terminal version:
py -3.9 spotify_analyzer.pyGUI version:
py -3.9 spotify_analyzer_gui.pyWhen you first run either version, you choose a mode:
| Mode | What it does | Needs browser login? |
|---|---|---|
| Read-Only | View and analyze playlists | No |
| Full Access | Everything + create/modify playlists | Yes (once) |
Full Access is required for merging playlists and the tracklist import feature. Your token is cached locally so you only log in once.
[1] Setup / change API connection
[2] Load main playlist
[3] View playlist details
[4] View playlist statistics
[5] Load comparison playlist
[6] Compare playlists
[7] Merge playlists → new playlist
[A] Import from YouTube tracklist → Spotify playlist
[8] Clear main playlist
[9] Clear comparison playlist
[0] Exit
Paste a YouTube video description tracklist in this format:
[0:05](https://youtube.com/...) Artist - Song Title (Remix)
[5:08](https://youtube.com/...) Billie Eilish & Khalid - lovely
The timestamps and URLs are stripped automatically. Each song is searched on Spotify using a cascading strategy (tries with full remix info first, then falls back to the bare title). At the end you choose to add found tracks to a new or existing playlist.
Requires Full Access mode.
- Duration — total playlist length, average song duration, track count
- Genres — top 10 genres across all tracks
- Popularity — average Spotify popularity score (0–100)
- Artists — top 10 most featured artists
- Common songs between both playlists
- Songs unique to each playlist
- Similarity percentage
redirect_uri: Not matching
Make sure your Spotify app has exactly http://127.0.0.1:8888/callback as a Redirect URI (not localhost).
fatal: detected dubious ownership (Git)
git config --global --add safe.directory "C:/path/to/your/project"Fatal error in launcher (pip)
Use py -3.9 -m pip install ... instead of pip install ... directly.
"Error fetching playlist"
- Check the playlist URL is valid and the playlist is public
- Verify your internet connection and that credentials are correct
Make sure these are in your .gitignore so credentials are never committed:
.cache
.spotify_cache_gui
__pycache__/
*.pyc
Open source, available for educational purposes.