I am working on an application which would allow users to enter some text as song name and another input for the artist name, and then will check whether a song exists that matches both the input parameters. I'm currently using Spotify's API for the same by querying for the song 'Get In The Game' using this endpoint:
https://api.spotify.com/v1/search?q=get%20in%20the%20game&type=track
However, Spotify's API does not allow filtering the results using both the song name and artist name together. As a result, the above query returns a list of all songs that match the Get in the Game
song title.
How can I find whether a song exists based on the song and artist name?
Answer
You could use the last.fm API, specifically the track.getInfo
Endpoint. This lets you specify both artist
and track
at once.
On success (you could also request for a json response) you get something like:
when the song is not found:
Track not found
No comments:
Post a Comment