Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mager/2154948 to your computer and use it in GitHub Desktop.
Save mager/2154948 to your computer and use it in GitHub Desktop.
Spotify Apps API - Get songs from a playlist URL
/* Instantiate the global sp object; include models & views */
var sp = getSpotifyApi(1);
var models = sp.require("sp://import/scripts/api/models");
var playlist_url = 'http://open.spotify.com/user/jkeck99/playlist/21iMSq0jzTie7m7v4UcMlV';
var pl = models.Playlist.fromURI(playlist_url, function(playlist) {
for(i=0;i<playlist.tracks.length;i++){
var link = '<li><a href="' + playlist.tracks[i].uri + '">' + playlist.tracks[i].name + '</a></li>';
$('#playlist').append(link);
}
});
@Florencemanning1
Copy link

thank for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment