[GH-ISSUE #426] Search query for a specific genre from a specific year? #250

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

Originally created by @fortyTwo102 on GitHub (Jan 20, 2020).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/426

Pretty much what the title said. Kudos for the module!

Originally created by @fortyTwo102 on GitHub (Jan 20, 2020). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/426 Pretty much what the title said. Kudos for the module!
kerem closed this issue 2026-02-27 23:21:37 +03:00
Author
Owner

@stephanebruckert commented on GitHub (Jan 20, 2020):

It might work but you need to build your own query and pass it to sp.search(query).

Look for "year" on this page https://developer.spotify.com/documentation/web-api/reference/search/search

<!-- gh-comment-id:576338282 --> @stephanebruckert commented on GitHub (Jan 20, 2020): It might work but you need to build your own query and pass it to `sp.search(query)`. Look for "year" on this page https://developer.spotify.com/documentation/web-api/reference/search/search
Author
Owner

@fortyTwo102 commented on GitHub (Jan 20, 2020):

@stephanebruckert I tried it but what basically happens is that I can either only search using the genre or the year but not those two together. Adding a '+' between them does not work.

<!-- gh-comment-id:576339649 --> @fortyTwo102 commented on GitHub (Jan 20, 2020): @stephanebruckert I tried it but what basically happens is that I can either only search using the genre or the year but not those two together. Adding a '+' between them does not work.
Author
Owner

@stephanebruckert commented on GitHub (Jan 20, 2020):

For example: The query q=album:gold%20artist:abba&type=album returns only albums with the text “gold” in the album name and the text “abba” in the artist name.

this example looks promising, what does it give with genre and year?

Let me know if it works, but if it doesn't, you should post an issue in https://github.com/spotify/web-api/ instead, because this is related to what you receive from the API directly.

Edit: also note that tracks don't have a genre, only artists and albums sometimes do, so type=track might not give any result

<!-- gh-comment-id:576348640 --> @stephanebruckert commented on GitHub (Jan 20, 2020): > For example: The query `q=album:gold%20artist:abba&type=album` returns only albums with the text “gold” in the album name and the text “abba” in the artist name. this example looks promising, what does it give with `genre` and `year`? Let me know if it works, but if it doesn't, you should post an issue in https://github.com/spotify/web-api/ instead, because this is related to what you receive from the API directly. Edit: also note that tracks don't have a genre, only artists and albums sometimes do, so `type=track` might not give any result
Author
Owner

@fortyTwo102 commented on GitHub (Jan 20, 2020):

hey I managed to get it done. What I did was give a whitespace between the two params.
The query is something like sp.search("genre:avant-garde year:1966", type=artist)

<!-- gh-comment-id:576420891 --> @fortyTwo102 commented on GitHub (Jan 20, 2020): hey I managed to get it done. What I did was give a whitespace between the two params. The query is something like sp.search("genre:avant-garde year:1966", type=artist)
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#250
No description provided.