fix: Spotify API 2026 - playlist 403, genres/label KeyErrors, OAuth s…#2631
Open
kichelle-cc wants to merge 2 commits intospotDL:masterfrom
Open
fix: Spotify API 2026 - playlist 403, genres/label KeyErrors, OAuth s…#2631kichelle-cc wants to merge 2 commits intospotDL:masterfrom
kichelle-cc wants to merge 2 commits intospotDL:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: 403 Forbidden on playlist tracks + auth issues (spotdl 4.4.3, Spotify API 2025/2026)
Environment: macOS, spotdl 4.4.3, spotipy, Python 3.12
Problem 1:
GET /v1/playlists/{id}/tracksreturns 403Spotify's
/tracksendpoint now returns 403 for apps in Development Mode, even with a valid user OAuth token. However,GET /v1/playlists/{id}still works and returns track data underitems(newer response shape where each row usesiteminstead oftrack).Fix — patch
spotdl/types/playlist.py:Replace the
playlist_items()call withplaylist()and read tracks from the embedded page:Problem 2:
genres,label,popularityKeyErrors during song enrichmentSpotify's album and artist API responses sometimes omit these fields for certain tracks, causing
Song.from_url()to crash with aKeyError.Fix — patch
spotdl/types/song.py:Problem 3: OAuth scopes insufficient + hardcoded redirect URI
The default scopes (
user-library-read,user-follow-read) don't include playlist scopes. The redirect URI is hardcoded tohttp://127.0.0.1:9900/which may not work in all environments.Fix — patch
spotdl/utils/spotify.py:If you can't use the loopback server (port 9900 blocked, running headless, etc.), set
SPOTIPY_REDIRECT_URIto any HTTPS URL registered on your Spotify app, then use--headlessand paste the full redirect URL when prompted.Problem 4: yt-dlp too old —
Precondition check failed / Signature extraction failedDownloads stuck at 0% because yt-dlp 2023.x can no longer decrypt YouTube streaming URLs. spotdl 4.4.3 pins
yt-dlp<2024.0.0in its requirements but the pin needs to be overridden.Fix:
pip install -U yt-dlp # ignore the version conflict warning from spotdlSpotify API rate limits
Development Mode apps hit a daily quota (~600–800 calls) since spotdl calls
track(),album(), andartist()per song (~3 calls each). On large playlists (100+ tracks) you will get:This is a ~24h rolling window reset. Mitigations:
--threads 1to reduce burst rate--archive /path/to/archive.txt(or set it in~/.spotdl/config.json) so re-runs skip already-downloaded tracks entirely and avoid redundant API callsHope this saves someone a few hours!