mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[GH-ISSUE #757] Inconsistant result from playlist URI using Spotify.playlist_tracks #461
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#461
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @fcusson on GitHub (Dec 16, 2021).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/757
Describe the bug
We use Spotipy for an Home Assistant custom component Spotscat. An issue was raised by a user that seems to come from Spotipy handling of URI using the
?si=element that was added by Spotify to comply with EU regulations. This means this bug is only reproduisible naturally from an EU based Spotify install. Otherwise, the?si=will not be present in the URI.If a user pass a URI that was provided from an EU Spotify client, the playlist_tracks method will return a different dictionary than if it was provided without see issue 267:
Your code
Expected behavior
Both types of URI should return the same behavior (a dictionary containing the tracks of a playlist)
Output
Environment:
Additional context
The problem seems to be related to how spotipy manages the return from Spotify API. In my minimal code I check and realized that we seem to be one level up in the data provided. In the hierarchy of data, we normally have ... -> playlist -> tracks >> return as dictionary, but when receiving a EU Complient URI, we seem to stop at the playlist element, and we never extract the tracks portion.
@fcusson commented on GitHub (Dec 16, 2021):
I think I found part of the problem. Using this code:
I get the following result
we can see the _get_id method simply slice the string ad returns whats is after the spotify::. That would explain the problem. A solution would be to check to remove anything following (and including) an interogation mark