Skip to content

Instantly share code, notes, and snippets.

@thelinmichael
Created January 31, 2014 21:00
Show Gist options
  • Save thelinmichael/8743028 to your computer and use it in GitHub Desktop.
Save thelinmichael/8743028 to your computer and use it in GitHub Desktop.
Spotify Apps API - Get a list of artists and users that a specified user is following
<html>
<head>
</head>
<body>
<script>
require(["$api/models#User", "$api/relations#Relations"], function(User, Relations) {
var username = "kristiankarl";
var relations = Relations.forUser(User.fromURI("spotify:user:" + username));
relations.load("combinedSubscriptions").done(function() {
relations.combinedSubscriptions.snapshot().done(function(snapshot) {
console.log("Following: " + snapshot.length);
});
}).fail(function() {
console.log("Failed to get user relations");
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment