是否可以通过soundcloud API从特定用户获取曲目列表,而无需该特定用户进行身份验证?
我正在寻找你可以在这里获得的类似YouTube提要的东西:https://gdata.youtube.com/feeds/api/users/mrromandiaz/uploads?max-results=10 (我已经将它指向我的帐户,但是用户名"mrromandiaz“可以替换为任何用户名来检索该用户的视频...
问题是,Soundcloud有没有提供类似的功能?我不需要验证、发布、上传或控制任何东西。只需让用户的曲目列表显示在他们的个人资料上,而不是求助于默认播放器。
发布于 2012-04-15 16:32:55
是的,API端点在/users/{user_id}/tracks
。如果没有用户id,只有他们的用户名(固定链接),那么可以使用/resolve
端点来获取用户数据,包括他们的id。
文档在这里:user resource和这里resolve。
发布于 2014-04-28 18:37:41
要通过soundcloud API从特定用户获取曲目列表,而无需进行身份验证:
(javascript示例)
SC.initialize({
client_id: "YOUR_CLIENT_ID",
redirect_uri: "http://example.com/callback.html",
});
/**
Once that's done you are all set and ready to call the SoundCloud API.
**/
/**
Call to the SoundCloud API.
Retrieves list of tracks, and displays a list with links to the tracks showing 'tracktitle' and 'track duration'
**/
var userId = 39090345; // user_id of Prutsonic
SC.get("/tracks", {
user_id: userId,
limit: 100
}, function (tracks) {
for (var i = 0; i < tracks.length; i++) {
console.log(tracks[i].title);
}
});
你可以在这里试试我的小提琴:http://jsfiddle.net/tobiasbeuving/26pHX/5/
(PHP示例:)
try {
$tracks = $client->get('tracks', array('user_id' => '39090345','limit' => 100));
} catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
print $e->getMessage();
}
(我刚刚回答了一个类似的问题Soundcloud stratus player won't dynamically add more than an individual track at a time,但我不知道如何处理“重复问题”的情况。
干杯,T
https://stackoverflow.com/questions/10159802
复制相似问题