我如何获得spotify艺术家图像/肖像?

时间:2012-07-10 00:53:15

标签: image api model spotify

我想找一个艺术家的形象/肖像。但是,使用Artist.fromURI()将返回艺术家对象但不返回肖像。我在StackOverflow上阅读了其他一些帖子,有人建议使用:

sp.core.browseURI() 

因为fromURI仅出于性能原因检索基本信息。但是最近spotify声明我们不再允许使用sp.core调用。那么替代方案是什么?

相反,这就是我正在使用的:

models.Artist.fromURI(uri, function(artist) {
   // this is called when artist is loaded but the following shows blank even
   // when the artist has an image
   console.log(artist.data.portrait);
});

1 个答案:

答案 0 :(得分:0)

Artist对象具有image属性,在艺术家加载后会填充URI。

拥有该URI后,您可以像使用任何其他图像URI一样使用它 - 将其放在img元素中等等。

值得注意的是,有些艺术家没有肖像。在这种情况下,您应该使用他们的专辑封面之一。

相关问题