Skip to content

Instantly share code, notes, and snippets.

@StefKors
Created Jan 24, 2019
Embed
What would you like to do?
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