diff --git a/bridges/ABCTabsBridge.php b/bridges/ABCTabsBridge.php index 8e2becc..0c9bc68 100644 --- a/bridges/ABCTabsBridge.php +++ b/bridges/ABCTabsBridge.php @@ -9,13 +9,13 @@ class ABCTabsBridge extends BridgeAbstract{ $this->name = "ABC Tabs Bridge"; $this->uri = "http://www.abc-tabs.com/"; $this->description = "Returns 22 newest tabs"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } public function collectData(array $param){ $html = ''; - $html = $this->file_get_html('http://www.abc-tabs.com/tablatures/nouveautes.html') or $this->returnError('No results for this query.', 404); + $html = $this->file_get_html('http://www.abc-tabs.com/tablatures/nouveautes.html') or $this->returnClientError('No results for this query.'); $table = $html->find('table#myTable', 0)->children(1); foreach ($table->find('tr') as $tab) diff --git a/bridges/AllocineFRBridge.php b/bridges/AllocineFRBridge.php index 456972b..ef01746 100644 --- a/bridges/AllocineFRBridge.php +++ b/bridges/AllocineFRBridge.php @@ -7,7 +7,7 @@ class AllocineFRBridge extends BridgeAbstract{ $this->name = "Allo Cine Bridge"; $this->uri = "http://www.allocine.fr"; $this->description = "Bridge for allocine.fr"; - $this->update = "2016-08-15"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -41,7 +41,7 @@ class AllocineFRBridge extends BridgeAbstract{ // Check all parameters if(!isset($params['category'])) - $this->returnError('You must specify a valid category (&category= )!', 400); + $this->returnClientError('You must specify a valid category (&category= )!'); $category = ''; switch($params['category']){ @@ -58,13 +58,13 @@ class AllocineFRBridge extends BridgeAbstract{ $category = 'Tueurs en Séries'; break; default: - $this->returnError('You must select a valid category!', 400); + $this->returnClientError('You must select a valid category!'); } // Update bridge name to match selection $this->name .= ' : ' . $category; - $html = $this->file_get_html($this->uri) or $this->returnError("Could not request {$this->uri}!", 404); + $html = $this->file_get_html($this->uri) or $this->returnServerError("Could not request {$this->uri}!"); foreach($html->find('figure.media-meta-fig') as $element) { diff --git a/bridges/AnimeUltimeBridge.php b/bridges/AnimeUltimeBridge.php index 274b64c..0f305e3 100644 --- a/bridges/AnimeUltimeBridge.php +++ b/bridges/AnimeUltimeBridge.php @@ -9,7 +9,7 @@ class AnimeUltimeBridge extends BridgeAbstract { $this->name = 'Anime-Ultime'; $this->uri = 'http://www.anime-ultime.net/'; $this->description = 'Returns the 10 newest releases posted on Anime-Ultime'; - $this->update = '2016-08-09'; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -53,7 +53,7 @@ class AnimeUltimeBridge extends BridgeAbstract { if ($typeFilter == 'A') { $this->filter = 'Anime'; } if ($typeFilter == 'D') { $this->filter = 'Drama'; } if ($typeFilter == 'T') { $this->filter = 'Tokusatsu'; } - } else $this->returnError('The provided type filter is invalid. Expecting A, D, T, or no filter', 400); + } else $this->returnClientError('The provided type filter is invalid. Expecting A, D, T, or no filter'); } //Build date and filters for making requests @@ -67,7 +67,7 @@ class AnimeUltimeBridge extends BridgeAbstract { //Retrive page contents $website = 'http://www.anime-ultime.net/'; $url = $website.'history-0-1/'.$requestFilter; - $html = $this->file_get_html($url) or $this->returnError('Could not request Anime-Ultime: '.$url, 500); + $html = $this->file_get_html($url) or $this->returnServerError('Could not request Anime-Ultime: '.$url); //Relases are sorted by day : process each day individually foreach ($html->find('div.history', 0)->find('h3') as $daySection) { @@ -93,7 +93,7 @@ class AnimeUltimeBridge extends BridgeAbstract { if (!empty($item_uri)) { //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, 500); + $html_item = file_get_contents($item_uri) or $this->returnServerError('Could not request Anime-Ultime: '.$item_uri); $item_description = substr($html_item, strpos($html_item, 'class="principal_contain" align="center">') + 41); $item_description = substr($item_description, 0, strpos($item_description, '
')); $item_description = str_replace('src="images', 'src="'.$website.'images', $item_description); diff --git a/bridges/ArstechnicaBridge.php b/bridges/ArstechnicaBridge.php index a4a08ce..59f0fab 100644 --- a/bridges/ArstechnicaBridge.php +++ b/bridges/ArstechnicaBridge.php @@ -9,7 +9,7 @@ class ArstechnicaBridge extends BridgeAbstract { $this->name = "ArstechnicaBridge"; $this->uri = "http://arstechnica.com"; $this->description = "The PC enthusiast's resource. Power users and the tools they love, without computing religion"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } @@ -43,7 +43,7 @@ class ArstechnicaBridge extends BridgeAbstract { return $text; } - $html = $this->file_get_html('http://feeds.arstechnica.com/arstechnica/index') or $this->returnError('Could not request NextInpact.', 404); + $html = $this->file_get_html('http://feeds.arstechnica.com/arstechnica/index') or $this->returnServerError('Could not request NextInpact.'); $limit = 0; foreach($html->find('item') as $element) { diff --git a/bridges/AskfmBridge.php b/bridges/AskfmBridge.php index e7587a0..f130860 100644 --- a/bridges/AskfmBridge.php +++ b/bridges/AskfmBridge.php @@ -7,6 +7,7 @@ class AskfmBridge extends BridgeAbstract{ $this->name = "Ask.fm Answers"; $this->uri = "http://ask.fm/"; $this->description = "Returns answers from an Ask.fm user"; + $this->update = '2016-08-17'; $this->parameters["Ask.fm username"] = '[ @@ -21,10 +22,10 @@ class AskfmBridge extends BridgeAbstract{ $html = ''; if (isset($param['u'])) { $this->request = $param['u']; - $html = $this->file_get_html('http://ask.fm/'.urlencode($this->request).'/answers/more?page=0') or $this->returnError('Requested username can\'t be found.', 404); + $html = $this->file_get_html('http://ask.fm/'.urlencode($this->request).'/answers/more?page=0') or $this->returnServerError('Requested username can\'t be found.'); } else { - $this->returnError('You must specify a username (?u=...).', 400); + $this->returnClientError('You must specify a username (?u=...).'); } foreach($html->find('div.streamItem-answer') as $element) { diff --git a/bridges/BandcampBridge.php b/bridges/BandcampBridge.php index e396e7e..1e6c2dc 100644 --- a/bridges/BandcampBridge.php +++ b/bridges/BandcampBridge.php @@ -9,7 +9,7 @@ class BandcampBridge extends BridgeAbstract{ $this->name = "Bandcamp Tag"; $this->uri = "http://bandcamp.com/"; $this->description = "New bandcamp release by tag"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -26,10 +26,10 @@ class BandcampBridge extends BridgeAbstract{ $html = ''; if (isset($param['tag'])) { $this->request = $param['tag']; - $html = $this->file_get_html('http://bandcamp.com/tag/'.urlencode($this->request).'?sort_field=date') or $this->returnError('No results for this query.', 404); + $html = $this->file_get_html('http://bandcamp.com/tag/'.urlencode($this->request).'?sort_field=date') or $this->returnServerError('No results for this query.'); } else { - $this->returnError('You must specify tag (/tag/...)', 400); + $this->returnClientError('You must specify tag (/tag/...)'); } foreach($html->find('li.item') as $release) { diff --git a/bridges/BastaBridge.php b/bridges/BastaBridge.php index 5c23ed3..35c9ae4 100644 --- a/bridges/BastaBridge.php +++ b/bridges/BastaBridge.php @@ -5,7 +5,7 @@ class BastaBridge extends BridgeAbstract{ $this->name = "Bastamag Bridge"; $this->uri = "http://www.bastamag.net/"; $this->description = "Returns the newest articles."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } public function collectData(array $param){ @@ -14,7 +14,7 @@ class BastaBridge extends BridgeAbstract{ return preg_replace('/src=["\']{1}([^"\']+)/ims', 'src=\'http://www.bastamag.net/$1\'', $content); } - $html = $this->file_get_html('http://www.bastamag.net/spip.php?page=backend') or $this->returnError('Could not request Bastamag.', 404); + $html = $this->file_get_html('http://www.bastamag.net/spip.php?page=backend') or $this->returnServerError('Could not request Bastamag.'); $limit = 0; foreach($html->find('item') as $element) { diff --git a/bridges/BlaguesDeMerdeBridge.php b/bridges/BlaguesDeMerdeBridge.php index b6c6405..7fb5d45 100644 --- a/bridges/BlaguesDeMerdeBridge.php +++ b/bridges/BlaguesDeMerdeBridge.php @@ -7,12 +7,12 @@ class BlaguesDeMerdeBridge extends BridgeAbstract{ $this->name = "Blagues De Merde"; $this->uri = "http://www.blaguesdemerde.fr/"; $this->description = "Blagues De Merde"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } public function collectData(array $param){ - $html = $this->file_get_html('http://www.blaguesdemerde.fr/') or $this->returnError('Could not request BDM.', 404); + $html = $this->file_get_html('http://www.blaguesdemerde.fr/') or $this->returnServerError('Could not request BDM.'); foreach($html->find('article.joke_contener') as $element) { $item = new Item(); diff --git a/bridges/BooruprojectBridge.php b/bridges/BooruprojectBridge.php index 640a3ce..17c1982 100644 --- a/bridges/BooruprojectBridge.php +++ b/bridges/BooruprojectBridge.php @@ -7,7 +7,7 @@ class BooruprojectBridge extends BridgeAbstract{ $this->name = "Booruproject"; $this->uri = "http://booru.org/"; $this->description = "Returns images from given page and booruproject instance (****.booru.org)"; - $this->update = "2016-08-15"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -41,9 +41,9 @@ class BooruprojectBridge extends BridgeAbstract{ $tags = '&tags='.urlencode($param['t']); } if (empty($param['i'])) { - $this->returnError('Please enter a ***.booru.org instance.', 404); + $this->returnServerError('Please enter a ***.booru.org instance.'); } - $html = $this->file_get_html("http://".$param['i'].".booru.org/index.php?page=post&s=list&pid=".$page.$tags) or $this->returnError('Could not request Booruproject.', 404); + $html = $this->file_get_html("http://".$param['i'].".booru.org/index.php?page=post&s=list&pid=".$page.$tags) or $this->returnServerError('Could not request Booruproject.'); foreach($html->find('div[class=content] span') as $element) { diff --git a/bridges/CADBridge.php b/bridges/CADBridge.php index 0b57ee5..17aa807 100644 --- a/bridges/CADBridge.php +++ b/bridges/CADBridge.php @@ -5,7 +5,7 @@ class CADBridge extends BridgeAbstract{ $this->name = "CAD Bridge"; $this->uri = "http://www.cad-comic.com/"; $this->description = "Returns the newest articles."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } private function CADExtractContent($url) { @@ -45,7 +45,7 @@ class CADBridge extends BridgeAbstract{ return $string; } - $html = $this->file_get_html('http://cdn2.cad-comic.com/rss.xml') or $this->returnError('Could not request CAD.', 404); + $html = $this->file_get_html('http://cdn2.cad-comic.com/rss.xml') or $this->returnServerError('Could not request CAD.'); $limit = 0; foreach($html->find('item') as $element) { diff --git a/bridges/CNETBridge.php b/bridges/CNETBridge.php index e73027c..6fb4d93 100644 --- a/bridges/CNETBridge.php +++ b/bridges/CNETBridge.php @@ -9,7 +9,7 @@ class CNETBridge extends BridgeAbstract { $this->name = 'CNET News'; $this->uri = 'http://www.cnet.com/'; $this->description = 'Returns the newest articles.
You may specify a topic found in some section URLs, else all topics are selected.'; - $this->update = '2016-08-09'; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -51,7 +51,7 @@ class CNETBridge extends BridgeAbstract { $this->topicName = $param['topic']; $pageUrl = 'http://www.cnet.com/'.(empty($this->topicName) ? '' : 'topics/'.$this->topicName.'/'); - $html = $this->file_get_html($pageUrl) or $this->returnError('Could not request CNET: '.$pageUrl, 500); + $html = $this->file_get_html($pageUrl) or $this->returnServerError('Could not request CNET: '.$pageUrl); $limit = 0; foreach($html->find('div.assetBody') as $element) { @@ -64,7 +64,7 @@ class CNETBridge extends BridgeAbstract { if (!empty($article_title) && !empty($article_uri) && strpos($article_uri, '/news/') !== false) { - $article_html = $this->file_get_html($article_uri) or $this->returnError('Could not request CNET: '.$article_uri, 500); + $article_html = $this->file_get_html($article_uri) or $this->returnServerError('Could not request CNET: '.$article_uri); $article_content = trim(CleanArticle(ExtractFromDelimiters($article_html, '
uri = 'http://www.castorus.com'; $this->description = "Returns the latest changes"; - $this->update = "2016-08-15"; + $this->update = '2016-08-17'; $this->parameters["Get latest changes"] = '[]'; $this->parameters["Get latest changes via ZIP code"] = @@ -37,7 +37,7 @@ class CastorusBridge extends BridgeAbstract { $title = $activity->find('a', 0); if(!$title) - $this->returnError('Cannot find title!', 404); + $this->returnServerError('Cannot find title!'); return htmlspecialchars(trim($title->plaintext)); } @@ -47,7 +47,7 @@ class CastorusBridge extends BridgeAbstract { $url = $activity->find('a', 0); if(!$url) - $this->returnError('Cannot find url!', 404); + $this->returnServerError('Cannot find url!'); return $this->uri . $url->href; } @@ -59,7 +59,7 @@ class CastorusBridge extends BridgeAbstract { $nodes = $activity->find('*'); if(!$nodes) - $this->returnError('Cannot find nodes!', 404); + $this->returnServerError('Cannot find nodes!'); foreach($nodes as $node){ $node->outertext = ''; @@ -73,7 +73,7 @@ class CastorusBridge extends BridgeAbstract { $price = $activity->find('span', 1); if(!$price) - $this->returnError('Cannot find price!', 404); + $this->returnServerError('Cannot find price!'); return $price->innertext; } @@ -88,12 +88,12 @@ class CastorusBridge extends BridgeAbstract { $html = $this->file_get_html($this->uri); if(!$html) - $this->returnError('Could not load data from ' . $this->uri . '!', 404); + $this->returnServerError('Could not load data from ' . $this->uri . '!'); $activities = $html->find('div#activite/li'); if(!$activities) - $this->returnError('Failed to find activities!', 404); + $this->returnServerError('Failed to find activities!'); foreach($activities as $activity){ $item = new \Item(); diff --git a/bridges/CollegeDeFranceBridge.php b/bridges/CollegeDeFranceBridge.php index 5dbd195..e809d6b 100644 --- a/bridges/CollegeDeFranceBridge.php +++ b/bridges/CollegeDeFranceBridge.php @@ -6,7 +6,7 @@ class CollegeDeFranceBridge extends BridgeAbstract{ $this->name = "CollegeDeFrance"; $this->uri = "http://www.college-de-france.fr/"; $this->description = "Returns the latest audio and video from CollegeDeFrance"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } public function collectData(array $param) { @@ -33,7 +33,7 @@ class CollegeDeFranceBridge extends BridgeAbstract{ * * */ - $html = $this->file_get_html('http://www.college-de-france.fr/components/search-audiovideo.jsp?fulltext=&siteid=1156951719600&lang=FR&type=all') or $this->returnError('Could not request CollegeDeFrance.', 404); + $html = $this->file_get_html('http://www.college-de-france.fr/components/search-audiovideo.jsp?fulltext=&siteid=1156951719600&lang=FR&type=all') or $this->returnServerError('Could not request CollegeDeFrance.'); foreach($html->find('a[data-target]') as $element) { $item = new \Item(); $item->title = $element->find('.title', 0)->plaintext; diff --git a/bridges/CommonDreamsBridge.php b/bridges/CommonDreamsBridge.php index 08a055c..1177866 100644 --- a/bridges/CommonDreamsBridge.php +++ b/bridges/CommonDreamsBridge.php @@ -6,7 +6,7 @@ class CommonDreamsBridge extends BridgeAbstract{ $this->name = "CommonDreams Bridge"; $this->uri = "http://www.commondreams.org/"; $this->description = "Returns the newest articles."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } private function CommonDreamsExtractContent($url) { @@ -25,7 +25,7 @@ class CommonDreamsBridge extends BridgeAbstract{ return $string; } - $html = $this->file_get_html('http://www.commondreams.org/rss.xml') or $this->returnError('Could not request CommonDreams.', 404); + $html = $this->file_get_html('http://www.commondreams.org/rss.xml') or $this->returnServerError('Could not request CommonDreams.'); $limit = 0; foreach($html->find('item') as $element) { if($limit < 4) { diff --git a/bridges/CopieDoubleBridge.php b/bridges/CopieDoubleBridge.php index 62935f6..cd3b4f6 100644 --- a/bridges/CopieDoubleBridge.php +++ b/bridges/CopieDoubleBridge.php @@ -7,13 +7,13 @@ class CopieDoubleBridge extends BridgeAbstract{ $this->name = "CopieDouble"; $this->uri = "http://www.copie-double.com/"; $this->description = "CopieDouble"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } public function collectData(array $param){ - $html = $this->file_get_html('http://www.copie-double.com/') or $this->returnError('Could not request CopieDouble.', 404); + $html = $this->file_get_html('http://www.copie-double.com/') or $this->returnServerError('Could not request CopieDouble.'); $table = $html->find('table table', 2); foreach($table->find('tr') as $element) diff --git a/bridges/CourrierInternationalBridge.php b/bridges/CourrierInternationalBridge.php index 1e8f8cd..ab1a2c3 100644 --- a/bridges/CourrierInternationalBridge.php +++ b/bridges/CourrierInternationalBridge.php @@ -7,7 +7,7 @@ class CourrierInternationalBridge extends BridgeAbstract{ $this->name = "Courrier International Bridge"; $this->uri = "http://CourrierInternational.fr/"; $this->description = "Courrier International bridge"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } @@ -15,7 +15,7 @@ class CourrierInternationalBridge extends BridgeAbstract{ $html = ''; - $html = $this->file_get_html('http://www.courrierinternational.com/') or $this->returnError('Error.', 500); + $html = $this->file_get_html('http://www.courrierinternational.com/') or $this->returnServerError('Error.'); diff --git a/bridges/CpasbienBridge.php b/bridges/CpasbienBridge.php index 4299043..93ae21a 100644 --- a/bridges/CpasbienBridge.php +++ b/bridges/CpasbienBridge.php @@ -24,7 +24,7 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{ $this->name = "Cpasbien Bridge"; $this->uri = "http://www.cpasbien.io"; $this->description = "Returns latest torrents from a request query"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -44,10 +44,10 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{ $html = ''; if (isset($param['q'])) { /* keyword search mode */ $this->request = str_replace(" ","-",trim($param['q'])); - $html = $this->file_get_html($this->uri.'/recherche/'.urlencode($this->request).'.html') or $this->returnError('No results for this query.', 404); + $html = $this->file_get_html($this->uri.'/recherche/'.urlencode($this->request).'.html') or $this->returnServerError('No results for this query.'); } else { - $this->returnError('You must specify a keyword (?q=...).', 400); + $this->returnClientError('You must specify a keyword (?q=...).'); } foreach ($html->find('#gauche',0)->find('div') as $episode) { diff --git a/bridges/CryptomeBridge.php b/bridges/CryptomeBridge.php index 74da107..68c8876 100644 --- a/bridges/CryptomeBridge.php +++ b/bridges/CryptomeBridge.php @@ -7,7 +7,7 @@ class CryptomeBridge extends BridgeAbstract{ $this->name = "Cryptome"; $this->uri = "http://cryptome.org/"; $this->description = "Returns the N most recent documents."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -28,7 +28,7 @@ class CryptomeBridge extends BridgeAbstract{ // If you want HTTPS access instead, uncomment the following line: //$link = 'https://secure.netsolhost.com/cryptome.org/'; - $html = $this->file_get_html($link) or $this->returnError('Could not request Cryptome.', 404); + $html = $this->file_get_html($link) or $this->returnServerError('Could not request Cryptome.'); if (!empty($param['n'])) { /* number of documents */ $num = min(max(1, $param['n']+0), $num); } diff --git a/bridges/DailymotionBridge.php b/bridges/DailymotionBridge.php index 85afc3b..c782284 100644 --- a/bridges/DailymotionBridge.php +++ b/bridges/DailymotionBridge.php @@ -9,7 +9,7 @@ class DailymotionBridge extends BridgeAbstract{ $this->name = "Dailymotion Bridge"; $this->uri = "https://www.dailymotion.com/"; $this->description = "Returns the 5 newest videos by username/playlist or search"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters["By username"] = '[ @@ -47,7 +47,7 @@ class DailymotionBridge extends BridgeAbstract{ function getMetadata($id) { $metadata=array(); - $html2 = file_get_html('http://www.dailymotion.com/video/'.$id) or $this->returnError('Could not request Dailymotion.', 404); + $html2 = file_get_html('http://www.dailymotion.com/video/'.$id) or $this->returnServerError('Could not request Dailymotion.'); $metadata['title'] = $html2->find('meta[property=og:title]', 0)->getAttribute('content'); $metadata['timestamp'] = strtotime($html2->find('meta[property=video:release_date]', 0)->getAttribute('content') ); $metadata['thumbnailUri'] = $html2->find('meta[property=og:image]', 0)->getAttribute('content'); @@ -63,18 +63,18 @@ class DailymotionBridge extends BridgeAbstract{ if (isset($param['u'])) { // user timeline mode $this->request = $param['u']; - $html = $this->file_get_html('http://www.dailymotion.com/user/'.urlencode($this->request).'/1') or $this->returnError('Could not request Dailymotion.', 404); + $html = $this->file_get_html('http://www.dailymotion.com/user/'.urlencode($this->request).'/1') or $this->returnServerError('Could not request Dailymotion.'); } else if (isset($param['p'])) { // playlist mode $this->request = strtok($param['p'], '_'); - $html = $this->file_get_html('http://www.dailymotion.com/playlist/'.urlencode($this->request).'') or $this->returnError('Could not request Dailymotion.', 404); + $html = $this->file_get_html('http://www.dailymotion.com/playlist/'.urlencode($this->request).'') or $this->returnServerError('Could not request Dailymotion.'); } else if (isset($param['s'])) { // search mode $this->request = $param['s']; $page = 1; if (isset($param['pa'])) $page = (int)preg_replace("/[^0-9]/",'', $param['pa']); - $html = $this->file_get_html('http://www.dailymotion.com/search/'.urlencode($this->request).'/'.$page.'') or $this->returnError('Could not request Dailymotion.', 404); + $html = $this->file_get_html('http://www.dailymotion.com/search/'.urlencode($this->request).'/'.$page.'') or $this->returnServerError('Could not request Dailymotion.'); } else { - $this->returnError('You must either specify a Dailymotion username (?u=...) or a playlist id (?p=...) or search (?s=...)', 400); + $this->returnClientError('You must either specify a Dailymotion username (?u=...) or a playlist id (?p=...) or search (?s=...)'); } foreach($html->find('div.media a.preview_link') as $element) { diff --git a/bridges/DanbooruBridge.php b/bridges/DanbooruBridge.php index 7f4560f..e819193 100644 --- a/bridges/DanbooruBridge.php +++ b/bridges/DanbooruBridge.php @@ -7,7 +7,7 @@ class DanbooruBridge extends BridgeAbstract{ $this->name = "Danbooru"; $this->uri = "http://donmai.us/"; $this->description = "Returns images from given page"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -31,7 +31,7 @@ class DanbooruBridge extends BridgeAbstract{ if (isset($param['t'])) { $tags = urlencode($param['t']); } - $html = $this->file_get_html("http://donmai.us/posts?&page=$page&tags=$tags") or $this->returnError('Could not request Danbooru.', 404); + $html = $this->file_get_html("http://donmai.us/posts?&page=$page&tags=$tags") or $this->returnServerError('Could not request Danbooru.'); foreach($html->find('div[id=posts] article') as $element) { $item = new \Item(); $item->uri = 'http://donmai.us'.$element->find('a', 0)->href; diff --git a/bridges/DansTonChatBridge.php b/bridges/DansTonChatBridge.php index 5f5d72e..748190f 100644 --- a/bridges/DansTonChatBridge.php +++ b/bridges/DansTonChatBridge.php @@ -7,7 +7,7 @@ class DansTonChatBridge extends BridgeAbstract{ $this->name = "DansTonChat Bridge"; $this->uri = "http://danstonchat.com"; $this->description = "Returns latest quotes from DansTonChat."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } @@ -15,7 +15,7 @@ class DansTonChatBridge extends BridgeAbstract{ $html = ''; $link = 'http://danstonchat.com/latest.html'; - $html = $this->file_get_html($link) or $this->returnError('Could not request DansTonChat.', 404); + $html = $this->file_get_html($link) or $this->returnServerError('Could not request DansTonChat.'); foreach($html->find('div.item') as $element) { $item = new \Item(); diff --git a/bridges/DauphineLibereBridge.php b/bridges/DauphineLibereBridge.php index 7ef4161..a91ade9 100644 --- a/bridges/DauphineLibereBridge.php +++ b/bridges/DauphineLibereBridge.php @@ -7,7 +7,7 @@ class DauphineLibereBridge extends BridgeAbstract { $this->name = "Dauphine Bridge"; $this->uri = "http://www.ledauphine.com/"; $this->description = "Returns the newest articles."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -102,10 +102,10 @@ class DauphineLibereBridge extends BridgeAbstract { if (isset($param['u'])) { /* user timeline mode */ $this->request = $param['u']; - $html = $this->file_get_html('http://www.ledauphine.com/'.$this->request.'/rss', false, $context) or $this->returnError('Could not request DauphineLibere.', 404); + $html = $this->file_get_html('http://www.ledauphine.com/'.$this->request.'/rss', false, $context) or $this->returnServerError('Could not request DauphineLibere.'); } else { - $html = $this->file_get_html('http://www.ledauphine.com/rss', false, $context) or $this->returnError('Could not request DauphineLibere.', 404); + $html = $this->file_get_html('http://www.ledauphine.com/rss', false, $context) or $this->returnServerError('Could not request DauphineLibere.'); } $limit = 0; diff --git a/bridges/DeveloppezDotComBridge.php b/bridges/DeveloppezDotComBridge.php index e44160f..5fd7866 100644 --- a/bridges/DeveloppezDotComBridge.php +++ b/bridges/DeveloppezDotComBridge.php @@ -6,7 +6,7 @@ class DeveloppezDotComBridge extends BridgeAbstract{ $this->name = "Developpez.com Actus (FR)"; $this->uri = "http://www.developpez.com/"; $this->description = "Returns the 15 newest posts from DeveloppezDotCom (full text)."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } private function DeveloppezDotComStripCDATA($string) { @@ -42,7 +42,7 @@ class DeveloppezDotComBridge extends BridgeAbstract{ } public function collectData(array $param){ - $rssFeed = $this->file_get_html('http://www.developpez.com/index/rss') or $this->returnError('Could not request http://www.developpez.com/index/rss', 404); + $rssFeed = $this->file_get_html('http://www.developpez.com/index/rss') or $this->returnServerError('Could not request http://www.developpez.com/index/rss'); $limit = 0; foreach($rssFeed->find('item') as $element) { diff --git a/bridges/DilbertBridge.php b/bridges/DilbertBridge.php index 8cb7c80..d94ce9a 100644 --- a/bridges/DilbertBridge.php +++ b/bridges/DilbertBridge.php @@ -7,13 +7,13 @@ class DilbertBridge extends BridgeAbstract { $this->name = 'Dilbert Daily Strip'; $this->uri = 'http://dilbert.com'; $this->description = 'The Unofficial Dilbert Daily Comic Strip'; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } public function collectData(array $param) { - $html = $this->file_get_html($this->getURI()) or $this->returnError('Could not request Dilbert: '.$this->getURI(), 500); + $html = $this->file_get_html($this->getURI()) or $this->returnServerError('Could not request Dilbert: '.$this->getURI()); foreach ($html->find('section.comic-item') as $element) { diff --git a/bridges/DollbooruBridge.php b/bridges/DollbooruBridge.php index 3f81071..76d8a40 100644 --- a/bridges/DollbooruBridge.php +++ b/bridges/DollbooruBridge.php @@ -7,7 +7,7 @@ class DollbooruBridge extends BridgeAbstract{ $this->name = "Dollbooru"; $this->uri = "http://dollbooru.org/"; $this->description = "Returns images from given page"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = @@ -32,7 +32,7 @@ class DollbooruBridge extends BridgeAbstract{ if (isset($param['t'])) { $tags = urlencode($param['t']); } - $html = $this->file_get_html("http://dollbooru.org/post/list/$tags/$page") or $this->returnError('Could not request Dollbooru.', 404); + $html = $this->file_get_html("http://dollbooru.org/post/list/$tags/$page") or $this->returnServerError('Could not request Dollbooru.'); foreach($html->find('div[class=shm-image-list] a') as $element) { diff --git a/bridges/DuckDuckGoBridge.php b/bridges/DuckDuckGoBridge.php index 999b8e3..f09b869 100644 --- a/bridges/DuckDuckGoBridge.php +++ b/bridges/DuckDuckGoBridge.php @@ -7,7 +7,7 @@ class DuckDuckGoBridge extends BridgeAbstract{ $this->name = "DuckDuckGo"; $this->uri = "https://duckduckgo.com/"; $this->description = "Returns most recent results from DuckDuckGo."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -22,7 +22,7 @@ class DuckDuckGoBridge extends BridgeAbstract{ $html = ''; $link = 'http://duckduckgo.com/html/?q='.$param[u].'+sort:date'; - $html = $this->file_get_html($link) or $this->returnError('Could not request DuckDuckGo.', 404); + $html = $this->file_get_html($link) or $this->returnServerError('Could not request DuckDuckGo.'); foreach($html->find('div.results_links') as $element) { $item = new \Item(); diff --git a/bridges/EZTVBridge.php b/bridges/EZTVBridge.php index 16c106c..07a3469 100644 --- a/bridges/EZTVBridge.php +++ b/bridges/EZTVBridge.php @@ -7,7 +7,7 @@ class EZTVBridge extends BridgeAbstract{ $this->name = "EZTV"; $this->uri = "https://eztv.ch/"; $this->description = "Returns list of *recent* torrents for a specific show on EZTV. Get showID from URLs in https://eztv.ch/shows/showID/show-full-name."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -37,14 +37,14 @@ class EZTVBridge extends BridgeAbstract{ // Check for ID provided if (!isset($param['i'])) - $this->returnError('You must provide a list of ID (?i=showID1,showID2,...)', 400); + $this->returnClientError('You must provide a list of ID (?i=showID1,showID2,...)'); // Loop on show ids $showList = explode(",",$param['i']); foreach($showList as $showID){ // Get show page - $html = $this->file_get_html('https://eztv.ch/shows/'.rawurlencode($showID).'/') or $this->returnError('Could not request EZTV for id "'.$showID.'"', 404); + $html = $this->file_get_html('https://eztv.ch/shows/'.rawurlencode($showID).'/') or $this->returnServerError('Could not request EZTV for id "'.$showID.'"'); // Loop on each element that look like an episode entry... foreach($html->find('.forum_header_border') as $element) { diff --git a/bridges/EliteDangerousGalnetBridge.php b/bridges/EliteDangerousGalnetBridge.php index 38490b5..e519fc5 100644 --- a/bridges/EliteDangerousGalnetBridge.php +++ b/bridges/EliteDangerousGalnetBridge.php @@ -8,12 +8,12 @@ class EliteDangerousGalnetBridge extends BridgeAbstract $this->name = "Elite: Dangerous Galnet"; $this->uri = "https://community.elitedangerous.com/galnet"; $this->description = "Returns the latest page of news from Galnet"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } public function collectData(array $param) { - $html = $this->file_get_html('https://community.elitedangerous.com/galnet') or $this->returnError('Error while downloading the website content', 404); + $html = $this->file_get_html('https://community.elitedangerous.com/galnet') or $this->returnServerError('Error while downloading the website content'); foreach($html->find('div.article') as $element) { $item = new Item(); diff --git a/bridges/ElsevierBridge.php b/bridges/ElsevierBridge.php index c4c507e..31ccecc 100644 --- a/bridges/ElsevierBridge.php +++ b/bridges/ElsevierBridge.php @@ -6,7 +6,7 @@ class ElsevierBridge extends BridgeAbstract{ $this->name = 'Elsevier journals recent articles'; $this->uri = 'http://www.journals.elsevier.com'; $this->description = 'Returns the recent articles published in Elsevier journals'; - $this->update = '2016-08-15'; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -63,7 +63,7 @@ class ElsevierBridge extends BridgeAbstract{ public function collectData(array $param){ $uri = 'http://www.journals.elsevier.com/' . $param['j'] . '/recent-articles/'; - $html = file_get_html($uri) or $this->returnError('No results for Elsevier journal '.$param['j'], 404); + $html = file_get_html($uri) or $this->returnServerError('No results for Elsevier journal '.$param['j']); foreach($html->find('.pod-listing') as $article){ $item = new \Item(); diff --git a/bridges/EstCeQuonMetEnProdBridge.php b/bridges/EstCeQuonMetEnProdBridge.php index f0636b8..f45bf08 100644 --- a/bridges/EstCeQuonMetEnProdBridge.php +++ b/bridges/EstCeQuonMetEnProdBridge.php @@ -6,7 +6,7 @@ class EstCeQuonMetEnProdBridge extends BridgeAbstract { $this->name = 'Est-ce qu\'on met en prod aujourd\'hui ?'; $this->uri = 'https://www.estcequonmetenprodaujourdhui.info/'; $this->description = 'Should we put a website in production today? (French)'; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } public function collectData(array $param) { @@ -18,7 +18,7 @@ class EstCeQuonMetEnProdBridge extends BridgeAbstract { } return false; } - $html = $this->file_get_html($this->getURI()) or $this->returnError('Could not request EstCeQuonMetEnProd: '.$this->getURI(), 500); + $html = $this->file_get_html($this->getURI()) or $this->returnServerError('Could not request EstCeQuonMetEnProd: '.$this->getURI()); $item = new \Item(); $item->uri = $this->getURI().'#'.date('Y-m-d'); diff --git a/bridges/FacebookBridge.php b/bridges/FacebookBridge.php index f889794..37eae8d 100644 --- a/bridges/FacebookBridge.php +++ b/bridges/FacebookBridge.php @@ -7,7 +7,7 @@ class FacebookBridge extends BridgeAbstract{ $this->name = "Facebook"; $this->uri = "http://www.facebook.com/"; $this->description = "Input a page title or a profile log. For a profile log, please insert the parameter as follow : myExamplePage/132621766841117"; - $this->update = "2016-08-15"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -97,7 +97,7 @@ class FacebookBridge extends BridgeAbstract{ ); $context = stream_context_create($http_options); $html = file_get_contents($captcha_action, false, $context); - if ($html === FALSE) { $this->returnError('Failed to submit captcha response back to Facebook', 500); } + if ($html === FALSE) { $this->returnServerError('Failed to submit captcha response back to Facebook'); } unset($_SESSION['captcha_fields']); $html = str_get_html($html); } @@ -109,12 +109,12 @@ class FacebookBridge extends BridgeAbstract{ if (is_null($html)) { if (isset($param['u'])) { if (!strpos($param['u'], "/")) { - $html = $this->file_get_html('https://www.facebook.com/'.urlencode($param['u']).'?_fb_noscript=1') or $this->returnError('No results for this query.', 404); + $html = $this->file_get_html('https://www.facebook.com/'.urlencode($param['u']).'?_fb_noscript=1') or $this->returnServerError('No results for this query.'); } else { - $html = $this->file_get_html('https://www.facebook.com/pages/'.$param['u'].'?_fb_noscript=1') or $this->returnError('No results for this query.', 404); + $html = $this->file_get_html('https://www.facebook.com/pages/'.$param['u'].'?_fb_noscript=1') or $this->returnServerError('No results for this query.'); } } else { - $this->returnError('You must specify a Facebook username.', 400); + $this->returnClientError('You must specify a Facebook username.'); } } diff --git a/bridges/FierPandaBridge.php b/bridges/FierPandaBridge.php index c747a5a..9b610fa 100644 --- a/bridges/FierPandaBridge.php +++ b/bridges/FierPandaBridge.php @@ -7,14 +7,14 @@ Class FierPandaBridge extends BridgeAbstract{ $this->name = "Fier Panda Bridge"; $this->uri = "http://www.fier-panda.fr/"; $this->description = "Returns latest articles from Fier Panda."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } public function collectData(array $param){ $link = 'http://www.fier-panda.fr/'; - $html = $this->file_get_html($link) or $this->returnError('Could not request Fier Panda.', 404); + $html = $this->file_get_html($link) or $this->returnServerError('Could not request Fier Panda.'); foreach($html->find('div.container-content article') as $element) { $item = new \Item(); diff --git a/bridges/FlickrExploreBridge.php b/bridges/FlickrExploreBridge.php index 9629302..37b619a 100644 --- a/bridges/FlickrExploreBridge.php +++ b/bridges/FlickrExploreBridge.php @@ -7,12 +7,12 @@ class FlickrExploreBridge extends BridgeAbstract{ $this->name = "Flickr Explore"; $this->uri = "https://www.flickr.com/explore"; $this->description = "Returns the latest interesting images from Flickr"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } public function collectData(array $param){ - $html = $this->file_get_html('https://www.flickr.com/explore') or $this->returnError('Could not request Flickr.', 404); + $html = $this->file_get_html('https://www.flickr.com/explore') or $this->returnServerError('Could not request Flickr.'); foreach($html->find('.photo-list-photo-view') as $element) { // Get the styles @@ -26,7 +26,7 @@ class FlickrExploreBridge extends BridgeAbstract{ $imageID = reset($imageURIs); // Get the image JSON via Flickr API - $imageJSON = json_decode(file_get_contents('https://api.flickr.com/services/rest/?method=flickr.photos.getInfo&api_key=103b574d49bd51f0e18bfe907da44a0f&photo_id='.$imageID.'&format=json&nojsoncallback=1')) or $this->returnError('Could not request Flickr.', 404); // FIXME: Request time too long... + $imageJSON = json_decode(file_get_contents('https://api.flickr.com/services/rest/?method=flickr.photos.getInfo&api_key=103b574d49bd51f0e18bfe907da44a0f&photo_id='.$imageID.'&format=json&nojsoncallback=1')) or $this->returnServerError('Could not request Flickr.'); // FIXME: Request time too long... $item = new \Item(); $item->uri = 'https://flickr.com/photo.gne?id='.$imageID; diff --git a/bridges/FlickrTagBridge.php b/bridges/FlickrTagBridge.php index 700f5fe..957efbb 100644 --- a/bridges/FlickrTagBridge.php +++ b/bridges/FlickrTagBridge.php @@ -7,7 +7,7 @@ class FlickrTagBridge extends BridgeAbstract{ $this->name = "Flickr TagUser"; $this->uri = "http://www.flickr.com/"; $this->description = "Returns the tagged or user images from Flickr"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters["By keyword"] = '[ @@ -27,18 +27,18 @@ class FlickrTagBridge extends BridgeAbstract{ } public function collectData(array $param){ - $html = $this->file_get_html('http://www.flickr.com/search/?q=vendee&s=rec') or $this->returnError('Could not request Flickr.', 404); + $html = $this->file_get_html('http://www.flickr.com/search/?q=vendee&s=rec') or $this->returnServerError('Could not request Flickr.'); if (isset($param['q'])) { /* keyword search mode */ $this->request = $param['q']; - $html = $this->file_get_html('http://www.flickr.com/search/?q='.urlencode($this->request).'&s=rec') or $this->returnError('No results for this query.', 404); + $html = $this->file_get_html('http://www.flickr.com/search/?q='.urlencode($this->request).'&s=rec') or $this->returnServerError('No results for this query.'); } elseif (isset($param['u'])) { /* user timeline mode */ $this->request = $param['u']; - $html = $this->file_get_html('http://www.flickr.com/photos/'.urlencode($this->request).'/') or $this->returnError('Requested username can\'t be found.', 404); + $html = $this->file_get_html('http://www.flickr.com/photos/'.urlencode($this->request).'/') or $this->returnServerError('Requested username can\'t be found.'); } else { - $this->returnError('You must specify a keyword or a Flickr username.', 400); + $this->returnClientError('You must specify a keyword or a Flickr username.'); } foreach($html->find('span.photo_container') as $element) { diff --git a/bridges/FootitoBridge.php b/bridges/FootitoBridge.php index 48a8cba..e4030a5 100644 --- a/bridges/FootitoBridge.php +++ b/bridges/FootitoBridge.php @@ -7,12 +7,12 @@ class FootitoBridge extends BridgeAbstract{ $this->name = "Footito"; $this->uri = "http://www.footito.fr/"; $this->description = "Footito"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } public function collectData(array $param){ - $html = $this->file_get_html('http://www.footito.fr/') or $this->returnError('Could not request Footito.', 404); + $html = $this->file_get_html('http://www.footito.fr/') or $this->returnServerError('Could not request Footito.'); foreach($html->find('div.post') as $element) { $item = new Item(); diff --git a/bridges/FourchanBridge.php b/bridges/FourchanBridge.php index df4efba..6c58761 100644 --- a/bridges/FourchanBridge.php +++ b/bridges/FourchanBridge.php @@ -7,7 +7,7 @@ class FourchanBridge extends BridgeAbstract{ $this->name = "4chan"; $this->uri = "https://www.4chan.org/"; $this->description = "Returns posts from the specified thread"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -22,17 +22,17 @@ class FourchanBridge extends BridgeAbstract{ public function collectData(array $param){ if (!isset($param['t'])) - $this->returnError('You must specify the thread URL (?t=...)', 400); + $this->returnClientError('You must specify the thread URL (?t=...)'); - $thread = parse_url($param['t']) or $this->returnError('This URL seems malformed, please check it.', 400); + $thread = parse_url($param['t']) or $this->returnClientError('This URL seems malformed, please check it.'); if($thread['host'] !== 'boards.4chan.org') - $this->returnError('4chan thread URL only.', 400); + $this->returnClientError('4chan thread URL only.'); if(strpos($thread['path'], 'thread/') === FALSE) - $this->returnError('You must specify the thread URL.', 400); + $this->returnClientError('You must specify the thread URL.'); $url = 'https://boards.4chan.org'.$thread['path'].''; - $html = $this->file_get_html($url) or $this->returnError("Could not request 4chan, thread not found", 404); + $html = $this->file_get_html($url) or $this->returnServerError("Could not request 4chan, thread not found"); foreach($html->find('div.postContainer') as $element) { $item = new \Item(); diff --git a/bridges/FuturaSciencesBridge.php b/bridges/FuturaSciencesBridge.php index 2886249..24b5f93 100644 --- a/bridges/FuturaSciencesBridge.php +++ b/bridges/FuturaSciencesBridge.php @@ -7,7 +7,7 @@ class FuturaSciencesBridge extends BridgeAbstract { $this->name = 'Futura-Sciences Bridge'; $this->uri = 'http://www.futura-sciences.com/'; $this->description = 'Returns the newest articles.'; - $this->update = '2016-08-09'; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -167,18 +167,18 @@ class FuturaSciencesBridge extends BridgeAbstract { } if (empty($param['feed'])) - $this->returnError('Please select a feed to display.'.$url, 400); + $this->returnClientError('Please select a feed to display.'.$url); if ($param['feed'] !== preg_replace('/[^a-zA-Z-\/]+/', '', $param['feed']) || substr_count($param['feed'], '/') > 1 || strlen($param['feed'] > 64)) - $this->returnError('Invalid "feed" parameter.'.$url, 400); + $this->returnClientError('Invalid "feed" parameter.'.$url); $url = $this->getURI().'rss/'.$param['feed'].'.xml'; - $html = $this->file_get_html($url) or $this->returnError('Could not request Futura-Sciences: '.$url, 500); + $html = $this->file_get_html($url) or $this->returnServerError('Could not request Futura-Sciences: '.$url); $limit = 0; foreach($html->find('item') as $element) { if ($limit < 10) { $article_url = str_replace('#xtor=RSS-8', '', StripCDATA($element->find('guid', 0)->plaintext)); - $article = $this->file_get_html($article_url) or $this->returnError('Could not request Futura-Sciences: '.$article_url, 500); + $article = $this->file_get_html($article_url) or $this->returnServerError('Could not request Futura-Sciences: '.$article_url); $contents = $article->find('div.content', 0)->innertext; foreach (array( diff --git a/bridges/GBAtempBridge.php b/bridges/GBAtempBridge.php index 94ea2e2..cc59203 100644 --- a/bridges/GBAtempBridge.php +++ b/bridges/GBAtempBridge.php @@ -9,7 +9,7 @@ class GBAtempBridge extends BridgeAbstract { $this->name = 'GBAtemp'; $this->uri = 'http://gbatemp.net/'; $this->description = 'GBAtemp is a user friendly underground video game community.'; - $this->update = '2016-08-09'; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -74,7 +74,7 @@ class GBAtempBridge extends BridgeAbstract { } private function fetch_post_content($uri, $site_url) { - $html = $this->file_get_html($uri) or $this->returnError('Could not request GBAtemp: '.$uri, 500); + $html = $this->file_get_html($uri) or $this->returnServerError('Could not request GBAtemp: '.$uri); $content = $html->find('div.messageContent', 0)->innertext; return $this->cleanup_post_content($content, $site_url); } @@ -88,10 +88,10 @@ class GBAtempBridge extends BridgeAbstract { if ($typeFilter == 'R') { $this->filter = 'Review'; } if ($typeFilter == 'T') { $this->filter = 'Tutorial'; } if ($typeFilter == 'F') { $this->filter = 'Forum'; } - } else $this->returnError('The provided type filter is invalid. Expecting N, R, T, or F.', 400); - } else $this->returnError('Please provide a type filter. Expecting N, R, T, or F.', 400); + } else $this->returnClientError('The provided type filter is invalid. Expecting N, R, T, or F.'); + } else $this->returnClientError('Please provide a type filter. Expecting N, R, T, or F.'); - $html = $this->file_get_html($this->uri) or $this->returnError('Could not request GBAtemp.', 500); + $html = $this->file_get_html($this->uri) or $this->returnServerError('Could not request GBAtemp.'); if ($typeFilter == 'N') { foreach ($html->find('li[class=news_item full]') as $newsItem) { @@ -106,7 +106,7 @@ class GBAtempBridge extends BridgeAbstract { foreach ($html->find('li.portal_review') as $reviewItem) { $url = $this->uri.$reviewItem->find('a', 0)->href; $title = $reviewItem->find('span.review_title', 0)->plaintext; - $content = $this->file_get_html($url) or $this->returnError('Could not request GBAtemp: '.$uri, 500); + $content = $this->file_get_html($url) or $this->returnServerError('Could not request GBAtemp: '.$uri); $author = $content->find('a.username', 0)->plaintext; $time = intval($this->ExtractFromDelimiters($content->find('abbr.DateTime', 0)->outertext, 'data-time="', '"')); $intro = '

'.($content->find('div#review_intro', 0)->plaintext).'

'; diff --git a/bridges/GelbooruBridge.php b/bridges/GelbooruBridge.php index 59ac38b..2d77512 100644 --- a/bridges/GelbooruBridge.php +++ b/bridges/GelbooruBridge.php @@ -7,7 +7,7 @@ class GelbooruBridge extends BridgeAbstract{ $this->name = "Gelbooru"; $this->uri = "http://gelbooru.com/"; $this->description = "Returns images from given page"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -34,7 +34,7 @@ class GelbooruBridge extends BridgeAbstract{ if (isset($param['t'])) { $tags = urlencode($param['t']); } - $html = $this->file_get_html("http://gelbooru.com/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnError('Could not request Gelbooru.', 404); + $html = $this->file_get_html("http://gelbooru.com/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Gelbooru.'); foreach($html->find('div[class=content] span') as $element) { diff --git a/bridges/GiphyBridge.php b/bridges/GiphyBridge.php index 4ac77e2..5605fd1 100644 --- a/bridges/GiphyBridge.php +++ b/bridges/GiphyBridge.php @@ -9,7 +9,7 @@ class GiphyBridge extends BridgeAbstract{ $this->name = "Giphy Bridge"; $this->uri = "http://giphy.com/"; $this->description = "Bridge for giphy.com"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters["By tag"] = '[ @@ -33,10 +33,10 @@ class GiphyBridge extends BridgeAbstract{ $html = ''; $base_url = 'http://giphy.com'; if (isset($param['s'])) { /* keyword search mode */ - $html = $this->file_get_html($base_url.'/search/'.urlencode($param['s'].'/')) or $this->returnError('No results for this query.', 404); + $html = $this->file_get_html($base_url.'/search/'.urlencode($param['s'].'/')) or $this->returnServerError('No results for this query.'); } else { - $this->returnError('You must specify a search worf (?s=...).', 400); + $this->returnClientError('You must specify a search worf (?s=...).'); } $max = GIPHY_LIMIT; @@ -51,7 +51,7 @@ class GiphyBridge extends BridgeAbstract{ $node = $entry->first_child(); $href = $node->getAttribute('href'); - $html2 = $this->file_get_html($base_url . $href) or $this->returnError('No results for this query.', 404); + $html2 = $this->file_get_html($base_url . $href) or $this->returnServerError('No results for this query.'); $figure = $html2->getElementByTagName('figure'); $img = $figure->firstChild(); $caption = $figure->lastChild(); diff --git a/bridges/GithubIssueBridge.php b/bridges/GithubIssueBridge.php index 28b19da..febbf34 100644 --- a/bridges/GithubIssueBridge.php +++ b/bridges/GithubIssueBridge.php @@ -12,7 +12,7 @@ class GithubIssueBridge extends BridgeAbstract{ $this->name = 'Github Issue'; $this->uri = ''; $this->description = 'Returns the comments of a github project issue'; - $this->update = '2016-08-09'; + $this->update = '2016-08-17'; $this->parameters[]= '[ @@ -35,7 +35,7 @@ class GithubIssueBridge extends BridgeAbstract{ public function collectData(array $param){ $uri = 'https://github.com/'.$param['u'].'/'.$param['p'].'/issues/'.$param['i']; $html = file_get_html($uri) - or $this->returnError('No results for Github Issue '.$param['i'].' in project '.$param['u'].'/'.$param['p'], 404); + or $this->returnServerError('No results for Github Issue '.$param['i'].' in project '.$param['u'].'/'.$param['p']); foreach($html->find('.js-comment-container') as $comment){ diff --git a/bridges/GitlabCommitsBridge.php b/bridges/GitlabCommitsBridge.php index c08bc8d..85c6332 100644 --- a/bridges/GitlabCommitsBridge.php +++ b/bridges/GitlabCommitsBridge.php @@ -12,7 +12,7 @@ class GitlabCommitsBridge extends BridgeAbstract{ $this->name = 'Gitlab Commits'; $this->uri = ''; $this->description = 'Returns the commits of a project hosted on a gitlab instance'; - $this->update = '2016-08-09'; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -45,7 +45,7 @@ class GitlabCommitsBridge extends BridgeAbstract{ } $html = file_get_html($uri) - or $this->returnError('No results for Gitlab Commits of project '.$param['uri'].'/'.$param['u'].'/'.$param['p'], 404); + or $this->returnServerError('No results for Gitlab Commits of project '.$param['uri'].'/'.$param['u'].'/'.$param['p']); foreach($html->find('li.commit') as $commit){ diff --git a/bridges/GizmodoFRBridge.php b/bridges/GizmodoFRBridge.php index 1204e9f..ce0d44e 100644 --- a/bridges/GizmodoFRBridge.php +++ b/bridges/GizmodoFRBridge.php @@ -7,7 +7,7 @@ class GizmodoFRBridge extends BridgeAbstract{ $this->name = "GizmodoFR"; $this->uri = "http://www.gizmodo.fr/"; $this->description = "Returns the 15 newest posts from GizmodoFR (full text)."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } @@ -26,7 +26,7 @@ class GizmodoFRBridge extends BridgeAbstract{ return $text; } - $rssFeed = $this->file_get_html('http://www.gizmodo.fr/feed') or $this->returnError('Could not request http://www.gizmodo.fr/feed', 404); + $rssFeed = $this->file_get_html('http://www.gizmodo.fr/feed') or $this->returnServerError('Could not request http://www.gizmodo.fr/feed'); $limit = 0; foreach($rssFeed->find('item') as $element) { diff --git a/bridges/GooglePlusPostBridge.php b/bridges/GooglePlusPostBridge.php index 878ee23..104a13e 100644 --- a/bridges/GooglePlusPostBridge.php +++ b/bridges/GooglePlusPostBridge.php @@ -10,7 +10,7 @@ class GooglePlusPostBridge extends BridgeAbstract $this->name = "Google Plus Post Bridge"; $this->uri = "http://plus.google.com/"; $this->description = "Returns user public post (without API)."; - $this->update = "2014-07-20"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -28,7 +28,7 @@ class GooglePlusPostBridge extends BridgeAbstract { if (!isset($param['username'])) { - $this->returnError('You must specify a username (?username=...).', 400); + $this->returnClientError('You must specify a username (?username=...).'); } $this->request = $param['username']; @@ -39,7 +39,7 @@ class GooglePlusPostBridge extends BridgeAbstract , false, stream_context_create(array('http'=> array( 'header' => 'Accept-Language: fr,fr-be,fr-fr;q=0.8,en;q=0.4,en-us;q=0.2;*' . "\r\n" ))) - ) OR $this->returnError('No results for this query.', 404); + ) OR $this->returnServerError('No results for this query.'); // get title, url, ... there is a lot of intresting stuff in meta $this->_title = $html->find('meta[property]', 0)->getAttribute('content'); diff --git a/bridges/GoogleSearchBridge.php b/bridges/GoogleSearchBridge.php index 30e8815..0c68a29 100644 --- a/bridges/GoogleSearchBridge.php +++ b/bridges/GoogleSearchBridge.php @@ -17,7 +17,7 @@ class GoogleSearchBridge extends BridgeAbstract{ $this->name = "Google search"; $this->uri = "https://www.google.com/"; $this->description = "Returns most recent results from Google search."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -35,10 +35,10 @@ class GoogleSearchBridge extends BridgeAbstract{ if (isset($param['q'])) { /* keyword search mode */ $this->request = $param['q']; - $html = $this->file_get_html('https://www.google.com/search?q=' . urlencode($this->request) . '&num=100&complete=0&tbs=qdr:y,sbd:1') or $this->returnError('No results for this query.', 404); + $html = $this->file_get_html('https://www.google.com/search?q=' . urlencode($this->request) . '&num=100&complete=0&tbs=qdr:y,sbd:1') or $this->returnServerError('No results for this query.'); } else{ - $this->returnError('You must specify a keyword (?q=...).', 400); + $this->returnClientError('You must specify a keyword (?q=...).'); } $emIsRes = $html->find('div[id=ires]',0); diff --git a/bridges/GuruMedBridge.php b/bridges/GuruMedBridge.php index 92a4454..51c3e8d 100644 --- a/bridges/GuruMedBridge.php +++ b/bridges/GuruMedBridge.php @@ -6,7 +6,7 @@ class GuruMedBridge extends BridgeAbstract{ $this->name = "GuruMed"; $this->uri = "http://www.gurumed.org"; $this->description = "Returns the 5 newest posts from Gurumed (full text)"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } private function GurumedStripCDATA($string) { @@ -16,7 +16,7 @@ class GuruMedBridge extends BridgeAbstract{ } public function collectData(array $param){ - $html = $this->file_get_html('http://gurumed.org/feed') or $this->returnError('Could not request Gurumed.', 404); + $html = $this->file_get_html('http://gurumed.org/feed') or $this->returnServerError('Could not request Gurumed.'); $limit = 0; foreach($html->find('item') as $element) { diff --git a/bridges/HDWallpapersBridge.php b/bridges/HDWallpapersBridge.php index 7a60e5b..c6cc6b8 100644 --- a/bridges/HDWallpapersBridge.php +++ b/bridges/HDWallpapersBridge.php @@ -10,7 +10,7 @@ class HDWallpapersBridge extends BridgeAbstract { $this->name = "HD Wallpapers Bridge"; $this->uri = "http://www.hdwallpapers.in/"; $this->description = "Returns the latests wallpapers from HDWallpapers"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -48,7 +48,7 @@ class HDWallpapersBridge extends BridgeAbstract { for ($page = 1; $page <= $lastpage; $page++) { $link = $baseUri.'/'.$category.'/page/'.$page; - $html = $this->file_get_html($link) or $this->returnError('No results for this query.', 404); + $html = $this->file_get_html($link) or $this->returnServerError('No results for this query.'); if ($page === 1) { preg_match('/page\/(\d+)$/', $html->find('.pagination a', -2)->href, $matches); diff --git a/bridges/HentaiHavenBridge.php b/bridges/HentaiHavenBridge.php index b3ea196..5f41a1b 100644 --- a/bridges/HentaiHavenBridge.php +++ b/bridges/HentaiHavenBridge.php @@ -7,12 +7,12 @@ class HentaiHavenBridge extends BridgeAbstract{ $this->name = "Hentai Haven"; $this->uri = "http://hentaihaven.org/"; $this->description = "Returns releases from Hentai Haven"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } public function collectData(array $param){ - $html = $this->file_get_html('http://hentaihaven.org/') or $this->returnError('Could not request Hentai Haven.', 404); + $html = $this->file_get_html('http://hentaihaven.org/') or $this->returnServerError('Could not request Hentai Haven.'); foreach($html->find('div.zoe-grid') as $element) { $item = new \Item(); $item->uri = $element->find('div.brick-content h3 a', 0)->href; diff --git a/bridges/IdenticaBridge.php b/bridges/IdenticaBridge.php index 08ade2d..a2c7d90 100644 --- a/bridges/IdenticaBridge.php +++ b/bridges/IdenticaBridge.php @@ -9,7 +9,7 @@ class IdenticaBridge extends BridgeAbstract{ $this->name = "Identica Bridge"; $this->uri = "https://identi.ca/"; $this->description = "Returns user timelines"; - $this->update = "2014-05-25"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -25,10 +25,10 @@ class IdenticaBridge extends BridgeAbstract{ $html = ''; if (isset($param['u'])) { /* user timeline mode */ $this->request = $param['u']; - $html = $this->file_get_html('https://identi.ca/'.urlencode($this->request)) or $this->returnError('Requested username can\'t be found.', 404); + $html = $this->file_get_html('https://identi.ca/'.urlencode($this->request)) or $this->returnServerError('Requested username can\'t be found.'); } else { - $this->returnError('You must specify an Identica username (?u=...).', 400); + $this->returnClientError('You must specify an Identica username (?u=...).'); } foreach($html->find('li.major') as $dent) { diff --git a/bridges/InstagramBridge.php b/bridges/InstagramBridge.php index 2c50003..e8f53a6 100644 --- a/bridges/InstagramBridge.php +++ b/bridges/InstagramBridge.php @@ -9,7 +9,7 @@ class InstagramBridge extends BridgeAbstract{ $this->name = "Instagram Bridge"; $this->uri = "http://instagram.com/"; $this->description = "Returns the newest images"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -25,10 +25,10 @@ class InstagramBridge extends BridgeAbstract{ $html = ''; if (isset($param['u'])) { /* user timeline mode */ $this->request = $param['u']; - $html = $this->file_get_html('http://instagram.com/'.urlencode($this->request)) or $this->returnError('Could not request Instagram.', 404); + $html = $this->file_get_html('http://instagram.com/'.urlencode($this->request)) or $this->returnServerError('Could not request Instagram.'); } else { - $this->returnError('You must specify a Instagram username (?u=...).', 400); + $this->returnClientError('You must specify a Instagram username (?u=...).'); } $innertext = null; diff --git a/bridges/IsoHuntBridge.php b/bridges/IsoHuntBridge.php index 9addd23..1d073a5 100644 --- a/bridges/IsoHuntBridge.php +++ b/bridges/IsoHuntBridge.php @@ -5,7 +5,7 @@ class IsoHuntBridge extends BridgeAbstract{ $this->name = 'isoHunt Bridge'; // Is replaced later! $this->uri = 'https://isohunt.to'; // Is replaced later! $this->description = 'Returns the latest results by category or search result'; - $this->update = '2016-08-16'; + $this->update = '2016-08-17'; /* * Get feeds for one of the "latest" categories @@ -190,7 +190,7 @@ class IsoHuntBridge extends BridgeAbstract{ else $this->request_search($params['search_name']); } else { - $this->returnError('Unknown request!', 400); + $this->returnClientError('Unknown request!'); } } @@ -262,7 +262,7 @@ class IsoHuntBridge extends BridgeAbstract{ $this->uri .= '/latest.php'; break; default: // No category applies - $this->returnError('Undefined category: ' . $category . '!', 400); + $this->returnClientError('Undefined category: ' . $category . '!'); } $html = $this->load_html($this->uri); @@ -313,21 +313,21 @@ class IsoHuntBridge extends BridgeAbstract{ private function get_movie_torrents($html){ $container = $html->find('div#w0', 0); if(!$container) - $this->returnError('Unable to find torrent container!', 500); + $this->returnServerError('Unable to find torrent container!'); $torrents = $container->find('article'); if(!$torrents) - $this->returnError('Unable to find torrents!', 500); + $this->returnServerError('Unable to find torrents!'); foreach($torrents as $torrent){ $anchor = $torrent->find('a', 0); if(!$anchor) - $this->returnError('Unable to find anchor!', 500); + $this->returnServerError('Unable to find anchor!'); $date = $torrent->find('small', 0); if(!$date) - $this->returnError('Unable to find date!', 500); + $this->returnServerError('Unable to find date!'); $item = new \Item(); @@ -348,11 +348,11 @@ class IsoHuntBridge extends BridgeAbstract{ private function get_latest_hot_torrents($html){ $container = $html->find('div#serps', 0); if(!$container) - $this->returnError('Unable to find torrent container!', 500); + $this->returnServerError('Unable to find torrent container!'); $torrents = $container->find('tr'); if(!$torrents) - $this->returnError('Unable to find torrents!', 500); + $this->returnServerError('Unable to find torrents!'); // Remove first element (header row) $torrents = array_slice($torrents, 1); @@ -361,11 +361,11 @@ class IsoHuntBridge extends BridgeAbstract{ $cell = $torrent->find('td', 0); if(!$cell) - $this->returnError('Unable to find cell!', 500); + $this->returnServerError('Unable to find cell!'); $element = $cell->find('a', 0); if(!$element) - $this->returnError('Unable to find element!', 500); + $this->returnServerError('Unable to find element!'); $item = new \Item(); @@ -386,11 +386,11 @@ class IsoHuntBridge extends BridgeAbstract{ private function get_latest_news($html){ $container = $html->find('div#postcontainer', 0); if(!$container) - $this->returnError('Unable to find post container!', 500); + $this->returnServerError('Unable to find post container!'); $posts = $container->find('div.index-post'); if(!$posts) - $this->returnError('Unable to find posts!', 500); + $this->returnServerError('Unable to find posts!'); foreach($posts as $post){ $item = new \Item(); @@ -408,7 +408,7 @@ class IsoHuntBridge extends BridgeAbstract{ private function latest_news_extract_author($post){ $author = $post->find('small', 0); if(!$author) - $this->returnError('Unable to find author!', 500); + $this->returnServerError('Unable to find author!'); // The author is hidden within a string like: 'Posted by {author} on {date}' preg_match('/Posted\sby\s(.*)\son/i', $author->innertext, $matches); @@ -419,7 +419,7 @@ class IsoHuntBridge extends BridgeAbstract{ private function latest_news_extract_timestamp($post){ $date = $post->find('small', 0); if(!$date) - $this->returnError('Unable to find date!', 500); + $this->returnServerError('Unable to find date!'); // The date is hidden within a string like: 'Posted by {author} on {date}' preg_match('/Posted\sby\s.*\son\s(.*)/i', $date->innertext, $matches); @@ -437,7 +437,7 @@ class IsoHuntBridge extends BridgeAbstract{ private function latest_news_extract_title($post){ $title = $post->find('a', 0); if(!$title) - $this->returnError('Unable to find title!', 500); + $this->returnServerError('Unable to find title!'); return $title->plaintext; } @@ -445,7 +445,7 @@ class IsoHuntBridge extends BridgeAbstract{ private function latest_news_extract_uri($post){ $uri = $post->find('a', 0); if(!$uri) - $this->returnError('Unable to find uri!', 500); + $this->returnServerError('Unable to find uri!'); return $uri->href; } @@ -453,7 +453,7 @@ class IsoHuntBridge extends BridgeAbstract{ private function latest_news_extract_content($post){ $content = $post->find('div', 0); if(!$content) - $this->returnError('Unable to find content!', 500); + $this->returnServerError('Unable to find content!'); // Remove

...

(title) foreach($content->find('h2') as $element){ @@ -475,11 +475,11 @@ class IsoHuntBridge extends BridgeAbstract{ private function get_latest_torrents($html){ $container = $html->find('div#serps', 0); if(!$container) - $this->returnError('Unable to find torrent container!', 500); + $this->returnServerError('Unable to find torrent container!'); $torrents = $container->find('tr[data-key]'); if(!$torrents) - $this->returnError('Unable to find torrents!', 500); + $this->returnServerError('Unable to find torrents!'); foreach($torrents as $torrent){ $item = new \Item(); @@ -497,11 +497,11 @@ class IsoHuntBridge extends BridgeAbstract{ private function latest_torrents_extract_title($torrent){ $cell = $torrent->find('td.title-row', 0); if(!$cell) - $this->returnError('Unable to find title cell!', 500); + $this->returnServerError('Unable to find title cell!'); $title = $cell->find('span', 0); if(!$title) - $this->returnError('Unable to find title!', 500); + $this->returnServerError('Unable to find title!'); return $title->plaintext; } @@ -509,11 +509,11 @@ class IsoHuntBridge extends BridgeAbstract{ private function latest_torrents_extract_uri($torrent){ $cell = $torrent->find('td.title-row', 0); if(!$cell) - $this->returnError('Unable to find title cell!', 500); + $this->returnServerError('Unable to find title cell!'); $uri = $cell->find('a', 0); if(!$uri) - $this->returnError('Unable to find uri!', 500); + $this->returnServerError('Unable to find uri!'); return $this->fix_relative_uri($uri->href); } @@ -525,7 +525,7 @@ class IsoHuntBridge extends BridgeAbstract{ $user = $cell->find('a', 0); if(!$user) - $this->returnError('Unable to find user!', 500); + $this->returnServerError('Unable to find user!'); return $user->plaintext; } @@ -533,7 +533,7 @@ class IsoHuntBridge extends BridgeAbstract{ private function latest_torrents_extract_timestamp($torrent){ $cell = $torrent->find('td.date-row', 0); if(!$cell) - $this->returnError('Unable to find date cell!', 500); + $this->returnServerError('Unable to find date cell!'); return strtotime('-' . $cell->plaintext, time()); } @@ -545,7 +545,7 @@ class IsoHuntBridge extends BridgeAbstract{ private function load_html($uri){ $html = $this->file_get_html($uri); if(!$html) - $this->returnError('Unable to load ' . $uri . '!', 500); + $this->returnServerError('Unable to load ' . $uri . '!'); return $html; } diff --git a/bridges/JapanExpoBridge.php b/bridges/JapanExpoBridge.php index afff948..0b26211 100644 --- a/bridges/JapanExpoBridge.php +++ b/bridges/JapanExpoBridge.php @@ -6,7 +6,7 @@ class JapanExpoBridge extends BridgeAbstract{ $this->name = 'Japan Expo Actualités'; $this->uri = 'http://www.japan-expo-paris.com/fr/actualites'; $this->description = 'Returns most recent entries from Japan Expo actualités.'; - $this->update = '2016-08-09'; + $this->update = '2016-08-17'; $this->parameters[] = '[ { @@ -59,7 +59,7 @@ class JapanExpoBridge extends BridgeAbstract{ }; $link = 'http://www.japan-expo-paris.com/fr/actualites'; - $html = $this->file_get_html($link) or $this->returnError('Could not request JapanExpo: '.$link , 500); + $html = $this->file_get_html($link) or $this->returnServerError('Could not request JapanExpo: '.$link); $fullcontent = (!empty($param['mode']) && $param['mode'] == 'full'); $count = 0; @@ -73,7 +73,7 @@ class JapanExpoBridge extends BridgeAbstract{ if ($fullcontent) { if ($count < 5) { - $article_html = $this->file_get_html($url) or $this->returnError('Could not request JapanExpo: '.$url , 500); + $article_html = $this->file_get_html($url) or $this->returnServerError('Could not request JapanExpo: '.$url); $header = $article_html->find('header.pageHeadBox', 0); $timestamp = strtotime($header->find('time', 0)->datetime); $title_html = $header->find('div.section', 0)->next_sibling(); diff --git a/bridges/KonachanBridge.php b/bridges/KonachanBridge.php index 45227a4..064a1fd 100644 --- a/bridges/KonachanBridge.php +++ b/bridges/KonachanBridge.php @@ -7,7 +7,7 @@ class KonachanBridge extends BridgeAbstract{ $this->name = "Konachan"; $this->uri = "http://konachan.com/"; $this->description = "Returns images from given page"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -31,7 +31,7 @@ class KonachanBridge extends BridgeAbstract{ if (isset($param['t'])) { $tags = urlencode($param['t']); } - $html = $this->file_get_html("http://konachan.com/post?page=$page&tags=$tags") or $this->returnError('Could not request Konachan.', 404); + $html = $this->file_get_html("http://konachan.com/post?page=$page&tags=$tags") or $this->returnServerError('Could not request Konachan.'); $input_json = explode('Post.register(', $html); foreach($input_json as $element) $data[] = preg_replace('/}\)(.*)/', '}', $element); diff --git a/bridges/KoreusBridge.php b/bridges/KoreusBridge.php index 15bcaa1..f532d05 100644 --- a/bridges/KoreusBridge.php +++ b/bridges/KoreusBridge.php @@ -6,7 +6,7 @@ class KoreusBridge extends BridgeAbstract{ $this->name = "Koreus"; $this->uri = "http://www.koreus.com/"; $this->description = "Returns the 5 newest posts from Koreus (full text)"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } private function KoreusStripCDATA($string) { @@ -23,7 +23,7 @@ class KoreusBridge extends BridgeAbstract{ } public function collectData(array $param){ - $html = $this->file_get_html('http://feeds.feedburner.com/Koreus-articles') or $this->returnError('Could not request Koreus.', 404); + $html = $this->file_get_html('http://feeds.feedburner.com/Koreus-articles') or $this->returnServerError('Could not request Koreus.'); $limit = 0; foreach($html->find('item') as $element) { diff --git a/bridges/KununuBridge.php b/bridges/KununuBridge.php index dc4fe4b..b104de8 100644 --- a/bridges/KununuBridge.php +++ b/bridges/KununuBridge.php @@ -5,7 +5,7 @@ class KununuBridge extends BridgeAbstract{ $this->name = "Kununu Bridge"; /* This will be replaced later! */ $this->uri = "https://www.kununu.com"; /* This will be replaced later! */ $this->description = "Returns the latest reviews for a company and site of your choice."; - $this->update = "2016-08-15"; + $this->update = '2016-08-17'; $this->parameters['global'] = '[ @@ -64,12 +64,12 @@ class KununuBridge extends BridgeAbstract{ // Get Site $site = strtolower(trim($params['site'])); if(!isset($site) || empty($site) || !$this->site_is_valid($site)) - $this->returnError('You must specify a valid site (&site=...)!', 400); + $this->returnClientError('You must specify a valid site (&site=...)!'); // Get Company (fixing whitespace and umlauts) $company = $this->encode_umlauts(strtolower(str_replace(' ', '-', trim($params['company'])))); if(!isset($company) || empty($company)) - $this->returnError('You must specify a company (&company=...)!', 400); + $this->returnClientError('You must specify a company (&company=...)!'); $full = false; // By default we'll load only short article if(isset($params['full'])) @@ -87,7 +87,7 @@ class KununuBridge extends BridgeAbstract{ $section = 'reviews'; break; default: - $this->returnError('The reviews section is not defined for you selection!', 404); + $this->returnServerError('The reviews section is not defined for you selection!'); } // Update URI for the content @@ -96,7 +96,7 @@ class KununuBridge extends BridgeAbstract{ // Load page $html = $this->file_get_html($this->uri); if($html === false) - $this->returnError('Unable to receive data from ' . $this->uri . '!', 404); + $this->returnServerError('Unable to receive data from ' . $this->uri . '!'); // Update name for this request $this->name = $this->extract_company_name($html) . ' - ' . $this->name; @@ -104,12 +104,12 @@ class KununuBridge extends BridgeAbstract{ // Find the section with all the panels (reviews) $section = $html->find('section.kununu-scroll-element', 0); if($section === false) - $this->returnError('Unable to find panel section!', 404); + $this->returnServerError('Unable to find panel section!'); // Find all articles (within the panels) $articles = $section->find('article'); if($articles === false || empty($articles)) - $this->returnError('Unable to find articles!', 404); + $this->returnServerError('Unable to find articles!'); // Go through all articles foreach($articles as $article){ @@ -171,11 +171,11 @@ class KununuBridge extends BridgeAbstract{ private function extract_company_name($html){ $panel = $html->find('div.panel', 0); if($panel === false) - $this->returnError('Cannot find panel for company name!', 404); + $this->returnServerError('Cannot find panel for company name!'); $company_name = $panel->find('h1', 0); if($company_name === false) - $this->returnError('Cannot find company name!', 404); + $this->returnServerError('Cannot find company name!'); return $company_name->plaintext; } @@ -187,7 +187,7 @@ class KununuBridge extends BridgeAbstract{ // They conviniently provide a time attribute for us :) $date = $article->find('time[itemprop=dtreviewed]', 0); if($date === false) - $this->returnError('Cannot find article date!', 404); + $this->returnServerError('Cannot find article date!'); return strtotime($date->datetime); } @@ -198,7 +198,7 @@ class KununuBridge extends BridgeAbstract{ private function extract_article_rating($article){ $rating = $article->find('span.rating', 0); if($rating === false) - $this->returnError('Cannot find article rating!', 404); + $this->returnServerError('Cannot find article rating!'); return $rating->getAttribute('aria-label'); } @@ -209,7 +209,7 @@ class KununuBridge extends BridgeAbstract{ private function extract_article_summary($article){ $summary = $article->find('[itemprop=summary]', 0); if($summary === false) - $this->returnError('Cannot find article summary!', 404); + $this->returnServerError('Cannot find article summary!'); return strip_tags($summary->innertext); } @@ -221,11 +221,11 @@ class KununuBridge extends BridgeAbstract{ // Notice: This first part is the same as in extract_article_summary! $summary = $article->find('[itemprop=summary]', 0); if($summary === false) - $this->returnError('Cannot find article summary!', 404); + $this->returnServerError('Cannot find article summary!'); $anchor = $summary->find('a', 0); if($anchor === false) - $this->returnError('Cannot find article URI!', 404); + $this->returnServerError('Cannot find article URI!'); return 'https://www.kununu.com' . $anchor->href; } @@ -237,7 +237,7 @@ class KununuBridge extends BridgeAbstract{ // We need to parse the aside manually $aside = $article->find('aside', 0); if($aside === false) - $this->returnError('Cannot find article author information!', 404); + $this->returnServerError('Cannot find article author information!'); // Go through all h2 elements to find index of required span (I know... it's stupid) $author_position = 'Unknown'; @@ -257,7 +257,7 @@ class KununuBridge extends BridgeAbstract{ private function extract_article_description($article){ $description = $article->find('div[itemprop=description]', 0); if($description === false) - $this->returnError('Cannot find article description!', 404); + $this->returnServerError('Cannot find article description!'); return $this->fix_url($description->innertext); } @@ -269,12 +269,12 @@ class KununuBridge extends BridgeAbstract{ // Load full article $html = file_get_html($uri); if($html === false) - $this->returnError('Could not load full description!', 404); + $this->returnServerError('Could not load full description!'); // Find the article $article = $html->find('article', 0); if($article === false) - $this->returnError('Cannot find article!', 404); + $this->returnServerError('Cannot find article!'); // Luckily they use the same layout for the review overview and full article pages :) return $this->extract_article_description($article); diff --git a/bridges/LWNprevBridge.php b/bridges/LWNprevBridge.php index 52d7172..f147985 100644 --- a/bridges/LWNprevBridge.php +++ b/bridges/LWNprevBridge.php @@ -12,7 +12,7 @@ class LWNprevBridge extends BridgeAbstract{ $this->name = 'LWN Free Weekly Edition'; $this->uri = 'https://lwn.net/free/bigpage'; $this->description = 'LWN Free Weekly Edition available one week late'; - $this->update = '2016-08-09'; + $this->update = '2016-08-17'; } @@ -53,7 +53,7 @@ class LWNprevBridge extends BridgeAbstract{ } $html=file_get_contents($uri, false, $context) - or $this->returnError('No results for LWNprev', 404); + or $this->returnServerError('No results for LWNprev'); libxml_use_internal_errors(true); $html=DOMDocument::loadHTML($html); diff --git a/bridges/LeBonCoinBridge.php b/bridges/LeBonCoinBridge.php index 98a45be..6072030 100755 --- a/bridges/LeBonCoinBridge.php +++ b/bridges/LeBonCoinBridge.php @@ -7,7 +7,7 @@ class LeBonCoinBridge extends BridgeAbstract{ $this->name = "LeBonCoin"; $this->uri = "http://www.leboncoin.fr"; $this->description = "Returns most recent results from LeBonCoin for a region, and optionally a category and a keyword ."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -239,7 +239,7 @@ class LeBonCoinBridge extends BridgeAbstract{ else { $link = 'http://www.leboncoin.fr/' . $param['c'] . '/offres/' . $param['r'] . '/?f=a&th=1&q=' . urlencode($param['k']); } - $html = $this->file_get_html($link) or $this->returnError('Could not request LeBonCoin.', 404); + $html = $this->file_get_html($link) or $this->returnServerError('Could not request LeBonCoin.'); $list = $html->find('.tabsContent', 0); if($list === NULL) { diff --git a/bridges/LeJournalDuGeekBridge.php b/bridges/LeJournalDuGeekBridge.php index d30853c..24c2685 100644 --- a/bridges/LeJournalDuGeekBridge.php +++ b/bridges/LeJournalDuGeekBridge.php @@ -6,7 +6,7 @@ class LeJournalDuGeekBridge extends BridgeAbstract{ $this->name = "journaldugeek.com (FR)"; $this->uri = "http://www.journaldugeek.com/"; $this->description = "Returns the 5 newest posts from LeJournalDuGeek (full text)."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } private function LeJournalDuGeekStripCDATA($string) { @@ -38,7 +38,7 @@ class LeJournalDuGeekBridge extends BridgeAbstract{ } public function collectData(array $param){ - $rssFeed = $this->file_get_html('http://www.journaldugeek.com/rss') or $this->returnError('Could not request http://www.journaldugeek.com/rss', 404); + $rssFeed = $this->file_get_html('http://www.journaldugeek.com/rss') or $this->returnServerError('Could not request http://www.journaldugeek.com/rss'); $limit = 0; foreach($rssFeed->find('item') as $element) { diff --git a/bridges/LeMondeInformatiqueBridge.php b/bridges/LeMondeInformatiqueBridge.php index 2ee1c42..89914b5 100644 --- a/bridges/LeMondeInformatiqueBridge.php +++ b/bridges/LeMondeInformatiqueBridge.php @@ -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, '') + 6); $article_uri = substr($article_uri, 0, strpos($article_uri, '')); - $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; diff --git a/bridges/LesJoiesDuCodeBridge.php b/bridges/LesJoiesDuCodeBridge.php index ed14be9..ddde42d 100644 --- a/bridges/LesJoiesDuCodeBridge.php +++ b/bridges/LesJoiesDuCodeBridge.php @@ -7,12 +7,12 @@ class LesJoiesDuCodeBridge extends BridgeAbstract{ $this->name = "Les Joies Du Code"; $this->uri = "http://lesjoiesducode.fr/"; $this->description = "LesJoiesDuCode"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } public function collectData(array $param){ - $html = $this->file_get_html('http://lesjoiesducode.fr/') or $this->returnError('Could not request LesJoiesDuCode.', 404); + $html = $this->file_get_html('http://lesjoiesducode.fr/') or $this->returnServerError('Could not request LesJoiesDuCode.'); foreach($html->find('div.blog-post') as $element) { $item = new Item(); diff --git a/bridges/LichessBridge.php b/bridges/LichessBridge.php index 8b49867..8145cf7 100644 --- a/bridges/LichessBridge.php +++ b/bridges/LichessBridge.php @@ -8,12 +8,12 @@ class LichessBridge extends BridgeAbstract $this->name = 'Lichess Blog'; $this->uri = 'http://lichess.org/blog'; $this->description = 'Returns the 5 newest posts from the Lichess blog (full text)'; - $this->update = "2016-08-06"; + $this->update = '2016-08-17'; } public function collectData(array $param) { - $xml_feed = $this->file_get_html('http://fr.lichess.org/blog.atom') or $this->returnError('Could not retrieve Lichess blog feed.', 404); + $xml_feed = $this->file_get_html('http://fr.lichess.org/blog.atom') or $this->returnServerError('Could not retrieve Lichess blog feed.'); $posts_loaded = 0; foreach($xml_feed->find('entry') as $entry) diff --git a/bridges/LinkedInCompany.php b/bridges/LinkedInCompany.php index 97e3643..1f94301 100644 --- a/bridges/LinkedInCompany.php +++ b/bridges/LinkedInCompany.php @@ -7,7 +7,7 @@ class LinkedInCompany extends BridgeAbstract{ $this->name = "LinkedIn Company"; $this->uri = "https://www.linkedin.com/"; $this->description = "Returns most recent actus from Company on LinkedIn. (https://www.linkedin.com/company/apple)"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -22,7 +22,7 @@ class LinkedInCompany extends BridgeAbstract{ $html = ''; $link = 'https://www.linkedin.com/company/'.$param[c]; - $html = $this->file_get_html($link) or $this->returnError('Could not request LinkedIn.', 404); + $html = $this->file_get_html($link) or $this->returnServerError('Could not request LinkedIn.'); foreach($html->find('//*[@id="my-feed-post"]/li') as $element) { $title = $element->find('span.share-body', 0)->innertext; diff --git a/bridges/LolibooruBridge.php b/bridges/LolibooruBridge.php index 3d4745b..3f4cae1 100644 --- a/bridges/LolibooruBridge.php +++ b/bridges/LolibooruBridge.php @@ -7,7 +7,7 @@ class LolibooruBridge extends BridgeAbstract{ $this->name = "Lolibooru"; $this->uri = "http://lolibooru.moe/"; $this->description = "Returns images from given page and tags"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -32,7 +32,7 @@ class LolibooruBridge extends BridgeAbstract{ if (isset($param['t'])) { $tags = urlencode($param['t']); } - $html = $this->file_get_html("http://lolibooru.moe/post?page=$page&tags=$tags") or $this->returnError('Could not request Lolibooru.', 404); + $html = $this->file_get_html("http://lolibooru.moe/post?page=$page&tags=$tags") or $this->returnServerError('Could not request Lolibooru.'); $input_json = explode('Post.register(', $html); foreach($input_json as $element) $data[] = preg_replace('/}\)(.*)/', '}', $element); diff --git a/bridges/MangareaderBridge.php b/bridges/MangareaderBridge.php index 1b8cc48..02fd1b6 100644 --- a/bridges/MangareaderBridge.php +++ b/bridges/MangareaderBridge.php @@ -8,7 +8,7 @@ class MangareaderBridge extends BridgeAbstract{ $this->name = "Mangareader Bridge"; $this->uri = "http://www.mangareader.net"; $this->description = "Returns the latest updates, popular mangas or manga updates (new chapters)"; - $this->update = "2016-08-15"; + $this->update = '2016-08-17'; $this->parameters["Get latest updates"] = '[]'; $this->parameters["Get popular mangas"] = @@ -225,7 +225,7 @@ class MangareaderBridge extends BridgeAbstract{ // We'll use the DOM parser for this as it makes navigation easier $html = file_get_contents("http://www.mangareader.net/" . $path); if(!$html){ - $this->returnError('Could not receive data for ' . $path . '!', 400); + $this->returnClientError('Could not receive data for ' . $path . '!'); } $doc = new DomDocument; @$doc->loadHTML($html); diff --git a/bridges/MilbooruBridge.php b/bridges/MilbooruBridge.php index 59a7b26..3ead724 100644 --- a/bridges/MilbooruBridge.php +++ b/bridges/MilbooruBridge.php @@ -7,7 +7,7 @@ class MilbooruBridge extends BridgeAbstract{ $this->name = "Milbooru"; $this->uri = "http://sheslostcontrol.net/moe/shimmie/"; $this->description = "Returns images from given page"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -31,7 +31,7 @@ class MilbooruBridge extends BridgeAbstract{ if (isset($param['t'])) { $tags = urlencode($param['t']); } - $html = $this->file_get_html("http://sheslostcontrol.net/moe/shimmie/index.php?q=/post/list/$tags/$page") or $this->returnError('Could not request Milbooru.', 404); + $html = $this->file_get_html("http://sheslostcontrol.net/moe/shimmie/index.php?q=/post/list/$tags/$page") or $this->returnServerError('Could not request Milbooru.'); foreach($html->find('div[class=shm-image-list] span[class=thumb]') as $element) { diff --git a/bridges/MondeDiploBridge.php b/bridges/MondeDiploBridge.php index d6d2d3b..d60621c 100644 --- a/bridges/MondeDiploBridge.php +++ b/bridges/MondeDiploBridge.php @@ -6,11 +6,11 @@ class MondeDiploBridge extends BridgeAbstract{ $this->name = 'Monde Diplomatique'; $this->uri = 'http://www.monde-diplomatique.fr'; $this->description = "Returns most recent results from MondeDiplo."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } public function collectData(array $param){ - $html = $this->file_get_html($this->uri) or $this->returnError('Could not request MondeDiplo. for : ' . $link , 404); + $html = $this->file_get_html($this->uri) or $this->returnServerError('Could not request MondeDiplo. for : ' . $link); foreach($html->find('div.unarticle') as $article) { $element = $article->parent(); diff --git a/bridges/MsnMondeBridge.php b/bridges/MsnMondeBridge.php index 03c3eb6..f4419fe 100644 --- a/bridges/MsnMondeBridge.php +++ b/bridges/MsnMondeBridge.php @@ -6,7 +6,7 @@ class MsnMondeBridge extends BridgeAbstract{ $this->name = 'MSN Actu Monde'; $this->uri = 'http://www.msn.com/fr-fr/actualite/monde'; $this->description = "Returns the 10 newest posts from MSN Actualités (full text)"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } private function MsnMondeExtractContent($url, &$item) { @@ -16,7 +16,7 @@ class MsnMondeBridge extends BridgeAbstract{ } public function collectData(array $param){ - $html = $this->file_get_html($this->uri) or $this->returnError('Could not request MsnMonde.', 404); + $html = $this->file_get_html($this->uri) or $this->returnServerError('Could not request MsnMonde.'); $limit = 0; foreach($html->find('.smalla') as $article) { if($limit < 10) { diff --git a/bridges/MspabooruBridge.php b/bridges/MspabooruBridge.php index edd327d..a67d566 100644 --- a/bridges/MspabooruBridge.php +++ b/bridges/MspabooruBridge.php @@ -7,7 +7,7 @@ class MspabooruBridge extends BridgeAbstract{ $this->name = "Mspabooru"; $this->uri = "http://mspabooru.com/"; $this->description = "Returns images from given page"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -34,7 +34,7 @@ class MspabooruBridge extends BridgeAbstract{ if (isset($param['t'])) { $tags = urlencode($param['t']); } - $html = $this->file_get_html("http://mspabooru.com/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnError('Could not request Mspabooru.', 404); + $html = $this->file_get_html("http://mspabooru.com/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Mspabooru.'); foreach($html->find('div[class=content] span') as $element) { diff --git a/bridges/NakedSecurityBridge.php b/bridges/NakedSecurityBridge.php index 5b0eab0..01e46c1 100644 --- a/bridges/NakedSecurityBridge.php +++ b/bridges/NakedSecurityBridge.php @@ -6,7 +6,7 @@ class NakedSecurityBridge extends BridgeAbstract { $this->name = 'Naked Security'; $this->uri = 'https://nakedsecurity.sophos.com/'; $this->description = 'Returns the newest articles.'; - $this->update = '2016-08-09'; + $this->update = '2016-08-17'; } public function collectData(array $param) { @@ -36,7 +36,7 @@ class NakedSecurityBridge extends BridgeAbstract { } $feedUrl = 'https://feeds.feedburner.com/nakedsecurity?format=xml'; - $html = $this->file_get_html($feedUrl) or $this->returnError('Could not request '.$this->getName().': '.$feedUrl, 500); + $html = $this->file_get_html($feedUrl) or $this->returnServerError('Could not request '.$this->getName().': '.$feedUrl); $limit = 0; foreach ($html->find('item') as $element) { @@ -44,7 +44,7 @@ class NakedSecurityBridge extends BridgeAbstract { //Retrieve article Uri and get that page $article_uri = $element->find('guid', 0)->plaintext; - $article_html = $this->file_get_html($article_uri) or $this->returnError('Could not request '.$this->getName().': '.$article_uri, 500); + $article_html = $this->file_get_html($article_uri) or $this->returnServerError('Could not request '.$this->getName().': '.$article_uri); //Build article contents from corresponding elements $article_title = trim($element->find('title', 0)->plaintext); diff --git a/bridges/NasaApodBridge.php b/bridges/NasaApodBridge.php index 3c0f256..8bf7d9b 100644 --- a/bridges/NasaApodBridge.php +++ b/bridges/NasaApodBridge.php @@ -7,13 +7,13 @@ class NasaApodBridge extends BridgeAbstract{ $this->name = "NASA APOD Bridge"; $this->uri = "http://apod.nasa.gov/apod/astropix.html"; $this->description = "Returns the 3 latest NASA APOD pictures and explanations"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } public function collectData(array $param) { - $html = $this->file_get_html('http://apod.nasa.gov/apod/archivepix.html') or $this->returnError('Error while downloading the website content', 404); + $html = $this->file_get_html('http://apod.nasa.gov/apod/archivepix.html') or $this->returnServerError('Error while downloading the website content'); $list = explode("
", $html->find('b', 0)->innertext); for($i = 0; $i < 3;$i++) diff --git a/bridges/NeuviemeArtBridge.php b/bridges/NeuviemeArtBridge.php index d26e6f2..96375ec 100644 --- a/bridges/NeuviemeArtBridge.php +++ b/bridges/NeuviemeArtBridge.php @@ -6,7 +6,7 @@ class NeuviemeArtBridge extends BridgeAbstract { $this->name = '9ème Art Bridge'; $this->uri = "http://www.9emeart.fr/"; $this->description = "Returns the newest articles."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } public function collectData(array $param) { @@ -20,7 +20,7 @@ class NeuviemeArtBridge extends BridgeAbstract { } $feedUrl = 'http://www.9emeart.fr/9emeart.rss'; - $html = $this->file_get_html($feedUrl) or $this->returnError('Could not request 9eme Art: '.$feedUrl, 500); + $html = $this->file_get_html($feedUrl) or $this->returnServerError('Could not request 9eme Art: '.$feedUrl); $limit = 0; foreach ($html->find('item') as $element) { @@ -28,7 +28,7 @@ class NeuviemeArtBridge extends BridgeAbstract { //Retrieve article Uri and get that page $article_uri = $element->find('guid', 0)->plaintext; - $article_html = $this->file_get_html($article_uri) or $this->returnError('Could not request 9eme Art: '.$article_uri, 500); + $article_html = $this->file_get_html($article_uri) or $this->returnServerError('Could not request 9eme Art: '.$article_uri); //Build article contents from corresponding elements $article_title = trim($element->find('title', 0)->plaintext); diff --git a/bridges/NextInpactBridge.php b/bridges/NextInpactBridge.php index 3c8b976..5b121f7 100644 --- a/bridges/NextInpactBridge.php +++ b/bridges/NextInpactBridge.php @@ -6,7 +6,7 @@ class NextInpactBridge extends BridgeAbstract { $this->name = "NextInpact Bridge"; $this->uri = "http://www.nextinpact.com/"; $this->description = "Returns the newest articles."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } private function StripCDATA($string) { @@ -27,7 +27,7 @@ class NextInpactBridge extends BridgeAbstract { } public function collectData(array $param) { - $html = $this->file_get_html('http://www.nextinpact.com/rss/news.xml') or $this->returnError('Could not request NextInpact.', 404); + $html = $this->file_get_html('http://www.nextinpact.com/rss/news.xml') or $this->returnServerError('Could not request NextInpact.'); $limit = 0; foreach($html->find('item') as $element) { diff --git a/bridges/NextgovBridge.php b/bridges/NextgovBridge.php index 1ead4fa..65436b9 100644 --- a/bridges/NextgovBridge.php +++ b/bridges/NextgovBridge.php @@ -7,7 +7,7 @@ class NextgovBridge extends BridgeAbstract { $this->name = 'Nextgov Bridge'; $this->uri = 'https://www.nextgov.com/'; $this->description = 'USA Federal technology news, best practices, and web 2.0 tools.'; - $this->update = '2016-08-09'; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -55,9 +55,9 @@ class NextgovBridge extends BridgeAbstract { if (empty($category)) $category = 'all'; if ($category !== preg_replace('/[^a-z-]+/', '', $category) || strlen($category > 32)) - $this->returnError('Invalid "category" parameter.', 400); + $this->returnClientError('Invalid "category" parameter.'); $url = $this->getURI().'rss/'.$category.'/'; - $html = $this->file_get_html($url) or $this->returnError('Could not request Nextgov: '.$url, 500); + $html = $this->file_get_html($url) or $this->returnServerError('Could not request Nextgov: '.$url); $limit = 0; foreach ($html->find('item') as $element) { @@ -69,7 +69,7 @@ class NextgovBridge extends BridgeAbstract { $article_subtitle = $element->find('description', 0)->plaintext; $article_timestamp = strtotime($element->find('pubDate', 0)->plaintext); $article_thumbnail = ExtractFromDelimiters($element->innertext, 'file_get_html($article_url) or $this->returnError('Could not request Nextgov: '.$article_url, 500); + $article = $this->file_get_html($article_url) or $this->returnServerError('Could not request Nextgov: '.$article_url); $contents = $article->find('div.wysiwyg', 0)->innertext; $contents = StripWithDelimiters($contents, '
', '
'); diff --git a/bridges/NiceMatinBridge.php b/bridges/NiceMatinBridge.php index 0a05d06..5960ffc 100644 --- a/bridges/NiceMatinBridge.php +++ b/bridges/NiceMatinBridge.php @@ -6,17 +6,17 @@ class NiceMatinBridge extends BridgeAbstract{ $this->name = "NiceMatin"; $this->uri = "http://www.nicematin.com/"; $this->description = "Returns the 10 newest posts from NiceMatin (full text)"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } private function NiceMatinExtractContent($url) { $html = $this->file_get_html($url); if(!$html) - $this->returnError('Could not acquire content from url: ' . $url . '!', 404); + $this->returnServerError('Could not acquire content from url: ' . $url . '!'); $content = $html->find('article', 0); if(!$content) - $this->returnError('Could not find \'section\'!', 404); + $this->returnServerError('Could not find \'section\'!'); $text = preg_replace('#(.*?)#is', '', $content->innertext); $text = strip_tags($text, '

'); @@ -24,7 +24,7 @@ class NiceMatinBridge extends BridgeAbstract{ } public function collectData(array $param){ - $html = $this->file_get_html('http://www.nicematin.com/derniere-minute/rss') or $this->returnError('Could not request NiceMatin.', 404); + $html = $this->file_get_html('http://www.nicematin.com/derniere-minute/rss') or $this->returnServerError('Could not request NiceMatin.'); $limit = 0; foreach($html->find('item') as $element) { diff --git a/bridges/NovelUpdatesBridge.php b/bridges/NovelUpdatesBridge.php index e61ebfd..f7dedd1 100644 --- a/bridges/NovelUpdatesBridge.php +++ b/bridges/NovelUpdatesBridge.php @@ -7,7 +7,7 @@ class NovelUpdatesBridge extends BridgeAbstract{ $this->name = "Novel Updates"; $this->uri = "http://www.novelupdates.com/"; $this->description = "Returns releases from Novel Updates"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ { @@ -19,14 +19,14 @@ class NovelUpdatesBridge extends BridgeAbstract{ public function collectData(array $param){ if (!isset($param['n'])) - $this->returnError('You must specify the novel URL (/series/...)', 400); - $thread = parse_url($param['n']) or $this->returnError('This URL seems malformed, please check it.', 400); + $this->returnClientError('You must specify the novel URL (/series/...)'); + $thread = parse_url($param['n']) or $this->returnClientError('This URL seems malformed, please check it.'); if($thread['host'] !== 'www.novelupdates.com') - $this->returnError('NovelUpdates URL only.', 400); + $this->returnClientError('NovelUpdates URL only.'); if(strpos($thread['path'], 'series/') === FALSE) - $this->returnError('You must specify the novel URL.', 400); + $this->returnClientError('You must specify the novel URL.'); $url = 'http://www.novelupdates.com'.$thread['path'].''; - $fullhtml = $this->file_get_html($url) or $this->returnError("Could not request NovelUpdates, novel not found", 404); + $fullhtml = $this->file_get_html($url) or $this->returnServerError("Could not request NovelUpdates, novel not found"); $this->request = $fullhtml->find('h4.seriestitle', 0)->plaintext; // dirty fix for nasty simpledom bug: https://github.com/sebsauvage/rss-bridge/issues/259 // forcefully removes tbody diff --git a/bridges/NumeramaBridge.php b/bridges/NumeramaBridge.php index d6248a6..cc949c2 100644 --- a/bridges/NumeramaBridge.php +++ b/bridges/NumeramaBridge.php @@ -7,7 +7,7 @@ class NumeramaBridge extends BridgeAbstract{ $this->name = 'Numerama'; $this->uri = 'http://www.numerama.com/'; $this->description = 'Returns the 5 newest posts from Numerama (full text)'; - $this->update = '2016-08-09'; + $this->update = '2016-08-17'; } @@ -20,7 +20,7 @@ class NumeramaBridge extends BridgeAbstract{ } $feed = $this->uri.'feed/'; - $html = $this->file_get_html($feed) or $this->returnError('Could not request Numerama: '.$feed, 500); + $html = $this->file_get_html($feed) or $this->returnServerError('Could not request Numerama: '.$feed); $limit = 0; foreach($html->find('item') as $element) { @@ -32,7 +32,7 @@ class NumeramaBridge extends BridgeAbstract{ $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); $article_url = NumeramaStripCDATA($element->find('guid', 0)->plaintext); - $article_html = $this->file_get_html($article_url) or $this->returnError('Could not request Numerama: '.$article_url, 500); + $article_html = $this->file_get_html($article_url) or $this->returnServerError('Could not request Numerama: '.$article_url); $contents = $article_html->find('section[class=related-article]', 0)->innertext = ''; // remove related articles block $contents = ''; // add post picture $contents = $contents.$article_html->find('article[class=post-content]', 0)->innertext; // extract the post diff --git a/bridges/OpenClassroomsBridge.php b/bridges/OpenClassroomsBridge.php index 9371b5c..4a0c3e0 100644 --- a/bridges/OpenClassroomsBridge.php +++ b/bridges/OpenClassroomsBridge.php @@ -7,7 +7,7 @@ class OpenClassroomsBridge extends BridgeAbstract{ $this->name = "OpenClassrooms Bridge"; $this->uri = "https://openclassrooms.com/"; $this->description = "Returns latest tutorials from OpenClassrooms."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = @@ -62,13 +62,13 @@ class OpenClassroomsBridge extends BridgeAbstract{ public function collectData(array $param){ if (empty($param['u'])) { - $this->returnError('Error: You must chose a category.', 404); + $this->returnServerError('Error: You must chose a category.'); } $html = ''; $link = 'https://openclassrooms.com/courses?categories='.$param['u'].'&title=&sort=updatedAt+desc'; - $html = $this->file_get_html($link) or $this->returnError('Could not request OpenClassrooms.', 404); + $html = $this->file_get_html($link) or $this->returnServerError('Could not request OpenClassrooms.'); foreach($html->find('.courseListItem') as $element) { $item = new \Item(); diff --git a/bridges/ParuVenduImmoBridge.php b/bridges/ParuVenduImmoBridge.php index ac9b316..97285a5 100644 --- a/bridges/ParuVenduImmoBridge.php +++ b/bridges/ParuVenduImmoBridge.php @@ -10,7 +10,7 @@ class ParuVenduImmoBridge extends BridgeAbstract $this->name = "Paru Vendu Immobilier"; $this->uri = "http://www.paruvendu.fr"; $this->description = "Returns the ads from the first page of search result."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = @@ -66,7 +66,7 @@ class ParuVenduImmoBridge extends BridgeAbstract $link .= '&lo='.urlencode($param['lo']); } - $html = $this->file_get_html($link) or $this->returnError('Could not request paruvendu.', 404); + $html = $this->file_get_html($link) or $this->returnServerError('Could not request paruvendu.'); foreach($html->find('div.annonce a') as $element) { diff --git a/bridges/PickyWallpapersBridge.php b/bridges/PickyWallpapersBridge.php index 29b116c..2e44cb2 100644 --- a/bridges/PickyWallpapersBridge.php +++ b/bridges/PickyWallpapersBridge.php @@ -11,7 +11,7 @@ class PickyWallpapersBridge extends BridgeAbstract { $this->name = "PickyWallpapers Bridge"; $this->uri = "http://www.pickywallpapers.com/"; $this->description = "Returns the latests wallpapers from PickyWallpapers"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -41,7 +41,7 @@ class PickyWallpapersBridge extends BridgeAbstract { public function collectData(array $param){ $html = ''; if (!isset($param['c'])) { - $this->returnError('You must specify at least a category (?c=...).', 400); + $this->returnClientError('You must specify at least a category (?c=...).'); } else { $baseUri = 'http://www.pickywallpapers.com'; @@ -55,7 +55,7 @@ class PickyWallpapersBridge extends BridgeAbstract { for ($page = 1; $page <= $lastpage; $page++) { $link = $baseUri.'/'.$this->resolution.'/'.$this->category.'/'.(!empty($this->subcategory)?$this->subcategory.'/':'').'page-'.$page.'/'; - $html = $this->file_get_html($link) or $this->returnError('No results for this query.', 404); + $html = $this->file_get_html($link) or $this->returnServerError('No results for this query.'); if ($page === 1) { preg_match('/page-(\d+)\/$/', $html->find('.pages li a', -2)->href, $matches); diff --git a/bridges/PinterestBridge.php b/bridges/PinterestBridge.php index 1a353b1..70b4105 100644 --- a/bridges/PinterestBridge.php +++ b/bridges/PinterestBridge.php @@ -11,7 +11,7 @@ class PinterestBridge extends BridgeAbstract{ $this->name = "Pinterest Bridge"; $this->uri = "http://www.pinterest.com"; $this->description = "Returns the newest images on a board"; - $this->update = "2016-08-06"; + $this->update = '2016-08-17'; $this->parameters["By username and board"] = '[ @@ -41,26 +41,26 @@ class PinterestBridge extends BridgeAbstract{ if (empty($param['u'])) { - $this->returnError('You must specify a Pinterest username (?u=...).', 400); + $this->returnClientError('You must specify a Pinterest username (?u=...).'); } if (empty($param['b'])) { - $this->returnError('You must specify a Pinterest board for this username (?b=...).', 400); + $this->returnClientError('You must specify a Pinterest board for this username (?b=...).'); } $this->username = $param['u']; $this->board = $param['b']; - $html = $this->file_get_html($this->getURI().'/'.urlencode($this->username).'/'.urlencode($this->board)) or $this->returnError('Username and/or board not found', 404); + $html = $this->file_get_html($this->getURI().'/'.urlencode($this->username).'/'.urlencode($this->board)) or $this->returnServerError('Username and/or board not found'); } else if (isset($param['q'])) { $this->query = $param['q']; - $html = $this->file_get_html($this->getURI().'/search/?q='.urlencode($this->query)) or $this->returnError('Could not request Pinterest.', 404); + $html = $this->file_get_html($this->getURI().'/search/?q='.urlencode($this->query)) or $this->returnServerError('Could not request Pinterest.'); } else { - $this->returnError('You must specify a Pinterest username and a board name (?u=...&b=...).', 400); + $this->returnClientError('You must specify a Pinterest username and a board name (?u=...&b=...).'); } diff --git a/bridges/PlanetLibreBridge.php b/bridges/PlanetLibreBridge.php index 53250ea..fc536cd 100644 --- a/bridges/PlanetLibreBridge.php +++ b/bridges/PlanetLibreBridge.php @@ -6,7 +6,7 @@ class PlanetLibreBridge extends BridgeAbstract{ $this->name = "PlanetLibre"; $this->uri = "http://www.planet-libre.org"; $this->description = "Returns the 5 newest posts from PlanetLibre (full text)"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } private function PlanetLibreExtractContent($url){ @@ -16,7 +16,7 @@ class PlanetLibreBridge extends BridgeAbstract{ } public function collectData(array $param){ - $html = $this->file_get_html('http://www.planet-libre.org/') or $this->returnError('Could not request PlanetLibre.', 404); + $html = $this->file_get_html('http://www.planet-libre.org/') or $this->returnServerError('Could not request PlanetLibre.'); $limit = 0; foreach($html->find('div.post') as $element) { if($limit < 5) { diff --git a/bridges/ProjectMGameBridge.php b/bridges/ProjectMGameBridge.php index 19c2e61..865b38d 100644 --- a/bridges/ProjectMGameBridge.php +++ b/bridges/ProjectMGameBridge.php @@ -7,14 +7,14 @@ class ProjectMGameBridge extends BridgeAbstract{ $this->name = "Project M Game Bridge"; $this->uri = "http://projectmgame.com/en/"; $this->description = "Returns the newest articles."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } public function collectData(array $param){ $html = ''; - $html = $this->file_get_html('http://projectmgame.com/en/') or $this->returnError('Error while downloading the Project M homepage', 404); + $html = $this->file_get_html('http://projectmgame.com/en/') or $this->returnServerError('Error while downloading the Project M homepage'); foreach($html->find('article') as $article) { $item = new \Item(); diff --git a/bridges/RTBFBridge.php b/bridges/RTBFBridge.php index 5f6f340..433792e 100644 --- a/bridges/RTBFBridge.php +++ b/bridges/RTBFBridge.php @@ -5,7 +5,7 @@ class RTBFBridge extends BridgeAbstract { $this->uri = "http://www.rtbf.be/auvio/emissions"; $this->description = "Returns the newest RTBF videos by series ID"; $this->maintainer = "Frenzie"; - $this->update = "2016-08-15"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -25,7 +25,7 @@ class RTBFBridge extends BridgeAbstract { $count = 0; if (isset($param['c'])) { - $html = $this->file_get_html('http://www.rtbf.be/auvio/emissions/detail?id='.$param['c']) or $this->returnError('Could not request RTBF.', 404); + $html = $this->file_get_html('http://www.rtbf.be/auvio/emissions/detail?id='.$param['c']) or $this->returnServerError('Could not request RTBF.'); foreach($html->find('section[id!=widget-ml-avoiraussi-] .rtbf-media-grid article') as $element) { if($count < $limit) { @@ -44,7 +44,7 @@ class RTBFBridge extends BridgeAbstract { } } else { - $this->returnError('You must specify a series id.', 400); + $this->returnClientError('You must specify a series id.'); } } diff --git a/bridges/Releases3DSBridge.php b/bridges/Releases3DSBridge.php index 3c5c74e..8031582 100644 --- a/bridges/Releases3DSBridge.php +++ b/bridges/Releases3DSBridge.php @@ -7,7 +7,7 @@ class Releases3DSBridge extends BridgeAbstract { $this->name = "3DS Scene Releases"; $this->uri = "http://www.3dsdb.com/"; $this->description = "Returns the newest scene releases."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } @@ -38,7 +38,7 @@ class Releases3DSBridge extends BridgeAbstract { } $dataUrl = 'http://3dsdb.com/xml.php'; - $xml = file_get_contents($dataUrl) or $this->returnError('Could not request 3dsdb: '.$dataUrl, 500); + $xml = file_get_contents($dataUrl) or $this->returnServerError('Could not request 3dsdb: '.$dataUrl); $limit = 0; foreach (array_reverse(explode('', $xml)) as $element) { diff --git a/bridges/ReporterreBridge.php b/bridges/ReporterreBridge.php index 387316e..8c1f553 100644 --- a/bridges/ReporterreBridge.php +++ b/bridges/ReporterreBridge.php @@ -6,7 +6,7 @@ class ReporterreBridge extends BridgeAbstract{ $this->name = "Reporterre Bridge"; $this->uri = "http://www.reporterre.net/"; $this->description = "Returns the newest articles."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } private function ExtractContentReporterre($url) { @@ -27,7 +27,7 @@ class ReporterreBridge extends BridgeAbstract{ } public function collectData(array $param){ - $html = $this->file_get_html('http://www.reporterre.net/spip.php?page=backend') or $this->returnError('Could not request Reporterre.', 404); + $html = $this->file_get_html('http://www.reporterre.net/spip.php?page=backend') or $this->returnServerError('Could not request Reporterre.'); $limit = 0; foreach($html->find('item') as $element) { diff --git a/bridges/Rue89Bridge.php b/bridges/Rue89Bridge.php index ae407d3..54c86d4 100644 --- a/bridges/Rue89Bridge.php +++ b/bridges/Rue89Bridge.php @@ -7,7 +7,7 @@ class Rue89Bridge extends BridgeAbstract{ $this->name = "Rue89"; $this->uri = "http://rue89.nouvelobs.com/"; $this->description = "Returns the 5 newest posts from Rue89 (full text)"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } @@ -22,7 +22,7 @@ class Rue89Bridge extends BridgeAbstract{ public function collectData(array $param){ - $html = $this->file_get_html('http://api.rue89.nouvelobs.com/feed') or $this->returnError('Could not request Rue89.', 404); + $html = $this->file_get_html('http://api.rue89.nouvelobs.com/feed') or $this->returnServerError('Could not request Rue89.'); $limit = 0; foreach($html->find('item') as $element) { diff --git a/bridges/Rule34Bridge.php b/bridges/Rule34Bridge.php index 3b22d43..b868d91 100644 --- a/bridges/Rule34Bridge.php +++ b/bridges/Rule34Bridge.php @@ -7,7 +7,7 @@ class Rule34Bridge extends BridgeAbstract{ $this->name = "Rule34"; $this->uri = "http://rule34.xxx/"; $this->description = "Returns images from given page"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -33,7 +33,7 @@ class Rule34Bridge extends BridgeAbstract{ if (isset($param['t'])) { $tags = urlencode($param['t']); } - $html = $this->file_get_html("http://rule34.xxx/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnError('Could not request Rule34.', 404); + $html = $this->file_get_html("http://rule34.xxx/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Rule34.'); foreach($html->find('div[class=content] span') as $element) { diff --git a/bridges/Rule34pahealBridge.php b/bridges/Rule34pahealBridge.php index e6e135e..77b0319 100644 --- a/bridges/Rule34pahealBridge.php +++ b/bridges/Rule34pahealBridge.php @@ -7,7 +7,7 @@ class Rule34pahealBridge extends BridgeAbstract{ $this->name = "Rule34paheal"; $this->uri = "http://rule34.paheal.net/"; $this->description = "Returns images from given page"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -32,7 +32,7 @@ class Rule34pahealBridge extends BridgeAbstract{ if (isset($param['t'])) { $tags = urlencode($param['t']); } - $html = $this->file_get_html("http://rule34.paheal.net/post/list/$tags/$page") or $this->returnError('Could not request Rule34paheal.', 404); + $html = $this->file_get_html("http://rule34.paheal.net/post/list/$tags/$page") or $this->returnServerError('Could not request Rule34paheal.'); foreach($html->find('div[class=shm-image-list] div[class=shm-thumb]') as $element) { diff --git a/bridges/SafebooruBridge.php b/bridges/SafebooruBridge.php index 42272f8..cd0f1a3 100644 --- a/bridges/SafebooruBridge.php +++ b/bridges/SafebooruBridge.php @@ -7,7 +7,7 @@ class SafebooruBridge extends BridgeAbstract{ $this->name = "Safebooru"; $this->uri = "http://safebooru.org/"; $this->description = "Returns images from given page"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -34,7 +34,7 @@ class SafebooruBridge extends BridgeAbstract{ if (isset($param['t'])) { $tags = urlencode($param['t']); } - $html = $this->file_get_html("http://safebooru.org/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnError('Could not request Safebooru.', 404); + $html = $this->file_get_html("http://safebooru.org/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Safebooru.'); foreach($html->find('div[class=content] span') as $element) { diff --git a/bridges/SakugabooruBridge.php b/bridges/SakugabooruBridge.php index 5e6e529..8e7e3aa 100644 --- a/bridges/SakugabooruBridge.php +++ b/bridges/SakugabooruBridge.php @@ -7,7 +7,7 @@ class SakugabooruBridge extends BridgeAbstract{ $this->name = "Sakugabooru"; $this->uri = "http://sakuga.yshi.org/"; $this->description = "Returns images from given page"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -31,7 +31,7 @@ class SakugabooruBridge extends BridgeAbstract{ if (isset($param['t'])) { $tags = urlencode($param['t']); } - $html = $this->file_get_html("http://sakuga.yshi.org/post?page=$page&tags=$tags") or $this->returnError('Could not request Sakugabooru.', 404); + $html = $this->file_get_html("http://sakuga.yshi.org/post?page=$page&tags=$tags") or $this->returnServerError('Could not request Sakugabooru.'); $input_json = explode('Post.register(', $html); foreach($input_json as $element) $data[] = preg_replace('/}\)(.*)/', '}', $element); diff --git a/bridges/ScmbBridge.php b/bridges/ScmbBridge.php index 95bd544..864d39c 100644 --- a/bridges/ScmbBridge.php +++ b/bridges/ScmbBridge.php @@ -7,13 +7,13 @@ class ScmbBridge extends BridgeAbstract{ $this->name = "Se Coucher Moins Bête Bridge"; $this->uri = "http://secouchermoinsbete.fr/"; $this->description = "Returns the newest anecdotes."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } public function collectData(array $param){ $html = ''; - $html = $this->file_get_html('http://secouchermoinsbete.fr/') or $this->returnError('Could not request Se Coucher Moins Bete.', 404); + $html = $this->file_get_html('http://secouchermoinsbete.fr/') or $this->returnServerError('Could not request Se Coucher Moins Bete.'); foreach($html->find('article') as $article) { $item = new \Item(); diff --git a/bridges/ScoopItBridge.php b/bridges/ScoopItBridge.php index 449f8d1..ba3fc0b 100644 --- a/bridges/ScoopItBridge.php +++ b/bridges/ScoopItBridge.php @@ -7,7 +7,7 @@ class ScoopItBridge extends BridgeAbstract{ $this->name = "ScoopIt"; $this->uri = "http://www.scoop.it"; $this->description = "Returns most recent results from ScoopIt."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -25,7 +25,7 @@ class ScoopItBridge extends BridgeAbstract{ $this->request = $param['u']; $link = 'http://scoop.it/search?q=' .urlencode($this->request); - $html = $this->file_get_html($link) or $this->returnError('Could not request ScoopIt. for : ' . $link , 404); + $html = $this->file_get_html($link) or $this->returnServerError('Could not request ScoopIt. for : ' . $link); foreach($html->find('div.post-view') as $element) { $item = new Item(); @@ -35,7 +35,7 @@ class ScoopItBridge extends BridgeAbstract{ $this->items[] = $item; } } else { - $this->returnError('You must specify a keyword', 404); + $this->returnServerError('You must specify a keyword'); } } diff --git a/bridges/SensCritiqueBridge.php b/bridges/SensCritiqueBridge.php index 1b7a95e..945dd00 100644 --- a/bridges/SensCritiqueBridge.php +++ b/bridges/SensCritiqueBridge.php @@ -8,7 +8,7 @@ class SensCritiqueBridge extends BridgeAbstract { $this->name = "Sens Critique"; $this->uri = "http://www.senscritique.com"; $this->description = "Sens Critique news"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -59,13 +59,13 @@ class SensCritiqueBridge extends BridgeAbstract { } else if ((isset($param['mu']) && $param['mu'])) { $this->collectMusicsData(); } else { - $this->returnError('You must choose a category', 400); + $this->returnClientError('You must choose a category'); } } private function collectMoviesData() { $html = ''; - $html = $this->file_get_html('http://www.senscritique.com/films/cette-semaine') or $this->returnError('No results for this query.', 404); + $html = $this->file_get_html('http://www.senscritique.com/films/cette-semaine') or $this->returnServerError('No results for this query.'); $list = $html->find('ul.elpr-list', 0); $this->extractDataFromList($list); @@ -73,7 +73,7 @@ class SensCritiqueBridge extends BridgeAbstract { private function collectSeriesData() { $html = ''; - $html = $this->file_get_html('http://www.senscritique.com/series/actualite') or $this->returnError('No results for this query.', 404); + $html = $this->file_get_html('http://www.senscritique.com/series/actualite') or $this->returnServerError('No results for this query.'); $list = $html->find('ul.elpr-list', 0); $this->extractDataFromList($list); @@ -81,7 +81,7 @@ class SensCritiqueBridge extends BridgeAbstract { private function collectGamesData() { $html = ''; - $html = $this->file_get_html('http://www.senscritique.com/jeuxvideo/actualite') or $this->returnError('No results for this query.', 404); + $html = $this->file_get_html('http://www.senscritique.com/jeuxvideo/actualite') or $this->returnServerError('No results for this query.'); $list = $html->find('ul.elpr-list', 0); $this->extractDataFromList($list); @@ -89,7 +89,7 @@ class SensCritiqueBridge extends BridgeAbstract { private function collectBooksData() { $html = ''; - $html = $this->file_get_html('http://www.senscritique.com/livres/actualite') or $this->returnError('No results for this query.', 404); + $html = $this->file_get_html('http://www.senscritique.com/livres/actualite') or $this->returnServerError('No results for this query.'); $list = $html->find('ul.elpr-list', 0); $this->extractDataFromList($list); @@ -97,7 +97,7 @@ class SensCritiqueBridge extends BridgeAbstract { private function collectBDsData() { $html = ''; - $html = $this->file_get_html('http://www.senscritique.com/bd/actualite') or $this->returnError('No results for this query.', 404); + $html = $this->file_get_html('http://www.senscritique.com/bd/actualite') or $this->returnServerError('No results for this query.'); $list = $html->find('ul.elpr-list', 0); $this->extractDataFromList($list); @@ -105,7 +105,7 @@ class SensCritiqueBridge extends BridgeAbstract { private function collectMusicsData() { $html = ''; - $html = $this->file_get_html('http://www.senscritique.com/musique/actualite') or $this->returnError('No results for this query.', 404); + $html = $this->file_get_html('http://www.senscritique.com/musique/actualite') or $this->returnServerError('No results for this query.'); $list = $html->find('ul.elpr-list', 0); $this->extractDataFromList($list); @@ -113,7 +113,7 @@ class SensCritiqueBridge extends BridgeAbstract { private function extractDataFromList($list) { if ($list === null) { - $this->returnError('Cannot extract data from list', 400); + $this->returnClientError('Cannot extract data from list'); } foreach ($list->find('li') as $movie) { diff --git a/bridges/Sexactu.php b/bridges/Sexactu.php index d9f70c4..9bb82c9 100644 --- a/bridges/Sexactu.php +++ b/bridges/Sexactu.php @@ -7,7 +7,7 @@ class Sexactu extends BridgeAbstract{ $this->name = "Sexactu"; $this->uri = "http://www.gqmagazine.fr"; $this->description = "Sexactu via rss-bridge"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } @@ -15,7 +15,7 @@ class Sexactu extends BridgeAbstract{ $find = array('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'novembre', 'décembre'); $replace = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); - $html = $this->file_get_html($this->getURI()) or $this->returnError('Could not request '.$this->getURI(), 404); + $html = $this->file_get_html($this->getURI()) or $this->returnServerError('Could not request '.$this->getURI()); foreach($html->find('.content-holder') as $contentHolder) { // only use first list as second one only contains pages numbers diff --git a/bridges/ShanaprojectBridge.php b/bridges/ShanaprojectBridge.php index 7d340ce..b9356a5 100644 --- a/bridges/ShanaprojectBridge.php +++ b/bridges/ShanaprojectBridge.php @@ -5,7 +5,7 @@ class ShanaprojectBridge extends BridgeAbstract { $this->name = 'Shanaproject Bridge'; $this->uri = 'http://www.shanaproject.com'; $this->description = 'Returns a list of anime from the current Season Anime List'; - $this->update = '2016-08-06'; + $this->update = '2016-08-17'; } // Returns an html object for the Season Anime List (latest season) @@ -13,15 +13,15 @@ class ShanaprojectBridge extends BridgeAbstract { // First we need to find the URI to the latest season from the 'seasons' page searching for 'Season Anime List' $html = $this->file_get_html($this->getURI() . '/seasons'); if(!$html) - $this->returnError('Could not load \'seasons\' page!', 404); + $this->returnServerError('Could not load \'seasons\' page!'); $season = $html->find('div.follows_menu/a', 1); if(!$season) - $this->returnError('Could not find \'Season Anime List\'!', 404); + $this->returnServerError('Could not find \'Season Anime List\'!'); $html = $this->file_get_html($this->getURI() . $season->href); if(!$html) - $this->returnError('Could not load \'Season Anime List\' from \'' . $season->innertext . '\'!'); + $this->returnServerError('Could not load \'Season Anime List\' from \'' . $season->innertext . '\'!'); return $html; } @@ -30,7 +30,7 @@ class ShanaprojectBridge extends BridgeAbstract { private function ExtractAnimeTitle($anime){ $title = $anime->find('a', 0); if(!$title) - $this->returnError('Could not find anime title!', 404); + $this->returnServerError('Could not find anime title!'); return trim($title->innertext); } @@ -38,7 +38,7 @@ class ShanaprojectBridge extends BridgeAbstract { private function ExtractAnimeURI($anime){ $uri = $anime->find('a', 0); if(!$uri) - $this->returnError('Could not find anime URI!', 404); + $this->returnServerError('Could not find anime URI!'); return $this->getURI() . $uri->href; } @@ -46,7 +46,7 @@ class ShanaprojectBridge extends BridgeAbstract { private function ExtractAnimeTimestamp($anime){ $timestamp = $anime->find('span.header_info_block', 1); if(!$timestamp) - $this->returnError('Could not find anime timestamp!', 404); + $this->returnServerError('Could not find anime timestamp!'); return strtotime($timestamp->innertext); } @@ -62,7 +62,7 @@ class ShanaprojectBridge extends BridgeAbstract { private function ExtractAnimeEpisodeInformation($anime){ $episode = $anime->find('div.header_info_episode', 0); if(!$episode) - $this->returnError('Could not find anime episode information!', 404); + $this->returnServerError('Could not find anime episode information!'); return preg_replace('/\r|\n/', ' ', $episode->plaintext); } @@ -74,7 +74,7 @@ class ShanaprojectBridge extends BridgeAbstract { if(preg_match("/url\(\/\/([^\)]+)\)/i", $anime->parent->style, $matches)) return $matches[1]; - $this->returnError('Could not extract background image!', 404); + $this->returnServerError('Could not extract background image!'); } // Builds an URI to search for a specific anime (subber is left empty) @@ -97,7 +97,7 @@ class ShanaprojectBridge extends BridgeAbstract { $animes = $html->find('div.header_display_box_info'); if(!$animes) - $this->returnError('Could not find anime headers!', 404); + $this->returnServerError('Could not find anime headers!'); foreach($animes as $anime){ $item = new \Item(); diff --git a/bridges/SiliconBridge.php b/bridges/SiliconBridge.php index 0805e8d..df582bb 100644 --- a/bridges/SiliconBridge.php +++ b/bridges/SiliconBridge.php @@ -7,7 +7,7 @@ class SiliconBridge extends BridgeAbstract { $this->name = 'Silicon Bridge'; $this->uri = 'http://www.silicon.fr/'; $this->description = "Returns the newest articles."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } @@ -20,7 +20,7 @@ class SiliconBridge extends BridgeAbstract { } $feedUrl = 'http://www.silicon.fr/feed'; - $html = $this->file_get_html($feedUrl) or $this->returnError('Could not request Silicon: '.$feedUrl, 500); + $html = $this->file_get_html($feedUrl) or $this->returnServerError('Could not request Silicon: '.$feedUrl); $limit = 0; foreach($html->find('item') as $element) { @@ -30,7 +30,7 @@ class SiliconBridge extends BridgeAbstract { $article_uri = $element->innertext; $article_uri = substr($article_uri, strpos($article_uri, '') + 6); $article_uri = substr($article_uri, 0, strpos($article_uri, '')); - $article_html = $this->file_get_html($article_uri) or $this->returnError('Could not request Silicon: '.$article_uri, 500); + $article_html = $this->file_get_html($article_uri) or $this->returnServerError('Could not request Silicon: '.$article_uri); //Build article contents from corresponding elements $thumbnailUri = $element->find('enclosure', 0)->url; diff --git a/bridges/SoundcloudBridge.php b/bridges/SoundcloudBridge.php index 40836d5..dc987c1 100644 --- a/bridges/SoundcloudBridge.php +++ b/bridges/SoundcloudBridge.php @@ -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++) { diff --git a/bridges/StripeAPIChangeLogBridge.php b/bridges/StripeAPIChangeLogBridge.php index 32945a1..4a4c5bb 100644 --- a/bridges/StripeAPIChangeLogBridge.php +++ b/bridges/StripeAPIChangeLogBridge.php @@ -12,12 +12,12 @@ class StripeAPIChangeLogBridge extends BridgeAbstract{ $this->name = 'Stripe API Changelog'; $this->uri = 'https://stripe.com/docs/upgrades'; $this->description = 'Returns the changes made to the stripe.com API'; - $this->update = '2016-08-09'; + $this->update = '2016-08-17'; } public function collectData(array $param){ $html = file_get_html('https://stripe.com/docs/upgrades') - or $this->returnError('No results for Stripe API Changelog', 404); + or $this->returnServerError('No results for Stripe API Changelog'); foreach($html->find('h2') as $change){ diff --git a/bridges/SuperbWallpapersBridge.php b/bridges/SuperbWallpapersBridge.php index 2d21cfa..36928be 100644 --- a/bridges/SuperbWallpapersBridge.php +++ b/bridges/SuperbWallpapersBridge.php @@ -10,7 +10,7 @@ class SuperbWallpapersBridge extends BridgeAbstract { $this->name = "Superb Wallpapers Bridge"; $this->uri = "http://www.superbwallpapers.com/"; $this->description = "Returns the latests wallpapers from SuperbWallpapers"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -52,7 +52,7 @@ class SuperbWallpapersBridge extends BridgeAbstract { for ($page = 1; $page <= $lastpage; $page++) { $link = $baseUri.'/'.$this->category.'/'.$page.'.html'; - $html = $this->file_get_html($link) or $this->returnError('No results for this query.', 404); + $html = $this->file_get_html($link) or $this->returnServerError('No results for this query.'); foreach($html->find('.wpl .i a') as $element) { $thumbnail = $element->find('img', 0); diff --git a/bridges/T411Bridge.php b/bridges/T411Bridge.php index 0238f33..22f02c8 100644 --- a/bridges/T411Bridge.php +++ b/bridges/T411Bridge.php @@ -7,7 +7,7 @@ class T411Bridge extends BridgeAbstract { $this->name = 'T411 Bridge'; $this->uri = 'https://t411.ch/'; $this->description = 'Returns the 10 newest torrents with specified search terms
Use url part after "?" mark when using their search engine.'; - $this->update = '2016-08-09'; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -31,15 +31,15 @@ class T411Bridge extends BridgeAbstract { //Ensure proper parameters have been provided if (empty($param['search'])) { - $this->returnError('You must specify a search criteria', 400); + $this->returnClientError('You must specify a search criteria'); } //Retrieve torrent listing from search results, which does not contain torrent description $url = $this->uri.'torrents/search/?'.$param['search'].'&order=added&type=desc'; - $html = $this->file_get_html($url) or $this->returnError('Could not request t411: '.$url, 500); + $html = $this->file_get_html($url) or $this->returnServerError('Could not request t411: '.$url); $results = $html->find('table.results', 0); if (is_null($results)) - $this->returnError('No results from t411: '.$url, 500); + $this->returnServerError('No results from t411: '.$url); $limit = 0; //Process each item individually diff --git a/bridges/TagBoardBridge.php b/bridges/TagBoardBridge.php index b2a94ea..7382a52 100644 --- a/bridges/TagBoardBridge.php +++ b/bridges/TagBoardBridge.php @@ -7,7 +7,7 @@ class TagBoardBridge extends BridgeAbstract{ $this->name = "TagBoard"; $this->uri = "http://www.TagBoard.com"; $this->description = "Returns most recent results from TagBoard."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -24,7 +24,7 @@ class TagBoardBridge extends BridgeAbstract{ $this->request = $param['u']; $link = 'https://post-cache.tagboard.com/search/' .$this->request; - $html = $this->file_get_html($link) or $this->returnError('Could not request TagBoard for : ' . $link , 404); + $html = $this->file_get_html($link) or $this->returnServerError('Could not request TagBoard for : ' . $link); $parsed_json = json_decode($html); foreach($parsed_json->{'posts'} as $element) { diff --git a/bridges/TbibBridge.php b/bridges/TbibBridge.php index e624c69..aeacdd6 100644 --- a/bridges/TbibBridge.php +++ b/bridges/TbibBridge.php @@ -7,7 +7,7 @@ class TbibBridge extends BridgeAbstract{ $this->name = "Tbib"; $this->uri = "http://tbib.org/"; $this->description = "Returns images from given page"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -33,7 +33,7 @@ class TbibBridge extends BridgeAbstract{ if (isset($param['t'])) { $tags = urlencode($param['t']); } - $html = $this->file_get_html("http://tbib.org/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnError('Could not request Tbib.', 404); + $html = $this->file_get_html("http://tbib.org/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Tbib.'); foreach($html->find('div[class=content] span') as $element) { diff --git a/bridges/TheCodingLoveBridge.php b/bridges/TheCodingLoveBridge.php index e2ff360..b8ca7c5 100644 --- a/bridges/TheCodingLoveBridge.php +++ b/bridges/TheCodingLoveBridge.php @@ -7,12 +7,12 @@ class TheCodingLoveBridge extends BridgeAbstract{ $this->name = "The Coding Love"; $this->uri = "http://thecodinglove.com/"; $this->description = "The Coding Love"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } public function collectData(array $param){ - $html = $this->file_get_html('http://thecodinglove.com/') or $this->returnError('Could not request The Coding Love.', 404); + $html = $this->file_get_html('http://thecodinglove.com/') or $this->returnServerError('Could not request The Coding Love.'); foreach($html->find('div.post') as $element) { $item = new Item(); diff --git a/bridges/TheHackerNewsBridge.php b/bridges/TheHackerNewsBridge.php index ab43fad..ebb8379 100644 --- a/bridges/TheHackerNewsBridge.php +++ b/bridges/TheHackerNewsBridge.php @@ -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', '

name = "The Pirate Bay"; $this->uri = "https://thepiratebay.org/"; $this->description = "Returns results for the keywords. You can put several list of keywords by separating them with a semicolon (e.g. \"one show;another show\")"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -56,14 +56,14 @@ class ThePirateBayBridge extends BridgeAbstract{ if (!isset($param['q'])) - $this->returnError('You must specify keywords (?q=...)', 400); + $this->returnClientError('You must specify keywords (?q=...)'); $keywordsList = explode(";",$param['q']); foreach($keywordsList as $keywords){ - $html = $this->file_get_html('https://thepiratebay.org/search/'.rawurlencode($keywords).'/0/3/0') or $this->returnError('Could not request TPB.', 404); + $html = $this->file_get_html('https://thepiratebay.org/search/'.rawurlencode($keywords).'/0/3/0') or $this->returnServerError('Could not request TPB.'); if ($html->find('table#searchResult', 0) == FALSE) - $this->returnError('No result for query '.$keywords, 404); + $this->returnServerError('No result for query '.$keywords); foreach($html->find('tr') as $element) { diff --git a/bridges/TwitchApiBridge.php b/bridges/TwitchApiBridge.php index 789324a..21f6a2a 100644 --- a/bridges/TwitchApiBridge.php +++ b/bridges/TwitchApiBridge.php @@ -13,7 +13,7 @@ class TwitchApiBridge extends BridgeAbstract{ $this->name = "Twitch API Bridge"; $this->uri = "http://www.twitch.tv"; $this->description = "Returns the newest broadcasts or highlights by channel name using the Twitch API (v3)"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters["Get channel without limit"] = '[ @@ -89,7 +89,7 @@ class TwitchApiBridge extends BridgeAbstract{ if(isset($param['channel'])) { $channel = $param['channel']; } else { - $this->returnError('You must specify a valid channel name! Received: &channel=' . $param['channel'], 400); + $this->returnClientError('You must specify a valid channel name! Received: &channel=' . $param['channel']); } $this->channel = $channel; @@ -98,7 +98,7 @@ class TwitchApiBridge extends BridgeAbstract{ try { $limit = (int)$param['limit']; } catch (Exception $e){ - $this->returnError('The limit you specified is not valid! Received: &limit=' . $param['limit'] . ' Expected: &limit= where is any integer number.', 400); + $this->returnClientError('The limit you specified is not valid! Received: &limit=' . $param['limit'] . ' Expected: &limit= where is any integer number.'); } } else { $limit = TWITCH_LIMIT; @@ -114,7 +114,7 @@ class TwitchApiBridge extends BridgeAbstract{ if(isset($param['broadcasts']) && ($param['broadcasts'] == 'true' || $param['broadcasts'] == 'false')) { $broadcasts = $param['broadcasts']; } else { - $this->returnError('The value for broadcasts you specified is not valid! Received: &broadcasts=' . $param['broadcasts'] . ' Expected: &broadcasts=false or &broadcasts=true', 400); + $this->returnClientError('The value for broadcasts you specified is not valid! Received: &broadcasts=' . $param['broadcasts'] . ' Expected: &broadcasts=false or &broadcasts=true'); } // Build the initial request, see also: https://github.com/justintv/Twitch-API/blob/master/v3_resources/videos.md#get-channelschannelvideos @@ -131,7 +131,7 @@ class TwitchApiBridge extends BridgeAbstract{ $response = file_get_contents($request, false, $context); if($response == false) { - $this->returnError('Request failed! Check if the channel name is valid!', 400); + $this->returnServerError('Request failed! Check if the channel name is valid!'); } $data = json_decode($response); diff --git a/bridges/TwitterBridge.php b/bridges/TwitterBridge.php index 585589d..24970ca 100644 --- a/bridges/TwitterBridge.php +++ b/bridges/TwitterBridge.php @@ -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; diff --git a/bridges/UnsplashBridge.php b/bridges/UnsplashBridge.php index ccbf2a2..adf7544 100644 --- a/bridges/UnsplashBridge.php +++ b/bridges/UnsplashBridge.php @@ -7,7 +7,7 @@ class UnsplashBridge extends BridgeAbstract { $this->name = "Unsplash Bridge"; $this->uri = "http://unsplash.com/"; $this->description = "Returns the latests photos from Unsplash"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -44,7 +44,7 @@ class UnsplashBridge extends BridgeAbstract { for ($page = 1; $page <= $lastpage; $page++) { $link = $baseUri.'/grid?page='.$page; - $html = $this->file_get_html($link) or $this->returnError('No results for this query.', 404); + $html = $this->file_get_html($link) or $this->returnServerError('No results for this query.'); if ($page === 1) { preg_match('/=(\d+)$/', $html->find('.pagination > a[!class]', -1)->href, $matches); diff --git a/bridges/ViadeoCompany.php b/bridges/ViadeoCompany.php index eee7a24..fb4badb 100644 --- a/bridges/ViadeoCompany.php +++ b/bridges/ViadeoCompany.php @@ -7,7 +7,7 @@ class ViadeoCompany extends BridgeAbstract{ $this->name = "Viadeo Company"; $this->uri = "https://www.viadeo.com/"; $this->description = "Returns most recent actus from Company on Viadeo. (http://www.viadeo.com/fr/company/apple)"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -22,7 +22,7 @@ class ViadeoCompany extends BridgeAbstract{ $html = ''; $link = 'http://www.viadeo.com/fr/company/'.$param[c]; - $html = $this->file_get_html($link) or $this->returnError('Could not request Viadeo.', 404); + $html = $this->file_get_html($link) or $this->returnServerError('Could not request Viadeo.'); foreach($html->find('//*[@id="company-newsfeed"]/ul/li') as $element) { $title = $element->find('p', 0)->innertext; diff --git a/bridges/VineBridge.php b/bridges/VineBridge.php index 03a9383..b871444 100644 --- a/bridges/VineBridge.php +++ b/bridges/VineBridge.php @@ -7,7 +7,7 @@ class VineBridge extends BridgeAbstract { $this->name = "Vine bridge"; $this->uri = "http://vine.co/"; $this->description = "Returns the latests vines from vine user page"; - $this->update = "2016-08-15"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -24,7 +24,7 @@ class VineBridge extends BridgeAbstract { $html = ''; $uri = 'http://vine.co/u/'.$param['u'].'?mode=list'; - $html = $this->file_get_html($uri) or $this->returnError('No results for this query.', 404); + $html = $this->file_get_html($uri) or $this->returnServerError('No results for this query.'); foreach($html->find('.post') as $element) { $a = $element->find('a', 0); diff --git a/bridges/VkBridge.php b/bridges/VkBridge.php index 7f5b4ff..9849a40 100644 --- a/bridges/VkBridge.php +++ b/bridges/VkBridge.php @@ -9,7 +9,7 @@ class VkBridge extends BridgeAbstract { $this->name = "VK.com"; $this->uri = "http://www.vk.com/"; $this->description = "Working with open pages"; - $this->update = "2016-08-06"; + $this->update = '2016-08-17'; $this->parameters["Url on page group or user"] = '[ { "name" : "Url", @@ -22,7 +22,7 @@ class VkBridge extends BridgeAbstract { $html = ''; if (isset($param['u'])) { $this->request = $param['u']; - $text_html = file_get_contents(urldecode($this->request)) or $this->returnError('No results for this query.', 404); + $text_html = file_get_contents(urldecode($this->request)) or $this->returnServerError('No results for this query.'); $text_html = iconv('windows-1251', 'utf-8', $text_html); $html = str_get_html($text_html); } diff --git a/bridges/WallpaperStopBridge.php b/bridges/WallpaperStopBridge.php index 7a70ef2..1888333 100644 --- a/bridges/WallpaperStopBridge.php +++ b/bridges/WallpaperStopBridge.php @@ -11,7 +11,7 @@ class WallpaperStopBridge extends BridgeAbstract { $this->name = "WallpaperStop Bridge"; $this->uri = "http://www.wallpaperstop.com/"; $this->description = "Returns the latests wallpapers from WallpaperStop"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -42,7 +42,7 @@ class WallpaperStopBridge extends BridgeAbstract { public function collectData(array $param){ $html = ''; if (!isset($param['c'])) { - $this->returnError('You must specify at least a category (?c=...).', 400); + $this->returnClientError('You must specify at least a category (?c=...).'); } else { $baseUri = 'http://www.wallpaperstop.com'; @@ -56,7 +56,7 @@ class WallpaperStopBridge extends BridgeAbstract { for ($page = 1; $page <= $lastpage; $page++) { $link = $baseUri.'/'.$this->category.'-wallpaper/'.(!empty($this->subcategory)?$this->subcategory.'-wallpaper/':'').'desktop-wallpaper-'.$page.'.html'; - $html = $this->file_get_html($link) or $this->returnError('No results for this query.', 404); + $html = $this->file_get_html($link) or $this->returnServerError('No results for this query.'); if ($page === 1) { preg_match('/-(\d+)\.html$/', $html->find('.pagination > .last', 0)->href, $matches); diff --git a/bridges/WeLiveSecurityBridge.php b/bridges/WeLiveSecurityBridge.php index 9fdf87b..27d26ff 100644 --- a/bridges/WeLiveSecurityBridge.php +++ b/bridges/WeLiveSecurityBridge.php @@ -6,7 +6,7 @@ class WeLiveSecurityBridge extends BridgeAbstract { $this->name = 'We Live Security'; $this->uri = 'http://www.welivesecurity.com/'; $this->description = 'Returns the newest articles.'; - $this->update = '2016-08-09'; + $this->update = '2016-08-17'; } public function collectData(array $param) { @@ -28,7 +28,7 @@ class WeLiveSecurityBridge extends BridgeAbstract { } $feed = $this->getURI().'feed/'; - $html = $this->file_get_html($feed) or $this->returnError('Could not request '.$this->getName().': '.$feed, 500); + $html = $this->file_get_html($feed) or $this->returnServerError('Could not request '.$this->getName().': '.$feed); $limit = 0; foreach ($html->find('item') as $element) { @@ -37,7 +37,7 @@ class WeLiveSecurityBridge extends BridgeAbstract { $article_image = $element->find('image', 0)->plaintext; $article_url = ExtractFromDelimiters($element->innertext, '', ''); $article_summary = ExtractFromDelimiters($element->innertext, '', '

'); - $article_html = file_get_contents($article_url) or $this->returnError('Could not request '.$this->getName().': '.$article_url, 500); + $article_html = file_get_contents($article_url) or $this->returnServerError('Could not request '.$this->getName().': '.$article_url); if (substr($article_html, 0, 2) == "\x1f\x8b") //http://www.gzip.org/zlib/rfc-gzip.html#header-trailer -> GZip ID1 $article_html = gzdecode($article_html); //Response is GZipped even if we didn't accept GZip!? Let's decompress... $article_html = str_get_html($article_html); //Now we have our HTML data. But still, that's an important HTTP violation... diff --git a/bridges/WhydBridge.php b/bridges/WhydBridge.php index cf9959c..b7739e4 100644 --- a/bridges/WhydBridge.php +++ b/bridges/WhydBridge.php @@ -10,7 +10,7 @@ class WhydBridge extends BridgeAbstract{ $this->name = "Whyd Bridge"; $this->uri = "http://www.whyd.com/"; $this->description = "Returns 10 newest music from user profile"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -28,12 +28,12 @@ class WhydBridge extends BridgeAbstract{ { $this->request = $param['u']; if (strlen(preg_replace("/[^0-9a-f]/",'', $this->request)) == 24) { // is input the userid ? - $html = $this->file_get_html('http://www.whyd.com/u/'.preg_replace("/[^0-9a-f]/",'', $this->request)) or $this->returnError('No results for this query.', 404); + $html = $this->file_get_html('http://www.whyd.com/u/'.preg_replace("/[^0-9a-f]/",'', $this->request)) or $this->returnServerError('No results for this query.'); } else { // input may be the username - $html = $this->file_get_html('http://www.whyd.com/search?q='.urlencode($this->request)) or $this->returnError('No results for this query.', 404); + $html = $this->file_get_html('http://www.whyd.com/search?q='.urlencode($this->request)) or $this->returnServerError('No results for this query.'); for ($j = 0; $j < 5; $j++) { if (strtolower($html->find('div.user', $j)->find('a',0)->plaintext) == strtolower($this->request)) { - $html = $this->file_get_html('http://www.whyd.com' . $html->find('div.user', $j)->find('a', 0)->getAttribute('href')) or $this->returnError('No results for this query', 404); + $html = $this->file_get_html('http://www.whyd.com' . $html->find('div.user', $j)->find('a', 0)->getAttribute('href')) or $this->returnServerError('No results for this query'); break; } } @@ -42,7 +42,7 @@ class WhydBridge extends BridgeAbstract{ } else { - $this->returnError('You must specify username', 400); + $this->returnClientError('You must specify username'); } for($i = 0; $i < 10; $i++) { diff --git a/bridges/WikipediaBridge.php b/bridges/WikipediaBridge.php index 710e55b..d222f45 100644 --- a/bridges/WikipediaBridge.php +++ b/bridges/WikipediaBridge.php @@ -9,7 +9,7 @@ class WikipediaBridge extends BridgeAbstract{ $this->name = 'Wikipedia bridge for many languages'; $this->uri = 'https://www.wikipedia.org/'; $this->description = 'Returns articles for a language of your choice'; - $this->update = '2016-08-15'; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -70,13 +70,13 @@ class WikipediaBridge extends BridgeAbstract{ public function collectData(array $params){ if(!isset($params['language'])) - $this->returnError('You must specify a valid language via \'&language=\'!', 400); + $this->returnClientError('You must specify a valid language via \'&language=\'!'); if(!$this->CheckLanguageCode(strtolower($params['language']))) - $this->returnError('The language code you provided (\'' . $params['language'] . '\') is not supported!', 400); + $this->returnClientError('The language code you provided (\'' . $params['language'] . '\') is not supported!'); if(!isset($params['subject'])) - $this->returnError('You must specify a valid subject via \'&subject=\'!', 400); + $this->returnClientError('You must specify a valid subject via \'&subject=\'!'); $subject = WIKIPEDIA_SUBJECT_TFA; switch($params['subject']){ @@ -115,7 +115,7 @@ class WikipediaBridge extends BridgeAbstract{ $html = $this->file_get_html($this->uri . '/wiki'); if(!$html) - $this->returnError('Could not load site: ' . $this->uri . '!', 404); + $this->returnServerError('Could not load site: ' . $this->uri . '!'); /* * Now read content depending on the language (make sure to create one function per language!) @@ -125,7 +125,7 @@ class WikipediaBridge extends BridgeAbstract{ $function = 'GetContents' . strtoupper($params['language']); if(!method_exists($this, $function)) - $this->returnError('A function to get the contents for your langauage is missing (\'' . $function . '\')!', 501); + $this->returnServerError('A function to get the contents for your langauage is missing (\'' . $function . '\')!'); /* * The method takes care of creating all items. @@ -212,12 +212,12 @@ class WikipediaBridge extends BridgeAbstract{ $content_html = $this->file_get_html($uri); if(!$content_html) - $this->returnError('Could not load site: ' . $uri . '!', 404); + $this->returnServerError('Could not load site: ' . $uri . '!'); $content = $content_html->find('#mw-content-text', 0); if(!$content) - $this->returnError('Could not find content in page: ' . $uri . '!', 404); + $this->returnServerError('Could not find content in page: ' . $uri . '!'); // Let's remove a couple of things from the article $table = $content->find('#toc', 0); // Table of contents diff --git a/bridges/WordPressBridge.php b/bridges/WordPressBridge.php index 35f6a49..f848101 100644 --- a/bridges/WordPressBridge.php +++ b/bridges/WordPressBridge.php @@ -12,7 +12,7 @@ class WordPressBridge extends BridgeAbstract { $this->name = "Wordpress Bridge"; $this->uri = "https://wordpress.org/"; $this->description = "Returns the 3 newest full posts of a Wordpress blog"; - $this->update = "2016-08-15"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -60,11 +60,11 @@ class WordPressBridge extends BridgeAbstract { $this->processParams($param); if (!$this->hasUrl()) { - $this->returnError('You must specify a URL', 400); + $this->returnClientError('You must specify a URL'); } $this->url = $this->url.'/feed/atom'; - $html = $this->file_get_html($this->url) or $this->returnError("Could not request {$this->url}.", 404); + $html = $this->file_get_html($this->url) or $this->returnServerError("Could not request {$this->url}."); // Notice: We requested an ATOM feed, however some sites return RSS feeds instead! $type = $this->DetectContentType($html); @@ -128,7 +128,7 @@ class WordPressBridge extends BridgeAbstract { } } } else { - $this->returnError("Sorry, {$this->url} doesn't seem to be a Wordpress blog.", 404); + $this->returnServerError("Sorry, {$this->url} doesn't seem to be a Wordpress blog."); } } diff --git a/bridges/WorldOfTanks.php b/bridges/WorldOfTanks.php index 3d30e3f..77fa7b1 100644 --- a/bridges/WorldOfTanks.php +++ b/bridges/WorldOfTanks.php @@ -12,7 +12,7 @@ class WorldOfTanks extends HttpCachingBridgeAbstract{ $this->name = "World of Tanks"; $this->uri = "http://worldoftanks.eu/"; $this->description = "News about the tank slaughter game."; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -70,7 +70,7 @@ class WorldOfTanks extends HttpCachingBridgeAbstract{ } else { $this->uri = WORLD_OF_TANKS.$this->lang.NEWS.'pc-browser/'.$param['category']."/"; } - $html = $this->file_get_html($this->getURI()) or $this->returnError('Could not request '.$this->getURI(), 404); + $html = $this->file_get_html($this->getURI()) or $this->returnServerError('Could not request '.$this->getURI()); $this->message("loaded HTML from ".$this->getURI()); // customize name $this->name = $html->find('title', 0)->innertext; diff --git a/bridges/XbooruBridge.php b/bridges/XbooruBridge.php index 2d28f44..691b46c 100644 --- a/bridges/XbooruBridge.php +++ b/bridges/XbooruBridge.php @@ -7,7 +7,7 @@ class XbooruBridge extends BridgeAbstract{ $this->name = "Xbooru"; $this->uri = "http://xbooru.com/"; $this->description = "Returns images from given page"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -33,7 +33,7 @@ class XbooruBridge extends BridgeAbstract{ if (isset($param['t'])) { $tags = urlencode($param['t']); } - $html = $this->file_get_html("http://xbooru.com/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnError('Could not request Xbooru.', 404); + $html = $this->file_get_html("http://xbooru.com/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Xbooru.'); foreach($html->find('div[class=content] span') as $element) { diff --git a/bridges/YandereBridge.php b/bridges/YandereBridge.php index 65a6b1a..223c941 100644 --- a/bridges/YandereBridge.php +++ b/bridges/YandereBridge.php @@ -7,7 +7,7 @@ class YandereBridge extends BridgeAbstract{ $this->name = "Yande.re"; $this->uri = "https://yande.re/"; $this->description = "Returns images from given page and tags"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -31,7 +31,7 @@ class YandereBridge extends BridgeAbstract{ if (isset($param['t'])) { $tags = urlencode($param['t']); } - $html = $this->file_get_html("https://yande.re/post?page=$page&tags=$tags") or $this->returnError('Could not request Yandere.', 404); + $html = $this->file_get_html("https://yande.re/post?page=$page&tags=$tags") or $this->returnServerError('Could not request Yandere.'); $input_json = explode('Post.register(', $html); foreach($input_json as $element) $data[] = preg_replace('/}\)(.*)/', '}', $element); diff --git a/bridges/YoutubeBridge.php b/bridges/YoutubeBridge.php index cc59119..02ded71 100644 --- a/bridges/YoutubeBridge.php +++ b/bridges/YoutubeBridge.php @@ -14,7 +14,7 @@ class YoutubeBridge extends BridgeAbstract { $this->uri = 'https://www.youtube.com/'; $this->description = 'Returns the 10 newest videos by username/channel/playlist or search'; $this->maintainer = 'mitsukarenai'; - $this->update = '2016-08-15'; + $this->update = '2016-08-17'; $this->parameters['By username'] = '[ @@ -142,13 +142,13 @@ class YoutubeBridge extends BridgeAbstract { $this->ytBridgeParseXmlFeed($xml); } else if ($html = $this->file_get_html($url_listing)) { $this->ytBridgeParseHtmlListing($html, 'li.channels-content-item', 'h3'); - } else $this->returnError("Could not request YouTube. Tried:\n - $url_feed\n - $url_listing", 500); + } else $this->returnServerError("Could not request YouTube. Tried:\n - $url_feed\n - $url_listing"); } else if (isset($param['p'])) { /* playlist mode */ $this->request = $param['p']; $url_listing = $this->uri.'playlist?list='.urlencode($this->request); - $html = $this->file_get_html($url_listing) or $this->returnError("Could not request YouTube. Tried:\n - $url_listing", 500); + $html = $this->file_get_html($url_listing) or $this->returnServerError("Could not request YouTube. Tried:\n - $url_listing"); $this->ytBridgeParseHtmlListing($html, 'tr.pl-video', '.pl-video-title a'); $this->request = 'Playlist: '.str_replace(' - YouTube', '', $html->find('title', 0)->plaintext); } @@ -156,13 +156,13 @@ class YoutubeBridge extends BridgeAbstract { else if (isset($param['s'])) { /* search mode */ $this->request = $param['s']; $page = 1; if (isset($param['pa'])) $page = (int)preg_replace("/[^0-9]/",'', $param['pa']); $url_listing = $this->uri.'results?search_query='.urlencode($this->request).'&page='.$page.'&filters=video&search_sort=video_date_uploaded'; - $html = $this->file_get_html($url_listing) or $this->returnError("Could not request YouTube. Tried:\n - $url_listing", 500); + $html = $this->file_get_html($url_listing) or $this->returnServerError("Could not request YouTube. Tried:\n - $url_listing"); $this->ytBridgeParseHtmlListing($html, 'div.yt-lockup', 'h3'); $this->request = 'Search: '.str_replace(' - YouTube', '', $html->find('title', 0)->plaintext); } else { /* no valid mode */ - $this->returnError("You must either specify either:\n - YouTube username (?u=...)\n - Channel id (?c=...)\n - Playlist id (?p=...)\n - Search (?s=...)", 400); + $this->returnClientError("You must either specify either:\n - YouTube username (?u=...)\n - Channel id (?c=...)\n - Playlist id (?p=...)\n - Search (?s=...)"); } } diff --git a/bridges/ZDNetBridge.php b/bridges/ZDNetBridge.php index 5859adc..c33f20a 100644 --- a/bridges/ZDNetBridge.php +++ b/bridges/ZDNetBridge.php @@ -7,7 +7,7 @@ class ZDNetBridge extends BridgeAbstract { $this->name = 'ZDNet Bridge'; $this->uri = 'http://www.zdnet.com/'; $this->description = 'Technology News, Analysis, Comments and Product Reviews for IT Professionals.'; - $this->update = '2016-08-09'; + $this->update = '2016-08-17'; $this->parameters[] = // http://www.zdnet.com/zdnet.opml @@ -229,15 +229,15 @@ class ZDNetBridge extends BridgeAbstract { $baseUri = $this->getURI(); $feed = $param['feed']; if (empty($feed)) - $this->returnError('Please select a feed to display.', 400); + $this->returnClientError('Please select a feed to display.'); if (strpos($feed, 'downloads!') !== false) { $feed = str_replace('downloads!', '', $feed); $baseUri = str_replace('www.', 'downloads.', $baseUri); } if ($feed !== preg_replace('/[^a-zA-Z0-9-\/]+/', '', $feed) || substr_count($feed, '/') > 1 || strlen($feed > 64)) - $this->returnError('Invalid "feed" parameter.', 400); + $this->returnClientError('Invalid "feed" parameter.'); $url = $baseUri.trim($feed, '/').'/rss.xml'; - $html = $this->file_get_html($url) or $this->returnError('Could not request ZDNet: '.$url, 500); + $html = $this->file_get_html($url) or $this->returnServerError('Could not request ZDNet: '.$url); $limit = 0; foreach ($html->find('item') as $element) { @@ -247,7 +247,7 @@ class ZDNetBridge extends BridgeAbstract { $article_title = StripCDATA($element->find('title', 0)->plaintext); $article_subtitle = StripCDATA($element->find('description', 0)->plaintext); $article_timestamp = strtotime(StripCDATA($element->find('pubDate', 0)->plaintext)); - $article = $this->file_get_html($article_url) or $this->returnError('Could not request ZDNet: '.$article_url, 500); + $article = $this->file_get_html($article_url) or $this->returnServerError('Could not request ZDNet: '.$article_url); if (!empty($article_author)) $author = $article_author; diff --git a/bridges/ZatazBridge.php b/bridges/ZatazBridge.php index 7a771da..0c381dc 100644 --- a/bridges/ZatazBridge.php +++ b/bridges/ZatazBridge.php @@ -7,12 +7,12 @@ class ZatazBridge extends BridgeAbstract { $this->name = 'Zataz Magazine'; $this->uri = 'http://www.zataz.com'; $this->description = "ZATAZ Magazine - S'informer, c'est déjà se sécuriser"; - $this->update = "2016-08-09"; + $this->update = '2016-08-17'; } public function collectData(array $param) { - $html = $this->file_get_html($this->uri) or $this->returnError('Could not request ' . $this->uri, 404); + $html = $this->file_get_html($this->uri) or $this->returnServerError('Could not request ' . $this->uri); $recent_posts = $html->find('#recent-posts-3', 0)->find('ul', 0)->find('li'); foreach ($recent_posts as $article) { diff --git a/bridges/ZoneTelechargementBridge.php b/bridges/ZoneTelechargementBridge.php index 2d0c6b6..d6e6714 100644 --- a/bridges/ZoneTelechargementBridge.php +++ b/bridges/ZoneTelechargementBridge.php @@ -7,7 +7,7 @@ class ZoneTelechargementBridge extends BridgeAbstract { $this->name = 'Zone Telechargement Bridge'; $this->uri = 'https://www.zone-telechargement.com/'; $this->description = 'RSS proxy returning the newest releases.
You may specify a category found in RSS URLs, else main feed is selected.'; - $this->update = "2016-08-06"; + $this->update = '2016-08-17'; $this->parameters[] = '[ @@ -31,7 +31,7 @@ class ZoneTelechargementBridge extends BridgeAbstract { $category = '/'.$param['category'].'/'; $url = $this->getURI().$category.'rss.xml'; - $html = $this->file_get_html($url) or $this->returnError('Could not request Zone Telechargement: '.$url, 500); + $html = $this->file_get_html($url) or $this->returnServerError('Could not request Zone Telechargement: '.$url); foreach($html->find('item') as $element) { $item = new \Item(); diff --git a/lib/Bridge.php b/lib/Bridge.php index 69880bb..a8732e0 100644 --- a/lib/Bridge.php +++ b/lib/Bridge.php @@ -340,11 +340,11 @@ abstract class RssExpander extends HttpCachingBridgeAbstract{ public function collectExpandableDatas(array $param, $name){ if (empty($name)) { - $this->returnError('There is no $name for this RSS expander', 404); + $this->returnServerError('There is no $name for this RSS expander'); } // $this->message("Loading from ".$param['url']); // Notice WE DO NOT use cache here on purpose : we want a fresh view of the RSS stream each time - $rssContent = simplexml_load_file($name) or $this->returnError('Could not request '.$name, 404); + $rssContent = simplexml_load_file($name) or $this->returnServerError('Could not request '.$name); // $this->message("loaded RSS from ".$param['url']); // TODO insert RSS format detection // we suppose for now, we have some RSS 2.0