From 8edddcd97f716db563e71d08069b41183488175b Mon Sep 17 00:00:00 2001 From: Damien Calesse Date: Wed, 9 Sep 2015 00:13:56 +0200 Subject: [PATCH 1/3] Fix Soundcloud bridge (change client key, URI now use HTTPS and change URI according with soundcloud API) --- bridges/SoundcloudBridge.php | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/bridges/SoundcloudBridge.php b/bridges/SoundcloudBridge.php index 05c47bff..e491167c 100644 --- a/bridges/SoundcloudBridge.php +++ b/bridges/SoundcloudBridge.php @@ -5,26 +5,27 @@ * * @name Soundcloud Bridge * @homepage http://www.soundcloud.com/ -* @description Returns 10 newest music from user profile +* @description Returns 10 newest music from user profile * @maintainer kranack -* @update 2014-07-24 +* @update 2015-09-08 * @use1(u="username") * */ class SoundCloudBridge extends BridgeAbstract{ - + private $request; private $name; - + const CLIENT_ID = '0aca19eae3843844e4053c6d8fdb7875'; + public function collectData(array $param){ - + if (isset($param['u']) && !empty($param['u'])) { $this->request = $param['u']; - - $res = json_decode(file_get_contents('http://api.soundcloud.com/resolve.json?url=http://www.soundcloud.com/'. urlencode($this->request) .'&consumer_key=apigee')) or $this->returnError('No results for this query', 404); - $tracks = json_decode(file_get_contents('http://api.soundcloud.com/users/'. urlencode($res->id) .'/tracks.json?consumer_key=apigee')) or $this->returnError('No results for this user', 404); - } + + $res = json_decode(file_get_contents('https://api.soundcloud.com/resolve?url=http://www.soundcloud.com/'. urlencode($this->request) .'&client_id=' . self::CLIENT_ID)) or $this->returnError('No results for this query', 404); + $tracks = json_decode(file_get_contents('https://api.soundcloud.com/users/'. urlencode($res->id) .'/tracks?client_id=' . self::CLIENT_ID)) or $this->returnError('No results for this user', 404); + } else { $this->returnError('You must specify username', 400); @@ -34,22 +35,23 @@ class SoundCloudBridge extends BridgeAbstract{ $item = new \Item(); $item->name = $tracks[$i]->user->username .' - '. $tracks[$i]->title; $item->title = $tracks[$i]->user->username .' - '. $tracks[$i]->title; - $item->content = '