Searching in an artist's tracks

Using the Spotify API, I am trying to search through tracks of an artist. The query I used is working, and looks like:

https://api.spotify.com/v1/search?q=track:' + song + '%20artist:' + artist + '&type=track&limit=10

It's working however it's returning tracks for artists containing the artist name provided in any part of their artist name string. For example, if I want to be explicit about artist name, and want to search in ZHU's tracks, I couldn't find a way how I should make the query, so it becomes explicit about artist's name.

As I said, if I want to search in ZHU's tracks, it also returns me Natalie Zhu's tracks as well.

What is the proper way of being explicit about artist name?

Is there a way to explicitly define that I am going to search in ZHU's tracks?


Edit: I also tried using quotation marks:

https://api.spotify.com/v1/search?q=track:"' + song + '"%20artist:"' + artist + '"&type=track&limit=10

Maybe I used it wrong, I am not sure, but if I didn't this doesn't seem to solve :/


https://developer.spotify.com/web-api/search-item/

Under the track object (full) section, the keyword for the title of the song is not "track" but rather "name".

https://api.spotify.com/v1/search?q=name:' + song + '%20artist:' + artist + '&type=track&limit=10

It seems that currently there is no way to explicitly search for tracks of a single artist. You can only limit artists by name, as you have done, but this has the drawback of potentially including tracks by other artists whose name contains the name of the intended artist, as you explained. The only way around this is to filter the returned results and fetch more if necessary.

I have opened an issue about this at the Soptify API issue tracker Github repo, but so far, there is no info about the implementation.

链接地址: http://www.djcxy.com/p/9470.html

上一篇: 在Spotify帐户中使用Spotify API登录用户

下一篇: 搜索艺术家的曲目