[GH-ISSUE #33] Can't search with > 1 query field #18

Closed
opened 2026-02-27 23:20:25 +03:00 by kerem · 2 comments
Owner

Originally created by @purplehat7 on GitHub (Nov 3, 2014).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/33

In [11]: sp.search('track:Unbelievers+artist:Vampire Weekend', type='track', limit=1)
Out[11]:
{u'tracks': {u'href': u'https://api.spotify.com/v1/search?query=track%3AUnbelievers%2Bartist%3AVampire+Weekend&offset=0&limit=1&type=track',
  u'items': [],
  u'limit': 1,
  u'next': None,
  u'offset': 0,
  u'previous': None,
  u'total': 0}}

Pointing a browser to the above link in the 'href' field and replacing the %2B with a + returns a populated track object, so I don't think the conversion from + to %2B that's happening somewhere along the Spotipy.search call stack should be happening...can it be avoided?

I also noticed there were no search calls in the examples that specified > 1 field.

Originally created by @purplehat7 on GitHub (Nov 3, 2014). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/33 ``` In [11]: sp.search('track:Unbelievers+artist:Vampire Weekend', type='track', limit=1) Out[11]: {u'tracks': {u'href': u'https://api.spotify.com/v1/search?query=track%3AUnbelievers%2Bartist%3AVampire+Weekend&offset=0&limit=1&type=track', u'items': [], u'limit': 1, u'next': None, u'offset': 0, u'previous': None, u'total': 0}} ``` Pointing a browser to the above link in the `'href'` field and replacing the `%2B` with a `+` [returns a populated track object](https://api.spotify.com/v1/search?query=track%3AUnbelievers+artist%3AVampire+Weekend&offset=0&limit=1&type=track), so I don't think the conversion from `+` to `%2B` that's happening somewhere along the `Spotipy.search` call stack should be happening...can it be avoided? I also noticed there were no search calls in the examples that specified > 1 field.
kerem closed this issue 2026-02-27 23:20:25 +03:00
Author
Owner

@purplehat7 commented on GitHub (Nov 3, 2014):

Looks like this conversion happens somewhere in requests.request...?

<!-- gh-comment-id:61444311 --> @purplehat7 commented on GitHub (Nov 3, 2014): Looks like this conversion happens somewhere in `requests.request`...?
Author
Owner

@nicangeli commented on GitHub (Jan 26, 2015):

👍 this
Looks like you can work around it with:

sp.search(q='track:Unbelievers AND artist:Vampire Weekend', type='track', limit=1)
<!-- gh-comment-id:71553573 --> @nicangeli commented on GitHub (Jan 26, 2015): :+1: this Looks like you can work around it with: ``` sp.search(q='track:Unbelievers AND artist:Vampire Weekend', type='track', limit=1) ```
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#18
No description provided.