Soundcloud API-按特定顺序检索用户追随者
Soundcloud API - retrieving users followers in a particular order
最近我有了一个想法,为自己的目的制作一个Chrome扩展,应该使用SoundCloud API。但我发现API的功能非常有限,或者我需要的功能没有文档记录/我只是没有找到答案。例如,首先我想按特定顺序检索一些用户的追随者。为了澄清这一点,响应应该按照followers_count->descending进行排序。因此,响应中的第一个关注者应该是我们请求的用户的所有关注者周围拥有最大关注者数量的关注者。等等经过大量搜索@google,我发现了一个旧帖子,其中一个人询问了类似的功能,SC支持人员告诉他在请求中使用"&order=value",这很好,但现在不推荐使用,也不起作用。我想知道目前是否有可能,如果没有,我们能期待这个功能很快被添加吗?我相信这根本不是一件复杂的事情。
简而言之,我需要的是按照特定的顺序检索任何用户followers_count。这是第一个问题。如果我们在这里取得成功,我们会走得更深。谢谢。非常感谢您的帮助。
假设您想从Souncloud中按desc顺序检索用户追随者。
假设我们有五个用户拥有声音云配置文件URL
- https://soundcloud.com/drop-the-bassline
- https://soundcloud.com/certifiedjackin
- https://soundcloud.com/ravingkoko
- https://soundcloud.com/twenty4sevenedm
- https://soundcloud.com/pr-gangstahouse
代码
// Need Soundcloud SDK
require_once 'Services/Soundcloud.php';
// Create Object
$client = new Services_Soundcloud(CLIENT_ID, CLIENT_SECRET);
$result = array();
$urls = array(array
(
'link' => 'https://soundcloud.com/drop-the-bassline',
),
array
(
'link' => 'https://soundcloud.com/certifiedjackin',
),
array
(
'link' => 'https://soundcloud.com/ravingkoko',
),
array
(
'link' => 'https://soundcloud.com/twenty4sevenedm',
),
array
(
'link' => 'https://soundcloud.com/pr-gangstahouse',
)
);
foreach($urls as $key=>$u){
try{
$response = json_decode($client->get('resolve', array('url' => $u['link']), array(CURLOPT_FOLLOWLOCATION => true)));
$result[$key]['followers_count']= $response->followers_count;
}catch(Services_Soundcloud_Invalid_Http_Response_Code_Exception $e){
echo $e->getMessage();
}
}
foreach ($result as $key => $row) {
// replace 0 with the field's index/key
$dates[$key] = $row['followers_count'];
}
array_multisort($dates, SORT_DESC, $result);
//echo"<pre>";print_r($result);echo"</pre>";
$data
包含您需要的信息。
相关文章:
- Soundcloud API-按特定顺序检索用户追随者
- 在Chrome扩展中,我如何准确地检索用户'的地区/地区/国家
- 正在云代码中检索用户密码
- 使用MeteorJS堆栈,如何检索用户's的电子邮件,其中包含他们发布的帖子中的userId
- 正在从facebook检索用户登录名-无需登录
- Ajax - 在“成功”之后转到另一个页面,从那里的URL中检索用户ID
- 是否可以检索用户在我的页面上以编程方式使用的搜索词
- 如何检索用户单击的图像的图像源?(jQuery)
- 使用Selinium,Scrapy,Python检索用户个人资料的公共Facebook墙帖子
- 无法检索用户输入
- Phonegap插件:检索用户配置文件,电子邮件和Gmail
- FB PHP SDK 的 getAccessToken() 是检索用户身份验证令牌的可靠方法吗?
- 如何在 JavaScript 中使用关联数组来检索用户
- 在流星中检索用户输入的最快方法
- Ajax 请求失败 - 从服务器检索用户标识
- 检索用户's从网站上选择的图片
- 如何检索用户的Facebook生活事件
- NodeJs-从JWT令牌中检索用户信息
- 如何检索用户的详细信息喜欢按钮回调函数在facebook
- Twitter数字——用AngularJS检索用户账户数据