I am using sound cloud api (specifically js player) and want to get all comments of the specific track. Their api says this:
/tracks/_{id}_/comments开发者_如何学编程:
which I dont get, what's ID and how to query it in general. Can you give me a simple example how to get all comments for the track?
the id is the track ID, every track on SoundCloud has its own ID you get it when you get the track data, one of the fields is called id.
To find the ID of a track, given just its permalink (the url you see when you look at the track on soundcloud.com), then you can use the /resolve
endpoint (broken onto a new lines for legibility)
https://api.soundcloud.com/resolve
?url=http://soundcloud.com/eric/weird-mixer-sound
&client_id=YOUR_CLIENT_ID
Old post but I recently had to do this. Here is how to do it with javascript:
To get track id where PATH is path to song:
SC.get(PATH
, function (track, err) {
// obtain track's id
var TRACK_ID = track.id;
});
then use that ID to get your comment list
SC.get("/tracks/"+TRACK_ID+"/comments"
, function (comments, err) {
var COMMENTS = comments;
});
精彩评论