SoundCloud, filtering by query on the tracks of a specific user doesn't work

馋奶兔 提交于 2019-12-10 21:14:53

问题


I'm trying to use the soundcloud api to get the tracks of a specific user that's matching the query i am inputting

here's an example without querying, works fine, gets all tracks for that user http://api.soundcloud.com/users/4493849/tracks.json?client_id=YOUR_CLIENT_ID

works fine and gets me the 5 tracks for that user

now I need to only get the track called "Test Audio". so I do as follows http://api.soundcloud.com/users/4493849/tracks.json?client_id=YOUR_CLIENT_ID&q=Test

now the problem is, when I put the q= , it simply brings me all tracks in the whole of soundcloud which match Test, i.e. it queries all soundcloud not the 5 tracks for that user as I want to

Any help please


回答1:


I tried it with the SC own SDK here:

http://jsfiddle.net/iambnz/H7VW8/

SC.initialize({ client_id: "cd3e093bf9688f09e3cdf15565fed8f3" });  

SC.get('/users/4493849', { q: 'test' }, function(tracks) {
  console.log(tracks);
});

Result will be just one track / object:

Object {id: 4493849, kind: "user", permalink: "the-uprising-developers", username: "The Uprising Developers", uri: "http://api.soundcloud.com/users/4493849"…}



回答2:


The SoundCloud's API doesn't work with user sub-resources and search query.

So, the best way to do this is to load all tracks (batch load with offset parameter, if user has lots of tracks) all tracks and then code your search in the results.

This was the first feature that i needed too when i started my app, but there is no way to do this only with thiers API.



来源:https://stackoverflow.com/questions/19896943/soundcloud-filtering-by-query-on-the-tracks-of-a-specific-user-doesnt-work

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!