Spotify API 中是否有任何方法可以自动更正搜索关键字?
Are there any methods in Spotify API that can auto-correct search keywords?
我打算使用 Spotify API 获取一些数据,提供曲目名称和艺术家作为搜索关键字。但是,曲目名称和艺术家数据我有一些解析错误,我想知道 Spotify API 中是否有任何方法可以自动更正关键字。
例如,即使我搜索 'Radiohea'、'Radihead' 等,Google 也会为我获取有关 Radiohead 的文档。此外,Last.fm API 提供了一个名为 'track.getCorrection' 的方法,它的工作与我上面解释的类似。
这里是Last.fmAPI官网对方法的解释:
'Use the last.fm corrections data to check whether the supplied track has a correction to a canonical track.'
有谁知道 Spotify 中是否存在这种方法 API?
不,没有自动更正引擎。 Spotify 最接近拥有搜索引擎的是 search endpoint:
你可以这样搜索,比如:
query = 'radio head'
然后
query_results = sp.search(q=query, type='playlist')
会return
...u'playlist'...{u'name': u'Air/Zero 7/Thievery Corp/Radio Head/Massive Attack/Morcheeba',...
但这要求播放列表用户也拼写错误。恐怕打字错误就到此为止了。
解决方法是使用 last.fm API 获取艺术家,使用其自动更正工具,然后将此结果输入 Spotify API,或者使用 artist
, track
或 search
个端点。
我强烈建议您为您的应用使用多个 API,因为每个应用都有其自身的局限性。
我打算使用 Spotify API 获取一些数据,提供曲目名称和艺术家作为搜索关键字。但是,曲目名称和艺术家数据我有一些解析错误,我想知道 Spotify API 中是否有任何方法可以自动更正关键字。
例如,即使我搜索 'Radiohea'、'Radihead' 等,Google 也会为我获取有关 Radiohead 的文档。此外,Last.fm API 提供了一个名为 'track.getCorrection' 的方法,它的工作与我上面解释的类似。
这里是Last.fmAPI官网对方法的解释: 'Use the last.fm corrections data to check whether the supplied track has a correction to a canonical track.'
有谁知道 Spotify 中是否存在这种方法 API?
不,没有自动更正引擎。 Spotify 最接近拥有搜索引擎的是 search endpoint:
你可以这样搜索,比如:
query = 'radio head'
然后
query_results = sp.search(q=query, type='playlist')
会return
...u'playlist'...{u'name': u'Air/Zero 7/Thievery Corp/Radio Head/Massive Attack/Morcheeba',...
但这要求播放列表用户也拼写错误。恐怕打字错误就到此为止了。
解决方法是使用 last.fm API 获取艺术家,使用其自动更正工具,然后将此结果输入 Spotify API,或者使用 artist
, track
或 search
个端点。
我强烈建议您为您的应用使用多个 API,因为每个应用都有其自身的局限性。