mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[GH-ISSUE #123] Recommendation endpoint ignoring seeds #57
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#57
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 @eoinmcc on GitHub (Oct 19, 2016).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/123
It appears that when a list of seeds is provided(genre, artist, track) only the first seed in the array is used by the recommendation api.
It looks like this is as a result of some mismatch between how the requests library unpacks the array as separate params in the GET, and how the Spotify api endpoint expects multiple seeds to be supplied (as a comma separated single param)
Example.... Spotipy's currently implemntation expands to the following request.
https://api.spotify.com/v1/recommendations?seed_artists=3dz0NnIZhtKKeXZxLOxCam&seed_artists=3CjlHNtplJyTf9npxaPl5w
but the response reports on 1 seed where 2 were provided...
u'seeds': [{u'afterFilteringSize': 250, u'href': u'https://api.spotify.com/v1/artists/3dz0NnIZhtKKeXZxLOxCam', u'initialPoolSize': 250, u'type': u'ARTIST', u'id': u'3dz0NnIZhtKKeXZxLOxCam', u'afterRelinkingSize': 250}]Passing the 2 seeds as a comma seperated param gives us the expected response.
https://api.spotify.com/v1/recommendations?seed_artists=3dz0NnIZhtKKeXZxLOxCam,3CjlHNtplJyTf9npxaPl5w
response reports on 2 seeds...
u'seeds': [{u'afterFilteringSize': 250, u'href': u'https://api.spotify.com/v1/artists/3dz0NnIZhtKKeXZxLOxCam', u'initialPoolSize': 250, u'type': u'ARTIST', u'id': u'3dz0NnIZhtKKeXZxLOxCam', u'afterRelinkingSize': 250}, {u'afterFilteringSize': 250, u'href': u'https://api.spotify.com/v1/artists/3CjlHNtplJyTf9npxaPl5w', u'initialPoolSize': 250, u'type': u'ARTIST', u'id': u'3CjlHNtplJyTf9npxaPl5w', u'afterRelinkingSize': 250}]I've been working around by supplying the seeds as list with 1 item (i.e. ['3dz0NnIZhtKKeXZxLOxCam,3CjlHNtplJyTf9npxaPl5w'].. This gives me the second result above.
Same is true of genre (and I believe the track) seed params. I believe @mkb218 submitted a pull request for this original.
Happy to take a swing at fix if you'd prefer.
@ecowan commented on GitHub (Feb 15, 2017):
Has this been addressed? I am still seeing this behavior.
@jdormuth commented on GitHub (Dec 24, 2017):
Yes ^^, also still seeing this problem.
@stephanebruckert commented on GitHub (Jan 27, 2021):
Closing since this is 4 years old without updates