mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 09:13:53 +00:00
Trim '?<key>' when extracting ID from HTTP URLs
If this excess part isn't trimmed from the ID, it can cause unexpected results when calling some API methods. For example; this code now correctly returns all albums for an artist: ``` artist = 'https://open.spotify.com/artist/7oPftvlwr6VrsViSDV7fJY?si=M3PrzRC4TBOZu8YyLYc-tA' artist_albums = sp.artist_albums(artist) ``` Previously, this code mimicked same behaviour as calling `spotify.artist`, but now will return albums as expected with this commit. Fixes #365 and #323.
This commit is contained in:
parent
4ec320774d
commit
3e2e8ed0fb
@ -1128,7 +1128,7 @@ class Spotify(object):
|
||||
if type != itype:
|
||||
self._warn('expected id of type %s but found type %s %s' %
|
||||
(type, itype, id))
|
||||
return fields[-1]
|
||||
return fields[-1].split('?')[0]
|
||||
return id
|
||||
|
||||
def _get_uri(self, type, id):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user