20

There is currently no way to retrieve the cover artwork using Spotify's Web API. Are there plans to implement these or any workarounds?

idleberg
  • 10,319
  • 7
  • 36
  • 57

3 Answers3

35

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

MiniGod
  • 3,363
  • 1
  • 23
  • 26
  • 3
    Great solution!! There's no documentation about this (i think). A trick: Dont forget to include an "&callback=?" after your oembed api call with getJSON() to make it JSONP (It worked for me ), if not you probably will receive an: _XMLHttpRequest cannot load https://embed.spotify.com/oembed/?url=...... Origin http:.... is not allowed by Access-Control-Allow-Origin. _ – Rubén Cougil Oct 27 '13 at 22:18
  • @jeraldov The metadata api does not return the URL to the cover in any of the endpoints (`/search` nor `/lookup`). You will have to use the `href` of album or artist or whatever from `ws.spotify.com`, and then use the method described above. – MiniGod Mar 21 '14 at 14:24
17

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)

jooon
  • 1,714
  • 14
  • 23
  • 1
    thanks jooon (sorry for the late reply), but i was hoping for an official way to do this. similar services such as rdio or grooveshark offer access to cover artwork through their api, so i was hoping spotify would offer this as well. – idleberg Aug 28 '12 at 22:26
  • If you have access to the App API (that runs in the Spotify desktop player) you can retrieve images by calling "toSpotifyURL()" on the string representation of the spotify URI. For instance, "spotify:image:f599d6e88c79432ddb2cf4743d0ba69b8014c5ba" turns into [this](http://o.scdn.co/image/f599d6e88c79432ddb2cf4743d0ba69b8014c5ba). – namuol Feb 06 '14 at 04:05