Skip to content

Instantly share code, notes, and snippets.

@StefKors
Created January 24, 2019 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StefKors/8464e8e7d9575c34fc08a4aad8f52764 to your computer and use it in GitHub Desktop.
Save StefKors/8464e8e7d9575c34fc08a4aad8f52764 to your computer and use it in GitHub Desktop.
return soundcloud id from playlist link
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
</body>
<script src="http://connect.soundcloud.com/sdk.js"></script>
<script>
SC.initialize({
client_id: "id"
});
resolveSCPlaylist('https://soundcloud.com/sonicacts/sets/progress-bar-s03e06-28-april')
function resolveSCPlaylist(url) {
if (!url) {
alert('you have to fill the playlist URL input');
return false;
}
SC.get('/resolve/?url=' + url, {
limit: 1
}, function(result) {
if (result && result.id) {
alert('the playlist id is: ' + result.id);
} else {
alert('playlist not found');
}
});
}
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment