[GH-ISSUE #498] to search multiple artist with the sp search #297

Closed
opened 2026-02-27 23:21:51 +03:00 by kerem · 3 comments
Owner

Originally created by @psenoglu on GitHub (May 26, 2020).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/498

Hi,

I am writing a totally basic code to get the genres of the artist.
but when I try to create the string with more than one artist, it takes only the last one and search with this artist.
I know It is very basic and easy but I can not make it through.
Could someone help me with this problem. I dont even know with which keywords I should try on Google.

Thanks a lot, I appreciate it!

`

from spotipy.oauth2 import SpotifyClientCredentials
import spotipy
import sys
import pprint

search_string = "Muse" and "radiohead"
sp = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials())
result = sp.search(search_string, limit=10, type="artist");

print (result)

`

Originally created by @psenoglu on GitHub (May 26, 2020). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/498 Hi, I am writing a totally basic code to get the genres of the artist. but when I try to create the string with more than one artist, it takes only the last one and search with this artist. I know It is very basic and easy but I can not make it through. Could someone help me with this problem. I dont even know with which keywords I should try on Google. Thanks a lot, I appreciate it! ` ``` from spotipy.oauth2 import SpotifyClientCredentials import spotipy import sys import pprint search_string = "Muse" and "radiohead" sp = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials()) result = sp.search(search_string, limit=10, type="artist"); print (result) ``` `
kerem closed this issue 2026-02-27 23:21:51 +03:00
Author
Owner

@stephanebruckert commented on GitHub (May 26, 2020):

search_string = "Muse" and "radiohead"

this is boolean logic and will result in "radiohead" because the first one "muse" is not True.

Anyway, you want the whole thing to be a string:

search_string = '"Muse" and "radiohead"'
<!-- gh-comment-id:633962041 --> @stephanebruckert commented on GitHub (May 26, 2020): search_string = "Muse" and "radiohead" this is boolean logic and will result in "radiohead" because the first one "muse" is not `True`. Anyway, you want the whole thing to be a string: search_string = '"Muse" and "radiohead"'
Author
Owner

@psenoglu commented on GitHub (May 26, 2020):

that comes as output...
{u'items': [], u'next': None, u'href': u'https://api.spotify.com/v1/search?query=%22Muse%22+and+%22radiohead%22&type=artist&offset=0&limit=50', u'limit': 50, u'offset': 0, u'total': 0, u'previous': None}

<!-- gh-comment-id:633970090 --> @psenoglu commented on GitHub (May 26, 2020): that comes as output... ` {u'items': [], u'next': None, u'href': u'https://api.spotify.com/v1/search?query=%22Muse%22+and+%22radiohead%22&type=artist&offset=0&limit=50', u'limit': 50, u'offset': 0, u'total': 0, u'previous': None}`
Author
Owner

@stephanebruckert commented on GitHub (May 26, 2020):

also try AND instead of and

please also consult the web API docs as this is not a question related to python https://developer.spotify.com/documentation/web-api/reference-beta/#writing-a-query---guidelines

<!-- gh-comment-id:633991723 --> @stephanebruckert commented on GitHub (May 26, 2020): also try `AND` instead of `and` please also consult the web API docs as this is not a question related to python https://developer.spotify.com/documentation/web-api/reference-beta/#writing-a-query---guidelines
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotipy#297
No description provided.