Spotify 中的区域限制和链接曲目
我正在构建一个应用程序,需要知道曲目是否可以在用户所在的区域播放。
使用元数据 API 可以轻松检查曲目的基本地域限制。但是,我遇到元数据 API 认为不在我的区域内的曲目,但它们会自动链接到未锁定区域的同一曲目的版本。 IE。元数据显示我无法播放某首曲目,但就用户而言,Spotify 可以播放该曲目。
以下是一个示例:
“Sweet Unrest”,作者:Apparat@spotify:track:4H4h3ulzjGVox14GHiCEoo
我在英国(地区代码 GB)
查找链接为 http://ws.spotify.com/lookup/1/.json?uri=spotify:track:4H4h3ulzjGVox14GHiCEoo
生成的地区字符串中没有 GB 代码,所以理论上,我应该无法播放该曲目。但是,在主 Spotify 播放器中,我可以看到它自动链接到 spotify:track:11S6TQybYumAnNApugZWSJ 在我所在的地区可以播放。如果我将原本无法播放的曲目的 URI 粘贴到左上角的 Spotify 搜索框中,它就会播放。
有没有基于 API 的方法来检查这样的曲目?
I am building an app that needs to know if a track is playable in the user's region.
It's easy to check the basic territorial restrictions of a track using the Metadata API. However, I am encountering tracks that the Metadata API says are out of my region, but are auto-linked to versions of the same track that aren't region locked. ie. Metadata says I can't play a track, but as far as the user is concerned, Spotify can play that track.
Here's an example:
'Sweet Unrest' by Apparat @ spotify:track:4H4h3ulzjGVox14GHiCEoo
I am in the UK (territory code GB)
The lookup link is http://ws.spotify.com/lookup/1/.json?uri=spotify:track:4H4h3ulzjGVox14GHiCEoo
There is no GB code in the resulting territories string, so in theory, I should not be able to play the track. However, in the main Spotify player, I can see that it is auto linked to spotify:track:11S6TQybYumAnNApugZWSJ which is playable in my region. If I paste the supposedly unplayable track's URI into the top left Spotify search box, it plays.
Is there an API based way to check for tracks like this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用每个曲目的未记录属性来检测曲目是否可播放: data.availableForPlayback
如果您运行上面的代码,您应该得到一个 True/False 来执行您想要的操作。
You can detect whether a track is playable or not using an undocumented property of each track: data.availableForPlayback
If you run the code above, you should get a True/False that does what you're after.
不幸的是,目前还没有。链接实际上是由客户端本身而不是我们的任何后端服务完成的,因此我们的 API 都没有此信息。
Unfortunately not, not at this time. The linking is actually done by the client itself rather than any of our backend services, so none of our APIs have this information.