1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-20 07:11:43 +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:
logmanoriginal
2016-08-17 14:45:08 +02:00
parent 73a1bcf3d6
commit 74f0572d91
124 changed files with 401 additions and 400 deletions

View File

@@ -7,7 +7,7 @@ class LeMondeInformatiqueBridge extends BridgeAbstract {
$this->name = "Le Monde Informatique";
$this->uri = "http://www.lemondeinformatique.fr/";
$this->description = "Returns the newest articles.";
$this->update = "2016-08-09";
$this->update = '2016-08-17';
}
@@ -34,7 +34,7 @@ class LeMondeInformatiqueBridge extends BridgeAbstract {
}
$feedUrl = 'http://www.lemondeinformatique.fr/rss/rss.xml';
$html = $this->file_get_html($feedUrl) or $this->returnError('Could not request LeMondeInformatique: '.$feedUrl, 500);
$html = $this->file_get_html($feedUrl) or $this->returnServerError('Could not request LeMondeInformatique: '.$feedUrl);
$limit = 0;
foreach($html->find('item') as $element) {
@@ -44,7 +44,7 @@ class LeMondeInformatiqueBridge extends BridgeAbstract {
$article_uri = $element->innertext;
$article_uri = substr($article_uri, strpos($article_uri, '<link>') + 6);
$article_uri = substr($article_uri, 0, strpos($article_uri, '</link>'));
$article_html = $this->file_get_html($article_uri) or $this->returnError('Could not request LeMondeInformatique: '.$article_uri, 500);
$article_html = $this->file_get_html($article_uri) or $this->returnServerError('Could not request LeMondeInformatique: '.$article_uri);
$article_content = CleanArticle($article_html->find('div#article', 0)->innertext);
$article_title = $article_html->find('h1.cleanprint-title', 0)->plaintext;