If given a playlist_id user_playlist_tracks returns a paging object,
if given a full url it returns playlist object (full). Tested on this playlist.
Code snipper below demonstrates the difference:
import spotipy
from spotipy import util
token = util.prompt_for_user_token(
username,
client_id=_client_id,
client_secret=_client_secret,
redirect_uri=_redirect_uri,
)
sp = spotipy.Spotify(auth=token)
url = "https://open.spotify.com/user/didrik0510/playlist/7ehrAeEI4icxsqlvGX02gW?si=LaDb4nMATFqmeGVgvhHObQ"
id_ = "7ehrAeEI4icxsqlvGX02gW"
print(sp.user_playlist_tracks(username, url).keys())
print(sp.user_playlist_tracks(username, id_).keys())
Having it written in the documentation would be nice, with the explanation what input results in what output type.
I had a similar problem in the past. I don't remember if this commit was enough for the fix but do check out if this helps https://github.com/plamere/spotipy/pull/324/commits/baf96493cc9b6aa51073c59a9f74edf6df444549.
If given a playlist_id
user_playlist_tracksreturns a paging object,
This is the correct behaviour.
if given a full url it returns playlist object (full). Tested on this playlist.
This should return the same paging object as passing the playlist_id. But with the full HTTP URL, sp.user_playlist_tracks ends up mimicking sp.playlist which is an incorrect behaviour.
Most helpful comment
This is the correct behaviour.
This should return the same paging object as passing the playlist_id. But with the full HTTP URL,
sp.user_playlist_tracksends up mimickingsp.playlistwhich is an incorrect behaviour.