获取相关曲目HTTP API SoundCloud的列表

时间:2015-04-05 15:53:54

标签: soundcloud

我无法找到适合HTTP API文档的任何内容 据我所知,当前曲目结束后,SC小部件中会弹出一些曲目,因此SC本身有一些相关的曲目功能,但是我们可以通过API访问它吗? 即获得与给定曲目的id相关的曲目列表。

1 个答案:

答案 0 :(得分:10)

免责声明:这是一个未记录的端点,可随时由SoundCloud进行更改。

有一个未记录的端点,允许您访问轨道的相关声音:

HTTP GET: https://api.soundcloud.com/tracks/[TRACK_ID]/related?client_id=[YOUR_CLIENT_ID]

您没有指定语言,因此我将简要介绍如何使用端点。

首先,获取您的跟踪网址。我将以此为例:https://soundcloud.com/msmrsounds/ms-mr-hurricane-chvrches-remix

然后点击resolve端点以获取track_id。

HTTP GET: https://api.soundcloud.com/resolve.json?url=https%3A%2F%2Fsoundcloud.com%2Fmsmrsounds%2Fms-mr-hurricane-chvrches-remix&client_id=[YOUR_CLIENT_ID]

响应:

{
  "status": "302 - Found",
  "location": "https://api.soundcloud.com/tracks/90787841.json?client_id=[YOUR_CLIENT_ID]"
}

接下来,使用related点击track_id端点。

HTTP GET: https://api.soundcloud.com/tracks/90787841/related?client_id=[YOUR_ClIENT_ID]

完整的回复将为您提供多达50个相关曲目。响应太大而无法发布,但它只是一系列曲目。

[
  {
    "kind": "track",
    "id": 112741336,
    "created_at": "2013/09/27 09:40:29 +0000",
    "user_id": 59817646,
    "duration": 215896,
    "commentable": true,
    "state": "finished",
    "original_content_size": 38068298,
    "last_modified": "2015/04/04 20:17:24 +0000",
    "sharing": "public",
    "tag_list": "CHVRCHES Whitney Houston Zane Lowe",
    "permalink": "chvrches-its-not-right-but-its",
    "streamable": true,
    "embeddable_by": "all",
    "downloadable": false,
    "purchase_url": null,
    "label_id": null,
    "purchase_title": null,
    "genre": "Electronic",
    "title": "CHVRCHES - It's Not Right But It's Okay (Whitney Houston Cover)",
    "description": "CHVRCHES - It's Not Right But It's OK (Whitney Houston Cover) from Zane's Live Sessions",
    "label_name": "",
    "release": "",
    "track_type": "recording",
    "key_signature": "",
    "isrc": "",
    "video_url": null,
    "bpm": null,
    "release_year": null,
    "release_month": null,
    "release_day": null,
    "original_format": "wav",
    "license": "all-rights-reserved",
    "uri": "https://api.soundcloud.com/tracks/112741336",
    "user": {
      "id": 59817646,
      "kind": "user",
      "permalink": "uknewmusic",
      "username": "UKNewMusic",
      "last_modified": "2013/09/27 09:38:04 +0000",
      "uri": "https://api.soundcloud.com/users/59817646",
      "permalink_url": "http://soundcloud.com/uknewmusic",
      "avatar_url": "https://a1.sndcdn.com/images/default_avatar_large.png"
    },
    "permalink_url": "http://soundcloud.com/uknewmusic/chvrches-its-not-right-but-its",
    "artwork_url": "https://i1.sndcdn.com/artworks-000058757165-6tnuep-large.jpg",
    "waveform_url": "https://w1.sndcdn.com/XkEffI5hwjZ7_m.png",
    "stream_url": "https://api.soundcloud.com/tracks/112741336/stream",
    "playback_count": 680326,
    "download_count": 0,
    "favoritings_count": 9241,
    "comment_count": 199,
    "attachments_uri": "https://api.soundcloud.com/tracks/112741336/attachments",
    "policy": "ALLOW"
  },
  { ...
  }
]