mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-26 16:15:51 +03:00
[GH-ISSUE #524] sp.user_playlist_remove_all_occurrences_of_tracks can't remove local tracks from playlist - http status: 400 #318
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#318
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 @raiden-e on GitHub (Jun 30, 2020).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/524
Describe the bug
when trying to remove local tracks from a playlist, the uri is invalid
local tracks are those imported from a computer.
consider this playlist:
https://open.spotify.com/playlist/58RURV6kkw77FMF2ByQIe7
To test this you will have to copy the playlist or create one yourself, because of ownership. i can make it collaborative if you like.
"{}" indicate replaced text
Your code
Expected behavior
The playlist should be completly empty, in any case, whether it contains local and/or public tracks
Output
Debugger Values
tracks: []
local: ['spotify:local:Meduza...dit%29:265', 'spotify:local:Exclus...MONGER:266', 'spotify:local:Nextar...+Error:222', 'spotify:local:Marbox...mix%29:390']
Environment:
@stephanebruckert commented on GitHub (Jul 5, 2020):
This does look like an invalid track URI, as if it was truncated. Can you share the full track URI that blocks your script?
I see you are generating track ids?
tracks=local[(i*100):((i+1)*100)])Track uris cannot be invented, they must match to real track uris?
@raiden-e commented on GitHub (Jul 6, 2020):
tracks=local[(i*100):((i+1)*100)]this is to chop up all uri's into chunks of 100, since spotify API limits 100 uris per request. It works with official tracks on spotify so i guess the splice-syntax should be correct@raiden-e commented on GitHub (Jul 6, 2020):
Here is the data from debugger again along with the
localvariable.tracksis an empty list because all of the titles areis_locallocal: [''spotify:local:Meduza%2FOddprophet:Lose+Control+%28Oddprophet+Edit%29:Lose+Control+%28Oddprophet+Edit%29:265'', ''spotify:local:Exclusion::WARMONGER:266'', ''spotify:local:Nextars::Fatal+Error:222'', ''spotify:local:Marbox:This+Time:This+Time+%28Darpa+Remix%29:390'']@OberstVonGatow commented on GitHub (Nov 17, 2020):
same error here. Tried to remove recently played tracks from playlist.
With method current_user_recently_played i get the tracks and with current_user_playlists i get my playlists with ids.
Then i get one playlist and try to remove with playlist_remove_all_occurrences_of_items( playlist['id'], recently_played).
File "/home/pi/.local/lib/python2.7/site-packages/spotipy/client.py", line 1084, in playlist_remove_all_occurrences_of_items "playlists/%s/tracks" % (plid), payload=payload File "/home/pi/.local/lib/python2.7/site-packages/spotipy/client.py", line 294, in _delete return self._internal_call("DELETE", url, payload, kwargs) File "/home/pi/.local/lib/python2.7/site-packages/spotipy/client.py", line 264, in _internal_call headers=response.headers, spotipy.exceptions.SpotifyException: http status: 400, code:-1 - https://api.spotify.com/v1/playlists/6NWB2JKrlJnHErAGkzGvBV/tracks: JSON body contains an invalid track uri: spotify:track:items, reason: None