从 Spotify 应用程序内访问 Spotify 元数据 API?
我想从 Spotify 应用程序中运行 Spotify 搜索(查找某个艺术家的曲目,我没有该艺术家的 Spotify URI,只有名称)。
我没有在 App API 中找到运行搜索的功能。另一种方法是与 ws.spotify.com
进行对话以访问 Spotify 的搜索,但这些网络服务不支持在 Spotify 应用程序中使用所需的 jsonp。
我有什么选择?
I want to run Spotify searches from within a Spotify app (to find tracks for an artist, for which I do not have a Spotify URI, only the name).
I have not found functionality in the App API to run searches. An alternative is to talk to ws.spotify.com
to get to Spotify's search, but these web services do not support jsonp which is required for their use in a Spotify app.
What are my options?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
则可以使用
sp.core.search
sp.core.getMetadata
如果您有 uri,
You can use
sp.core.search
sp.core.getMetadata
if you have the uri这不是解决您的问题的最佳方法。有一个直接的 API 可用于在您的应用程序中进行搜索。请参阅 Juan 的解决方案。
但是,当您将域添加到应用的 manifest.json 时,您也可以直接与 ws.spotify.com 对话。
"RequiredPermissions": ["http://ws.spotify.com" ]
例如 http://ws.spotify.com/search/1/track.json?q=kaizers+orchestra,查看他们的
开发者网站。响应包含标头“Access-Control-Allow-Origin: *”,因此您应该能够从应用程序内进行查询。
This is not the finest way to solve your problem. There is a direct API for searching within your app. See Juan's solution.
But you could also talk to ws.spotify.com directly when you add the domain to your app's manifest.json.
"RequiredPermissions": ["http://ws.spotify.com" ]
e.g. http://ws.spotify.com/search/1/track.json?q=kaizers+orchestra, see their
Developer Site. The response contains the header "Access-Control-Allow-Origin: *", so you should be able to query from within your app.