tutorial examples consumir api spotify

examples - spotify api tutorial



Recuperar portada con la API de Spotify (3)

17 de junio de 2014:

Hoy, Spotify lanzó una nueva API web .

Ahora es fácil recuperar la portada, ya que todos los puntos finales incluyen una matriz de images para cada item .

Ejemplo de búsqueda:
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 ... } ], ... } }

Vieja respuesta:

Puede obtener la URL de la portada llamando al servicio oEmbed de Spotify:

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
Con JSONP:
https://embed.spotify.com/oembed/?url=spotify:artist:7ae4vgLLhir2MCjyhgbGOQ&callback=callme

http://open.spotify.com/ urls también funcionan:

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>" }

Observe thumbnail_url :
https://d3rt1990lpmkn.cloudfront.net/cover/f15552e72e1fcf02484d94553a7e7cd98049361a

/cover/ representa el tamaño de la miniatura.
Tamaños disponibles: 60 , 85 , 120 , 140 , 160 , 165 , 230 , 300 , 320 y 640 .

eg: https://d3rt1990lpmkn.cloudfront.net/640/f15552e72e1fcf02484d94553a7e7cd98049361a

Actualmente no hay forma de recuperar la portada utilizando la API web de Spotify. ¿Hay planes para implementar estos o cualquier solución alternativa?


Hay planes para implementarlo, como en, queremos que esté allí, pero nadie está trabajando en ello. Es principalmente un problema legal con los términos de uso.

Técnicamente, es posible, por supuesto, calcularlo y acceder a las mismas imágenes que, por ejemplo, usa open.spotify.com analizando html. Eso no está permitido, por supuesto, pero técnicamente no hay nada que detenga el acceso.

(Trabajo en Spotify)