mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-26 16:15:51 +03:00
[GH-ISSUE #168] user_playlist_remove_all_occurrences_of_tracks() throws invalid track uri error #83
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#83
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 @gauthamanms on GitHub (Mar 6, 2017).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/168
I got myself authenticated and could access and work well with other functions which requires aunthetication in spotipy. However I couldnt get user_playlist_remove_all_occurrences_of_tracks() work.
I tried Keeping the code as simple as possible by trying to pass user_playlist_remove_all_occurrences_of_tracks('<user_id>', '<playlist_id>', '<track_id>'),
but it shows the following error:
SpotifyException: http status: 400, code:-1 - https://api.spotify.com/v1/users/msgauthaman/playlists/4Sc7nWBUrNnhjSoMDyPCdE/tracks:
JSON body contains an invalid track uri: spotify:track:5
@noahbetz commented on GitHub (Jun 1, 2017):
I made a GitHub account just to respond to this. I know this is an old question, but I'm responding to it because I came across this question when I had the problem. Currently, my code pulls the song name, album, artist, and URI from each song in a playlist and stores it in a list called complete. Here's an example of the first two entries in the list:
With this you can further access a specific part of each entry:
Here's what I was trying to do before, which is basically your code:
This throws the same error:
JSON body contains an invalid track uri: spotify:track:1What fixed it for me was declaring a new variable tracks, which contains a list of only complete[0][3].
I don't know why this works, but it's how I fixed the problem.
@cameron-gagnon commented on GitHub (May 18, 2019):
It doesn't need to be a new variable, it just needs to be within an array, such as the 's' in tracks slightly suggests.
This should work as well:
sp.user_playlist_remove_all_occurrences_of_tracks(username, '4nJyAWMGALHKx6I67Ct9x8', [complete[0][3]])@stephanebruckert commented on GitHub (Jan 13, 2020):
Indeed, as per the doc it should be an array of
track_ids