Filtering tracks using streamable = true in Soundcloud

I am trying to use the javascript SDK for Soundcloud to return a list of tracks that are streaming.

My question is: how do I filter search results only for streaming songs using the javascript SDK?

Here is an example that will return songs that are not streaming:

SC.get('/tracks', {q: 'mat zo', filter: 'streamable'}).then(function (tracks) { 
    console.log(tracks); 
});

Here's what happened:

api.soundcloud.com/tracks?q=mat+zo&filter=streamable&format=json&client_id= [XXX]

I noticed that the first track in this answer has streamable = false.
response snippet:

...
    streamable: false
    tag_list: "Remix Mat Zo Burn Ellie Goulding"
    name: "Burn (Mat Zo Remix)"
    track_type: ""
    ...

Soundcloud SDK, , "" "(, , )".

https://developers.soundcloud.com/docs/api/reference#tracks ( )

: stackoverflow.com/questions/23791711/filtering-tracks-by-streamable-in-soundcloud

, . .

+4
2

() API. , :

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); 
});
+1

, . , "" , :

, , , , tag_list.

  // find all sounds of buskers licensed under 'creative commons share alike'
SC.get('/tracks', {
  q: 'buskers', license: 'cc-by-sa'
}).then(function(tracks) {
  console.log(tracks);
});

streamable "cc-by-sa" "true".

-1

Source: https://habr.com/ru/post/1620245/


All Articles