Are there any methods in Spotify API that can auto
I am planning to use the Spotify API to fetch some data, feeding track name and artist as search keywords. However, the track name and artist data I have some parsing errors, and I was wondering if there are any methods in Spotify API that auto-corrects the keywords.
For example, Google will fetch me documents about Radiohead even if I search for 'Radiohea','Radihead', and so. Also, the Last.fm API provides a method named 'track.getCorrection', which does jobs similar to those I explained above.
Here is the explanation of the method from the official Last.fm API website: 'Use the last.fm corrections data to check whether the supplied track has a correction to a canonical track.'
Does anyone know if such method exists in Spotify API?
No, there's no auto-correction engine.
The closer Spotify gets to having a search engine is the search endpoint
:
as told by documentation here.
you can search, for instance, like this:
query = 'radio head'
and then
query_results = sp.search(q=query, type='playlist')
would return
...u'playlist'...{u'name': u'Air/Zero 7/Thievery Corp/Radio Head/Massive Attack/Morcheeba',...
but that requires that the playlist user spelled it wrong too.
that is as far as a typo can get you, I'm afraid.
a workaround is fetching the artist using last.fm
API
, use its auto-correction tool and then feed this result into Spotify
API, either using artist
, track
or search
endpoints.
I highly recommend you using more than one API for your app, as each one has its own limitations.
hope this helps.
链接地址: http://www.djcxy.com/p/55600.html上一篇: 点子:我如何通过艺术家和歌曲进行搜索