Spotify Apps API:库类不会返回用户播放列表



我试图得到一个数组包含所有的播放列表在用户库(http://developer.spotify.com/download/spotify-apps-api/reference/dcdebc652c.html)。

其他类属性(album, artists, starredPlaylist, tracks)没有问题,但是不知怎么的"Playlists"属性不能使用

var allPlaylists = models.library.playlists;

var allArtists= models.library.artists;

工作很好!(都使用document.write(var))

有什么建议吗?谢谢你!

官方答案:

不幸的是,由于隐私原因,在Spotify应用程序API中获取用户播放列表的功能已被删除。这是在最后一刻完成的,并且文档没有及时更新。我们将很快发布反映此更改的客户端和文档的新版本。

我看起来sp.core.library.getPlaylists被禁用了。0.8.0-701-gc2d793a

我认为这是API的错误。

sp = getSpotifyAPI(1);
models = sp.require('sp://import/scripts/api/models')
models.library.playlists;
> TypeError: Cannot read property 'length' of undefined
try { models.library.playlists } catch(err) { console.log(err.stack) }
> TypeError: Cannot read property 'length' of undefined
    at map (sp:216:20)
    at Library.<anonymous> (eval at evalModule (sp:55:46))
    at unknown source
    at Object._evaluateOn (unknown source)
    at Object._evaluateAndWrap (unknown source)
    at Object.evaluate (unknown source)

在models.js文件中,我们看到库使用sp.core.library.getPlaylists()来获取播放列表,它应该返回一个数组,但返回undefined:

sp.core.library.getPlaylists()
> undefined
sp.core.library.getPlaylists
> function getPlaylists() { [native code] }

由于sp.core.library.getPlaylists是本机代码,我无法深入了解兔子洞,看看它在做什么。所以除非spotify的开发者说这是他们想要的行为,否则我的结论是这是一个漏洞。

最新更新