今天Spotify发布了一个新的Web Api。
现在很容易找到封面图稿,因为all endpoints包含每个项目的一系列图像。
搜索示例:
卷曲-X GET“https://api.spotify.com/v1/search?q=tania bowra& type = artist”
{ "artists" : { ... "items" : [ { ... "images" : [ { "height" : 640, "url" : "https://d3rt1990lpmkn.cloudfront.net/original/f2798ddab0c7b76dc2d270b65c4f67ddef7f6718", "width" : 640 }, { "height" : 300, "url" : "https://d3rt1990lpmkn.cloudfront.net/original/b414091165ea0f4172089c2fc67bb35aa37cfc55", "width" : 300 }, { "height" : 64, "url" : "https://d3rt1990lpmkn.cloudfront.net/original/8522fc78be4bf4e83fea8e67bb742e7d3dfe21b4", "width" : 64 ... } ], ... } }
老答案:
您可以通过致电Spotify的oEmbed服务获取封面艺术的网址:
https://embed.spotify.com/oembed/?url=spotify:track:6bc5scNUVa3h76T9nvpGIH
https://embed.spotify.com/oembed/?url=spotify:album:5NCz8TTIiax2h1XTnImAQ2
https://embed.spotify.com/oembed/?url=spotify:artist:7ae4vgLLhir2MCjyhgbGOQ
使用JSONP:
https://embed.spotify.com/oembed/?url=spotify:artist:7ae4vgLLhir2MCjyhgbGOQ&callback=callme
http://open.spotify.com/网址也可以:
https://embed.spotify.com/oembed/?url=http://open.spotify.com/track/6bc5scNUVa3h76T9nvpGIH
{ "provider_url": "https:\/\/www.spotify.com", "version": "1.0", "thumbnail_width": 300, "height": 380, "thumbnail_height": 300, "title": "Gusgus - Within You", "width": 300, "thumbnail_url": "https:\/\/d3rt1990lpmkn.cloudfront.net\/cover\/f15552e72e1fcf02484d94553a7e7cd98049361a", "provider_name": "Spotify", "type": "rich", "html": "<iframe src=\"https:\/\/embed.spotify.com\/?uri=spotify:track:6bc5scNUVa3h76T9nvpGIH\" width=\"300\" height=\"380\" frameborder=\"0\" allowtransparency=\"true\"><\/iframe>" }
注意thumbnail_url:
https://d3rt1990lpmkn.cloudfront.net/cover/f15552e72e1fcf02484d94553a7e7cd98049361a
/ cover /表示缩略图的大小。
可用尺寸:60,85,120,300和640。
例如:https://d3rt1990lpmkn.cloudfront.net/640/f15552e72e1fcf02484d94553a7e7cd98049361a