mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-26 16:15:51 +03:00
[GH-ISSUE #858] Searching by Track & Artist Sometimes Fails #527
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#527
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 @BluntBSE on GitHub (Sep 20, 2022).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/858
Describe the bug
When attempting to execute .search(), the 'tracks' list in the response object is sometimes completely empty for some artists, even though the query seems identical to the one provided by Spotify's URL query builder. The below example uses "Meshuggah", but this also occurred with "Sequoia" (track) and "Protest the Hero" (artist).
"Track results" is also basically empty for Meshuggah, though not necessary for the code below to run, it seems to be where things go wrong.
Your code
Environment:
-Spotipy latest as of September 11
Additional context

@dpnem commented on GitHub (Sep 25, 2022):
I was able to see the inconsistencies as well. Sometimes the first function would not return data, and sometimes the second function would not return data.
When I changed the search strings from:
track_results = sp.search(q="name:Bleed,artist:Meshuggah")
track_results = sp.search(q="name:La Noche,artist:Rosalia")
to:
track_results = sp.search(q="name:Bleed, Meshuggah")
track_results = sp.search(q="name:La Noche, Rosalia")
Now the program ALWAYS returns data for both functions.
If you search through Spotify developer boards for "search endpoint", Spotify seems to be have lots of issues that may be getting addressed.
@BluntBSE commented on GitHub (Sep 25, 2022):
For anyone who stumbles upon this, I was curiously able to get an improvement with an f-string and swapping 'name' for 'track.'
@Peter-Schorn commented on GitHub (Oct 5, 2022):
This may not resolve the issue, but please note that there shouldn't be commas in the query unless you're trying to search for them literally.
@WestheadJ commented on GitHub (Feb 5, 2023):
Comment -
For searching for a song, using
track:is the way to go, this is the way that the SpotifyAPI documentation states to use it I'm pretty sure either that or Spotipy. You also should state the type of thing you are looking for my example below is looking for tracks. This just helps narrow down your search.@stephanebruckert commented on GitHub (Jul 9, 2024):
Yes, for consistent results it's preferable to split
nameintoartistandtrack