有没有办法使用soundcloud api 访问新图表https://soundcloud.com/charts/top(前50名)?或者还有其他方式吗?
也许用php或其他东西爬行?
Ste*_*ono 16
要找到可以与HTTP API请求一起使用的参数,您可以执行以下操作:
现在举例来说,如果你想知道参数"TOP 50 - Dance&EDM":
一些例子:
TOP | 舞蹈和EDM
https://api-v2.soundcloud.com/charts?kind = top&genre = soundcloud%3A generes%3A danceedm&client_id = ...
TOP | 深宅
https://api-v2.soundcloud.com/charts?kind = top&genre = soundcloud%3A genres%3A deephouse&client_id = ...
新热点
国家https://api-v2.soundcloud.com/charts?kind = 趋势和流派= soundcloud%3A 流派%3A country&client_id = ...
所有参数:
类:
类型:
php中获取TOP50的json响应的示例 - 国家/地区:
网址:https://api-v2.soundcloud.com/charts?kind = top&genre = soundcloud%3A genres%3A country&client_id = XXXXXXXXXXX&limit = 10&linked_partitioning = 1
网址参数:
种类:热门
类型:soundcloud:流派:country
client_id:XXXXXXXXXXX
限制:10
linked_partitioning:1
限制:您希望收到多少首歌曲作为回应.
linked_partitioning:页码,根据限制.
例如使用Limit = 10的linked_partitioning:
例如使用Limit = 20的linked_partitioning:
现在你有了URL,如果你想用PHP进行反向JSON响应,
你必须编写例如:
<?php
$url = "https://api-v2.soundcloud.com/charts?kind=top&genre=soundcloud%3Agenres%3Acountry&client_id=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&limit=10&linked_partitioning=1";
// Get JSON Response
$json = file_get_contents($url);
// Decode response to array
$objectJSON = json_decode($json, true);
Run Code Online (Sandbox Code Playgroud)
示例Json响应:
{
"genre":"soundcloud:genres:country",
"kind":"top",
"last_updated":"2016-03-24T09:50:02Z",
"collection":[
{
"track":{
"commentable":true,
"comment_count":211,
"downloadable":true,
"download_count":80,
"duration":251060,
.
.
.
"kind":"track",
.
.
.
.
"license":"all-rights-reserved",
"streamable":true,
"title":"Award winning Falling Star",
"uri":"https://api.soundcloud.com/tracks/245170733",
.
.
.
"country_code":"US"
}
"score":1093171.0
},
{
...
},
OTHER TRACKS HERE...
],
"query_urn":"soundcloud:charts:bc9b903f2cee44e7bca955bc2fc4601d",
"next_href":"https://api-v2.soundcloud.com/charts?genre=soundcloud%3Agenres%3Acountry&query_urn=soundcloud%3Acharts%3Abc9b903f2cee44e7bca955bc2fc4601d&offset=20&kind=top&limit=20"
}
}
Run Code Online (Sandbox Code Playgroud)
如果要读取响应的JSON内容:
// Read Json taking for example Name, Title and SoundCloud URI of song.
foreach ($objectJSON["collection"] as $key => $value) {
echo 'user: ' . $value['track']['user']['full_name'] . "<br/>";
echo 'title: ' . $value['track']['title'] . "<br/>";
echo 'url: ' . $value['track']['uri'] . "<br/><br/>";
}
echo $response;
?>
Run Code Online (Sandbox Code Playgroud)
这个PHP的结果:
user: ...
title: ...
url: ...
user: ...
title: ...
url: ...
...
Run Code Online (Sandbox Code Playgroud)
我希望我帮助过你,对不起我的英语.
编辑:
我认为SoundCloud已经改变了获得下一页的方式.现在你需要改变"偏移"参数.
像这样:
Page 1: ....&limit=20&offset=0
Page 2: ....&limit=20&offset=20
Page 3: ....&limit=20&offset=40
Run Code Online (Sandbox Code Playgroud)
为了查找系统播放列表,我使用了Charles Web Debugging Proxy.
想法是从iOS设备(在我的例子中)嗅探由SoundClound App发送的网络包.
之后,您将Charles配置为正确嗅探SSL包,您可以将pc用作智能手机的代理.
(您必须在Windows和iOS设备上安装Charles证书才能正确嗅探SSL包,有关更多信息,请搜索google).
现在,打开SoundCloud App并单击应用程序内的每个播放列表(TOP,NEWS).截图下方(质量由油漆驱动,抱歉ahah):

现在在查尔斯内部我们可以看到这样的事情:
我只将焦点设置在SoundCloud主机上,以便更好地读取传入的包.
Charles非常聪明并且将所有类似的请求放入子文件夹中,在我们的例子中,我们必须查看"system-playlist"中的所有请求.
现在,从所有请求中,您可以检索所有系统播放列表值.
我没有列出所有的播放列表歌曲,因为目前我没有太多时间.
我尽快编辑这篇文章,其中包含可能的系统播放列表的完整列表.
| 归档时间: |
|
| 查看次数: |
4324 次 |
| 最近记录: |