mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-04 18:14:44 +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
|
@ -7,7 +7,7 @@ class TheHackerNewsBridge extends BridgeAbstract {
|
|||
$this->name = 'The Hacker News Bridge';
|
||||
$this->uri = 'https://thehackernews.com/';
|
||||
$this->description = 'Cyber Security, Hacking, Technology News.';
|
||||
$this->update = '2016-08-09';
|
||||
$this->update = '2016-08-17';
|
||||
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ class TheHackerNewsBridge extends BridgeAbstract {
|
|||
return $string;
|
||||
}
|
||||
|
||||
$html = $this->file_get_html($this->getURI()) or $this->returnError('Could not request TheHackerNews: '.$this->getURI(), 500);
|
||||
$html = $this->file_get_html($this->getURI()) or $this->returnServerError('Could not request TheHackerNews: '.$this->getURI());
|
||||
$limit = 0;
|
||||
|
||||
foreach ($html->find('article') as $element) {
|
||||
|
@ -55,7 +55,7 @@ class TheHackerNewsBridge extends BridgeAbstract {
|
|||
$article_author = trim($element->find('span.vcard', 0)->plaintext);
|
||||
$article_title = $element->find('a.entry-title', 0)->plaintext;
|
||||
$article_timestamp = strtotime($element->find('span.updated', 0)->plaintext);
|
||||
$article = $this->file_get_html($article_url) or $this->returnError('Could not request TheHackerNews: '.$article_url, 500);
|
||||
$article = $this->file_get_html($article_url) or $this->returnServerError('Could not request TheHackerNews: '.$article_url);
|
||||
|
||||
$contents = $article->find('div.articlebodyonly', 0)->innertext;
|
||||
$contents = StripRecursiveHTMLSection($contents, 'div', '<div class=\'clear\'');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue