I am trying to use the javascript SDK for Soundcloud to return a list of tracks that are streamable.
My question is: How do I filter search results for only streamable songs using the javascript SDK?
Here is an example that will return songs that are not streamable:
SC.get('/tracks', {q: 'mat zo', filter: 'streamable'}).then(function (tracks) {
console.log(tracks);
});
Here is what the request comes out to be:
api.soundcloud.com/tracks?q=mat+zo&filter=streamable&format=json&client_id=[XXX]
I noticed that the first track in this response has streamable=false.
snippet of the response:
...
streamable: false
tag_list: "Remix Mat Zo Burn Ellie Goulding"
title: "Burn (Mat Zo Remix)"
track_type: ""
...
Looking at the Soundcloud SDK documentation I don't see a way to do this as the 'filter' query parameter only accepts '(all, public, private)'.
https://developers.soundcloud.com/docs/api/reference#tracks (I am looking at the Filters)
same unanswered question: stackoverflow.com/questions/23791711/filtering-tracks-by-streamable-in-soundcloud
Thanks in advance, this is my first question. I can provide more of my code upon request.
There is no (documented) filter for the streamable property on the API. You can however easily filter out the unstreamable tracks yourself:
SC.get('/tracks', {q: 'mat zo'}).then(function (tracks) {
for(var i = 0; i < tracks.length; i++) {
if(!(tracks[i].streamable)) {
tracks.splice(i,1);
}
}
console.log(tracks);
});