diff --git a/bridges/SoundcloudBridge.php b/bridges/SoundcloudBridge.php index 407d6e4..b064be1 100644 --- a/bridges/SoundcloudBridge.php +++ b/bridges/SoundcloudBridge.php @@ -1,9 +1,6 @@ maintainer = "kranack"; @@ -25,31 +22,35 @@ class SoundCloudBridge extends BridgeAbstract{ public function collectData(){ $param=$this->parameters[$this->queriedContext]; - if (isset($param['u']['value']) && !empty($param['u']['value'])) - { - $this->request = $param['u']['value']; - - $res = json_decode($this->getContents('https://api.soundcloud.com/resolve?url=http://www.soundcloud.com/'. urlencode($this->request) .'&client_id=' . self::CLIENT_ID)) or $this->returnServerError('No results for this query'); - $tracks = json_decode($this->getContents('https://api.soundcloud.com/users/'. urlencode($res->id) .'/tracks?client_id=' . self::CLIENT_ID)) or $this->returnServerError('No results for this user'); - } - else - { - $this->returnClientError('You must specify username'); - } + $res = json_decode($this->getContents( + 'https://api.soundcloud.com/resolve?url=http://www.soundcloud.com/' + . urlencode($param['u']['value']) + .'&client_id=' . self::CLIENT_ID + )) or $this->returnServerError('No results for this query'); + $tracks = json_decode($this->getContents( + 'https://api.soundcloud.com/users/' + . urlencode($res->id) + .'/tracks?client_id=' . self::CLIENT_ID + )) or $this->returnServerError('No results for this user'); for ($i=0; $i < 10; $i++) { $item = array(); $item['author'] = $tracks[$i]->user->username .' - '. $tracks[$i]->title; $item['title'] = $tracks[$i]->user->username .' - '. $tracks[$i]->title; $item['content'] = '