Retrieve cover artwork using Spotify API
There is currently no way to retrieve the cover artwork using Spotify's Web API. Are there plans to implement these or any workarounds?
June 17th 2014:
Today Spotify released a new Web API.
It is now easy to retrieve cover artwork, as all endpoints includes an array of images
for every item
.
Search example:
curl -X GET "https://api.spotify.com/v1/search?q=tania%20bowra&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
...
} ],
...
}
}
Old Answer:
You can get the URL to the cover art by calling Spotify's oEmbed service:
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
With JSONP:
https://embed.spotify.com/oembed/?url=spotify:artist:7ae4vgLLhir2MCjyhgbGOQ&callback=callme
http://open.spotify.com/
urls work as well:
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>"
}
Notice the thumbnail_url
:
https://d3rt1990lpmkn.cloudfront.net/cover/f15552e72e1fcf02484d94553a7e7cd98049361a
/cover/
represents the size of the thumbnail.
Available sizes: 60
, 85
, 120
, 140
, 160
, 165
, 230
, 300
, 320
, and 640
.
eg: https://d3rt1990lpmkn.cloudfront.net/640/f15552e72e1fcf02484d94553a7e7cd98049361a
There are plans to implement it, as in, we want it to be there, but nobody is working on it. It is mostly a legal problem with terms of use.
Technically, it is of course possible to figure it and access the same images that for instance open.spotify.com uses by parsing html. That is not allowed of course, but there is nothing technically that stops access.
(I work at Spotify)
The iTunes and Deezer API are also useful :
http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html
http://developers.deezer.com/api/search
链接地址: http://www.djcxy.com/p/55634.html上一篇: 从Spotify的顶级歌曲获取播放次数
下一篇: 使用Spotify API检索封面插图