Spotify Apps API: Library-class won't return users Playlists

后端 未结 3 1776
南方客
南方客 2021-01-17 01:27

I\'m trying to get an array containing all Playlists in the users Library (http://developer.spotify.com/download/spotify-apps-api/reference/dcdebc652c.html).

No prob

相关标签:
3条回答
  • 2021-01-17 02:09

    I'm thinking it's a bug with the 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)
    

    Digging in the models.js file we see that Library uses sp.core.library.getPlaylists() to get the playlists, which should return an Array but returns undefined:

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

    Since sp.core.library.getPlaylists is native code I am unable to go deeper down the rabbit hole to see what it is doing. So unless the spotify devs say it is the desired behaviour my conclusion is that it is a bug.

    0 讨论(0)
  • 2021-01-17 02:16

    I looks like sp.core.library.getPlaylists got disabled in . 0.8.0–701-gc2d793a

    0 讨论(0)
  • 2021-01-17 02:21

    Here's the official answer:

    Unfortunately, the ability to get the user's playlists in the Spotify Apps API has been removed for privacy reasons. This was done very last-minute, and the documentation wasn't updated in time. We'll be releasing a new build of the client and documentation that reflects this change soon.

    0 讨论(0)
提交回复
热议问题