forked from blallo/rss-bridge
Fix some HTTP error codes (404->500)
This commit is contained in:
parent
5c987b74d5
commit
0051615b82
5 changed files with 9 additions and 9 deletions
|
@ -38,7 +38,7 @@ class AnimeUltimeBridge extends BridgeAbstract {
|
||||||
//Retrive page contents
|
//Retrive page contents
|
||||||
$website = 'http://www.anime-ultime.net/';
|
$website = 'http://www.anime-ultime.net/';
|
||||||
$url = $website.'history-0-1/'.$requestFilter;
|
$url = $website.'history-0-1/'.$requestFilter;
|
||||||
$html = file_get_html($url) or $this->returnError('Could not request Anime-Ultime: '.$url, 404);
|
$html = file_get_html($url) or $this->returnError('Could not request Anime-Ultime: '.$url, 500);
|
||||||
|
|
||||||
//Relases are sorted by day : process each day individually
|
//Relases are sorted by day : process each day individually
|
||||||
foreach ($html->find('div.history', 0)->find('h3') as $daySection) {
|
foreach ($html->find('div.history', 0)->find('h3') as $daySection) {
|
||||||
|
@ -65,7 +65,7 @@ class AnimeUltimeBridge extends BridgeAbstract {
|
||||||
if (!empty($item_uri)) {
|
if (!empty($item_uri)) {
|
||||||
|
|
||||||
//Retrieve description from description page and convert relative image src info absolute image src
|
//Retrieve description from description page and convert relative image src info absolute image src
|
||||||
$html_item = file_get_contents($item_uri) or $this->returnError('Could not request Anime-Ultime: '.$item_uri, 404);
|
$html_item = file_get_contents($item_uri) or $this->returnError('Could not request Anime-Ultime: '.$item_uri, 500);
|
||||||
$item_description = substr($html_item, strpos($html_item, 'class="principal_contain" align="center">') + 41);
|
$item_description = substr($html_item, strpos($html_item, 'class="principal_contain" align="center">') + 41);
|
||||||
$item_description = substr($item_description, 0, strpos($item_description, '<div id="table">'));
|
$item_description = substr($item_description, 0, strpos($item_description, '<div id="table">'));
|
||||||
$item_description = str_replace('src="images', 'src="'.$website.'images', $item_description);
|
$item_description = str_replace('src="images', 'src="'.$website.'images', $item_description);
|
||||||
|
|
|
@ -45,7 +45,7 @@ class CNETBridge extends BridgeAbstract {
|
||||||
$this->topicName = $param['topic'];
|
$this->topicName = $param['topic'];
|
||||||
|
|
||||||
$pageUrl = 'http://www.cnet.com/'.(empty($this->topicName) ? '' : 'topics/'.$this->topicName.'/');
|
$pageUrl = 'http://www.cnet.com/'.(empty($this->topicName) ? '' : 'topics/'.$this->topicName.'/');
|
||||||
$html = file_get_html($pageUrl) or $this->returnError('Could not request CNET: '.$pageUrl, 404);
|
$html = file_get_html($pageUrl) or $this->returnError('Could not request CNET: '.$pageUrl, 500);
|
||||||
$limit = 0;
|
$limit = 0;
|
||||||
|
|
||||||
foreach($html->find('div.socialSharingSmall') as $element) {
|
foreach($html->find('div.socialSharingSmall') as $element) {
|
||||||
|
@ -57,7 +57,7 @@ class CNETBridge extends BridgeAbstract {
|
||||||
|
|
||||||
if (!empty($article_title) && !empty($article_uri) && strpos($article_uri, '/news/') !== false) {
|
if (!empty($article_title) && !empty($article_uri) && strpos($article_uri, '/news/') !== false) {
|
||||||
|
|
||||||
$article_html = file_get_html($article_uri) or $this->returnError('Could not request CNET: '.$article_uri, 404);
|
$article_html = file_get_html($article_uri) or $this->returnError('Could not request CNET: '.$article_uri, 500);
|
||||||
$article_timestamp = strtotime(ExtractFromDelimiters($article_html->innertext, '<time itemprop="datePublished" class="', '">'));
|
$article_timestamp = strtotime(ExtractFromDelimiters($article_html->innertext, '<time itemprop="datePublished" class="', '">'));
|
||||||
$article_thumbnail = $article_html->find('div.originalImage', 0);
|
$article_thumbnail = $article_html->find('div.originalImage', 0);
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ class LeMondeInformatiqueBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
$feedUrl = 'http://www.lemondeinformatique.fr/rss/rss.xml';
|
$feedUrl = 'http://www.lemondeinformatique.fr/rss/rss.xml';
|
||||||
$html = file_get_html($feedUrl) or $this->returnError('Could not request LeMondeInformatique: '.$feedUrl, 404);
|
$html = file_get_html($feedUrl) or $this->returnError('Could not request LeMondeInformatique: '.$feedUrl, 500);
|
||||||
$limit = 0;
|
$limit = 0;
|
||||||
|
|
||||||
foreach($html->find('item') as $element) {
|
foreach($html->find('item') as $element) {
|
||||||
|
@ -45,7 +45,7 @@ class LeMondeInformatiqueBridge extends BridgeAbstract {
|
||||||
$article_uri = $element->innertext;
|
$article_uri = $element->innertext;
|
||||||
$article_uri = substr($article_uri, strpos($article_uri, '<link>') + 6);
|
$article_uri = substr($article_uri, strpos($article_uri, '<link>') + 6);
|
||||||
$article_uri = substr($article_uri, 0, strpos($article_uri, '</link>'));
|
$article_uri = substr($article_uri, 0, strpos($article_uri, '</link>'));
|
||||||
$article_html = file_get_html($article_uri) or $this->returnError('Could not request LeMondeInformatique: '.$article_uri, 404);
|
$article_html = file_get_html($article_uri) or $this->returnError('Could not request LeMondeInformatique: '.$article_uri, 500);
|
||||||
$thumbnailUri = $article_html->find('div#article', 0)->find('img#illustration', 0)->src;
|
$thumbnailUri = $article_html->find('div#article', 0)->find('img#illustration', 0)->src;
|
||||||
$article_content = CleanArticle($article_html->find('div#article', 0)->innertext);
|
$article_content = CleanArticle($article_html->find('div#article', 0)->innertext);
|
||||||
$article_title = $article_html->find('h1.cleanprint-title', 0)->plaintext;
|
$article_title = $article_html->find('h1.cleanprint-title', 0)->plaintext;
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Releases3DSBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
$dataUrl = 'http://3dsdb.com/xml.php';
|
$dataUrl = 'http://3dsdb.com/xml.php';
|
||||||
$xml = file_get_contents($dataUrl) or $this->returnError('Could not request 3dsdb: '.$dataUrl, 404);
|
$xml = file_get_contents($dataUrl) or $this->returnError('Could not request 3dsdb: '.$dataUrl, 500);
|
||||||
$limit = 0;
|
$limit = 0;
|
||||||
|
|
||||||
foreach (array_reverse(explode('<release>', $xml)) as $element) {
|
foreach (array_reverse(explode('<release>', $xml)) as $element) {
|
||||||
|
|
|
@ -21,7 +21,7 @@ class SiliconBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
$feedUrl = 'http://www.silicon.fr/feed';
|
$feedUrl = 'http://www.silicon.fr/feed';
|
||||||
$html = file_get_html($feedUrl) or $this->returnError('Could not request Silicon: '.$feedUrl, 404);
|
$html = file_get_html($feedUrl) or $this->returnError('Could not request Silicon: '.$feedUrl, 500);
|
||||||
$limit = 0;
|
$limit = 0;
|
||||||
|
|
||||||
foreach($html->find('item') as $element) {
|
foreach($html->find('item') as $element) {
|
||||||
|
@ -31,7 +31,7 @@ class SiliconBridge extends BridgeAbstract {
|
||||||
$article_uri = $element->innertext;
|
$article_uri = $element->innertext;
|
||||||
$article_uri = substr($article_uri, strpos($article_uri, '<link>') + 6);
|
$article_uri = substr($article_uri, strpos($article_uri, '<link>') + 6);
|
||||||
$article_uri = substr($article_uri, 0, strpos($article_uri, '</link>'));
|
$article_uri = substr($article_uri, 0, strpos($article_uri, '</link>'));
|
||||||
$article_html = file_get_html($article_uri) or $this->returnError('Could not request Silicon: '.$article_uri, 404);
|
$article_html = file_get_html($article_uri) or $this->returnError('Could not request Silicon: '.$article_uri, 500);
|
||||||
|
|
||||||
//Build article contents from corresponding elements
|
//Build article contents from corresponding elements
|
||||||
$thumbnailUri = $element->find('enclosure', 0)->url;
|
$thumbnailUri = $element->find('enclosure', 0)->url;
|
||||||
|
|
Loading…
Reference in a new issue