我有一个SoundCloud client_id ,我想知道 user_id 或用户名。实际上我有一个轨道的完整链接。无论如何我能做到吗?
答案 0 :(得分:0)
我认为您所要求的是使用曲目链接,找到曲目上传者的user_id和用户名。
如果您知道完整的soundcloud.com跟踪网址,请点击/resolve
端点。作为参考,我将使用以下网址:https://soundcloud.com/madanofficial/the-police-walking-on-the-moon-j-art-madan-remix
HTTP GET: https://api.soundcloud.com/resolve.json?url=https%3A%2F%2Fsoundcloud.com%2Fmadanofficial%2Fthe-police-walking-on-the-moon-j-art-madan-remix&client_id=[YOUR client_id]
结果JSON:
{
"status": "302 - Found",
"location": "https://api.soundcloud.com/tracks/147986343.json?client_id=[YOUR client_id]"
}
当我们使用/tracks
端点再次点击SoundCloud API时,只需解析返回的user
对象。
"user": {
"id": 44553705,
"kind": "user",
"permalink": "madanofficial",
"username": "Madan.",
"uri": "https://api.soundcloud.com/users/44553705",
"permalink_url": "http://soundcloud.com/madanofficial",
"avatar_url": "https://i1.sndcdn.com/avatars-000098677604-mwg7te-large.jpg?e76cf77"
}