mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-31 13:50:23 +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:
@@ -7,7 +7,7 @@ class TwitterBridge extends BridgeAbstract{
|
||||
$this->name = "Twitter Bridge";
|
||||
$this->uri = "https://twitter.com/";
|
||||
$this->description = "Returns tweets by keyword/hashtag or user name";
|
||||
$this->update = "2016-08-15";
|
||||
$this->update = '2016-08-17';
|
||||
|
||||
$this->parameters["global"] =
|
||||
'[
|
||||
@@ -50,13 +50,13 @@ class TwitterBridge extends BridgeAbstract{
|
||||
public function collectData(array $param){
|
||||
$html = '';
|
||||
if (isset($param['q'])) { /* keyword search mode */
|
||||
$html = $this->file_get_html('https://twitter.com/search?q='.urlencode($param['q']).'&f=tweets') or $this->returnError('No results for this query.', 404);
|
||||
$html = $this->file_get_html('https://twitter.com/search?q='.urlencode($param['q']).'&f=tweets') or $this->returnServerError('No results for this query.');
|
||||
}
|
||||
elseif (isset($param['u'])) { /* user timeline mode */
|
||||
$html = $this->file_get_html('https://twitter.com/'.urlencode($param['u']).'/with_replies') or $this->returnError('Requested username can\'t be found.', 404);
|
||||
$html = $this->file_get_html('https://twitter.com/'.urlencode($param['u']).'/with_replies') or $this->returnServerError('Requested username can\'t be found.');
|
||||
}
|
||||
else {
|
||||
$this->returnError('You must specify a keyword (?q=...) or a Twitter username (?u=...).', 400);
|
||||
$this->returnClientError('You must specify a keyword (?q=...) or a Twitter username (?u=...).');
|
||||
}
|
||||
|
||||
$hidePictures = false;
|
||||
|
Reference in New Issue
Block a user