Fix Spotify playlist extraction 403 (Forbidden)#180
Merged
Conversation
GetPlaylist() called the obsolete SpotifyAPI.Web Playlists.GetItems(),
which hits the now-removed /playlists/{id}/tracks endpoint and returns
403 Forbidden for apps in Development Mode (Spotify Feb 2026 API change).
Switch to Playlists.GetPlaylistItems(), which uses the current
/playlists/{id}/items endpoint, and read the items via track.Item
instead of track.Track (the new endpoint renames the "track" field to
"item"). Also cap the page size at 50, the documented max for /items.
Fixes fiso64#160
spotify(TM) premium(TM) is now required for reading playlists.
df0b507 to
3f0b068
Compare
Owner
|
Thanks! |
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.
This is the actual fix for #160.
The lib bump to SpotifyAPI.Web 7.4.2 back in March added
Playlists.GetPlaylistItems()(which hits/playlists/{id}/items), butGetPlaylist()inSpotify.cswas never switched over - it's still calling the oldPlaylists.GetItems(), which is now just a thin obsolete wrapper around the dead/playlists/{id}/tracksendpoint. So the package bump didn't actually change any behavior, which is why people are still hitting403 Forbiddenon 2.7.0 and current master.This swaps the call to
GetPlaylistItems()and updates the field access fromtrack.Tracktotrack.Item, since the/itemsresponse renames that field. Also dropped the page size from 100 to 50, since that's the documented max for/items(the old/tracksendpoint allowed 100).Tested against the live API - confirmed
/tracks403s even for playlists you own, while/itemsreturns 200 for the same playlist. Built and ran against a few hundred track playlist end to end, extraction and downloads both work now.