mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-04 01:55:21 +02:00
bridges: Replace returnError function with more specific
Replacements depend on original error code: 400: returnClientError 404: returnServerError 500: returnServerError 501: returnServerError
This commit is contained in:
parent
73a1bcf3d6
commit
74f0572d91
124 changed files with 401 additions and 400 deletions
|
@ -10,7 +10,7 @@ class SoundCloudBridge extends BridgeAbstract{
|
|||
$this->name = "Soundcloud Bridge";
|
||||
$this->uri = "http://www.soundcloud.com/";
|
||||
$this->description = "Returns 10 newest music from user profile";
|
||||
$this->update = "2016-08-09";
|
||||
$this->update = '2016-08-17';
|
||||
|
||||
$this->parameters[] =
|
||||
'[
|
||||
|
@ -30,12 +30,12 @@ class SoundCloudBridge extends BridgeAbstract{
|
|||
{
|
||||
$this->request = $param['u'];
|
||||
|
||||
$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);
|
||||
$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->returnServerError('No results for this query');
|
||||
$tracks = json_decode(file_get_contents('https://api.soundcloud.com/users/'. urlencode($res->id) .'/tracks?client_id=' . self::CLIENT_ID)) or $this->returnServerError('No results for this user');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->returnError('You must specify username', 400);
|
||||
$this->returnClientError('You must specify username');
|
||||
}
|
||||
|
||||
for ($i=0; $i < 10; $i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue