bridges: Replace returnError function with more specific

Replacements depend on original error code:
400: returnClientError
404: returnServerError
500: returnServerError
501: returnServerError
This commit is contained in:
logmanoriginal 2016-08-17 14:45:08 +02:00
parent 73a1bcf3d6
commit 74f0572d91
124 changed files with 401 additions and 400 deletions

View file

@ -9,13 +9,13 @@ class ABCTabsBridge extends BridgeAbstract{
$this->name = "ABC Tabs Bridge"; $this->name = "ABC Tabs Bridge";
$this->uri = "http://www.abc-tabs.com/"; $this->uri = "http://www.abc-tabs.com/";
$this->description = "Returns 22 newest tabs"; $this->description = "Returns 22 newest tabs";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
} }
public function collectData(array $param){ public function collectData(array $param){
$html = ''; $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); $table = $html->find('table#myTable', 0)->children(1);
foreach ($table->find('tr') as $tab) foreach ($table->find('tr') as $tab)

View file

@ -7,7 +7,7 @@ class AllocineFRBridge extends BridgeAbstract{
$this->name = "Allo Cine Bridge"; $this->name = "Allo Cine Bridge";
$this->uri = "http://www.allocine.fr"; $this->uri = "http://www.allocine.fr";
$this->description = "Bridge for allocine.fr"; $this->description = "Bridge for allocine.fr";
$this->update = "2016-08-15"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -41,7 +41,7 @@ class AllocineFRBridge extends BridgeAbstract{
// Check all parameters // Check all parameters
if(!isset($params['category'])) if(!isset($params['category']))
$this->returnError('You must specify a valid category (&category= )!', 400); $this->returnClientError('You must specify a valid category (&category= )!');
$category = ''; $category = '';
switch($params['category']){ switch($params['category']){
@ -58,13 +58,13 @@ class AllocineFRBridge extends BridgeAbstract{
$category = 'Tueurs en Séries'; $category = 'Tueurs en Séries';
break; break;
default: default:
$this->returnError('You must select a valid category!', 400); $this->returnClientError('You must select a valid category!');
} }
// Update bridge name to match selection // Update bridge name to match selection
$this->name .= ' : ' . $category; $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) foreach($html->find('figure.media-meta-fig') as $element)
{ {

View file

@ -9,7 +9,7 @@ class AnimeUltimeBridge extends BridgeAbstract {
$this->name = 'Anime-Ultime'; $this->name = 'Anime-Ultime';
$this->uri = 'http://www.anime-ultime.net/'; $this->uri = 'http://www.anime-ultime.net/';
$this->description = 'Returns the 10 newest releases posted on Anime-Ultime'; $this->description = 'Returns the 10 newest releases posted on Anime-Ultime';
$this->update = '2016-08-09'; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -53,7 +53,7 @@ class AnimeUltimeBridge extends BridgeAbstract {
if ($typeFilter == 'A') { $this->filter = 'Anime'; } if ($typeFilter == 'A') { $this->filter = 'Anime'; }
if ($typeFilter == 'D') { $this->filter = 'Drama'; } if ($typeFilter == 'D') { $this->filter = 'Drama'; }
if ($typeFilter == 'T') { $this->filter = 'Tokusatsu'; } 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 //Build date and filters for making requests
@ -67,7 +67,7 @@ class AnimeUltimeBridge extends BridgeAbstract {
//Retrive page contents //Retrive page contents
$website = 'http://www.anime-ultime.net/'; $website = 'http://www.anime-ultime.net/';
$url = $website.'history-0-1/'.$requestFilter; $url = $website.'history-0-1/'.$requestFilter;
$html = $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 //Relases are sorted by day : process each day individually
foreach ($html->find('div.history', 0)->find('h3') as $daySection) { foreach ($html->find('div.history', 0)->find('h3') as $daySection) {
@ -93,7 +93,7 @@ class AnimeUltimeBridge extends BridgeAbstract {
if (!empty($item_uri)) { if (!empty($item_uri)) {
//Retrieve description from description page and convert relative image src info absolute image src //Retrieve description from description page and convert relative image src info absolute image src
$html_item = file_get_contents($item_uri) or $this->returnError('Could not request Anime-Ultime: '.$item_uri, 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($html_item, strpos($html_item, 'class="principal_contain" align="center">') + 41);
$item_description = substr($item_description, 0, strpos($item_description, '<div id="table">')); $item_description = substr($item_description, 0, strpos($item_description, '<div id="table">'));
$item_description = str_replace('src="images', 'src="'.$website.'images', $item_description); $item_description = str_replace('src="images', 'src="'.$website.'images', $item_description);

View file

@ -9,7 +9,7 @@ class ArstechnicaBridge extends BridgeAbstract {
$this->name = "ArstechnicaBridge"; $this->name = "ArstechnicaBridge";
$this->uri = "http://arstechnica.com"; $this->uri = "http://arstechnica.com";
$this->description = "The PC enthusiast's resource. Power users and the tools they love, without computing religion"; $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; 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; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {

View file

@ -7,6 +7,7 @@ class AskfmBridge extends BridgeAbstract{
$this->name = "Ask.fm Answers"; $this->name = "Ask.fm Answers";
$this->uri = "http://ask.fm/"; $this->uri = "http://ask.fm/";
$this->description = "Returns answers from an Ask.fm user"; $this->description = "Returns answers from an Ask.fm user";
$this->update = '2016-08-17';
$this->parameters["Ask.fm username"] = $this->parameters["Ask.fm username"] =
'[ '[
@ -21,10 +22,10 @@ class AskfmBridge extends BridgeAbstract{
$html = ''; $html = '';
if (isset($param['u'])) { if (isset($param['u'])) {
$this->request = $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 { 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) { foreach($html->find('div.streamItem-answer') as $element) {

View file

@ -9,7 +9,7 @@ class BandcampBridge extends BridgeAbstract{
$this->name = "Bandcamp Tag"; $this->name = "Bandcamp Tag";
$this->uri = "http://bandcamp.com/"; $this->uri = "http://bandcamp.com/";
$this->description = "New bandcamp release by tag"; $this->description = "New bandcamp release by tag";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -26,10 +26,10 @@ class BandcampBridge extends BridgeAbstract{
$html = ''; $html = '';
if (isset($param['tag'])) { if (isset($param['tag'])) {
$this->request = $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 { else {
$this->returnError('You must specify tag (/tag/...)', 400); $this->returnClientError('You must specify tag (/tag/...)');
} }
foreach($html->find('li.item') as $release) { foreach($html->find('li.item') as $release) {

View file

@ -5,7 +5,7 @@ class BastaBridge extends BridgeAbstract{
$this->name = "Bastamag Bridge"; $this->name = "Bastamag Bridge";
$this->uri = "http://www.bastamag.net/"; $this->uri = "http://www.bastamag.net/";
$this->description = "Returns the newest articles."; $this->description = "Returns the newest articles.";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
} }
public function collectData(array $param){ 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); 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; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {

View file

@ -7,12 +7,12 @@ class BlaguesDeMerdeBridge extends BridgeAbstract{
$this->name = "Blagues De Merde"; $this->name = "Blagues De Merde";
$this->uri = "http://www.blaguesdemerde.fr/"; $this->uri = "http://www.blaguesdemerde.fr/";
$this->description = "Blagues De Merde"; $this->description = "Blagues De Merde";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
} }
public function collectData(array $param){ 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) { foreach($html->find('article.joke_contener') as $element) {
$item = new Item(); $item = new Item();

View file

@ -7,7 +7,7 @@ class BooruprojectBridge extends BridgeAbstract{
$this->name = "Booruproject"; $this->name = "Booruproject";
$this->uri = "http://booru.org/"; $this->uri = "http://booru.org/";
$this->description = "Returns images from given page and booruproject instance (****.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[] = $this->parameters[] =
'[ '[
@ -41,9 +41,9 @@ class BooruprojectBridge extends BridgeAbstract{
$tags = '&tags='.urlencode($param['t']); $tags = '&tags='.urlencode($param['t']);
} }
if (empty($param['i'])) { 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) { foreach($html->find('div[class=content] span') as $element) {

View file

@ -5,7 +5,7 @@ class CADBridge extends BridgeAbstract{
$this->name = "CAD Bridge"; $this->name = "CAD Bridge";
$this->uri = "http://www.cad-comic.com/"; $this->uri = "http://www.cad-comic.com/";
$this->description = "Returns the newest articles."; $this->description = "Returns the newest articles.";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
} }
private function CADExtractContent($url) { private function CADExtractContent($url) {
@ -45,7 +45,7 @@ class CADBridge extends BridgeAbstract{
return $string; 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; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {

View file

@ -9,7 +9,7 @@ class CNETBridge extends BridgeAbstract {
$this->name = 'CNET News'; $this->name = 'CNET News';
$this->uri = 'http://www.cnet.com/'; $this->uri = 'http://www.cnet.com/';
$this->description = 'Returns the newest articles. <br /> You may specify a topic found in some section URLs, else all topics are selected.'; $this->description = 'Returns the newest articles. <br /> 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[] = $this->parameters[] =
'[ '[
@ -51,7 +51,7 @@ class CNETBridge extends BridgeAbstract {
$this->topicName = $param['topic']; $this->topicName = $param['topic'];
$pageUrl = 'http://www.cnet.com/'.(empty($this->topicName) ? '' : 'topics/'.$this->topicName.'/'); $pageUrl = 'http://www.cnet.com/'.(empty($this->topicName) ? '' : 'topics/'.$this->topicName.'/');
$html = $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; $limit = 0;
foreach($html->find('div.assetBody') as $element) { 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) { 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, '<div class="articleContent', '<footer>'))); $article_content = trim(CleanArticle(ExtractFromDelimiters($article_html, '<div class="articleContent', '<footer>')));

View file

@ -5,7 +5,7 @@ class CastorusBridge extends BridgeAbstract {
$this->name = "Castorus Bridge"; $this->name = "Castorus Bridge";
$this->uri = 'http://www.castorus.com'; $this->uri = 'http://www.castorus.com';
$this->description = "Returns the latest changes"; $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"] = '[]';
$this->parameters["Get latest changes via ZIP code"] = $this->parameters["Get latest changes via ZIP code"] =
@ -37,7 +37,7 @@ class CastorusBridge extends BridgeAbstract {
$title = $activity->find('a', 0); $title = $activity->find('a', 0);
if(!$title) if(!$title)
$this->returnError('Cannot find title!', 404); $this->returnServerError('Cannot find title!');
return htmlspecialchars(trim($title->plaintext)); return htmlspecialchars(trim($title->plaintext));
} }
@ -47,7 +47,7 @@ class CastorusBridge extends BridgeAbstract {
$url = $activity->find('a', 0); $url = $activity->find('a', 0);
if(!$url) if(!$url)
$this->returnError('Cannot find url!', 404); $this->returnServerError('Cannot find url!');
return $this->uri . $url->href; return $this->uri . $url->href;
} }
@ -59,7 +59,7 @@ class CastorusBridge extends BridgeAbstract {
$nodes = $activity->find('*'); $nodes = $activity->find('*');
if(!$nodes) if(!$nodes)
$this->returnError('Cannot find nodes!', 404); $this->returnServerError('Cannot find nodes!');
foreach($nodes as $node){ foreach($nodes as $node){
$node->outertext = ''; $node->outertext = '';
@ -73,7 +73,7 @@ class CastorusBridge extends BridgeAbstract {
$price = $activity->find('span', 1); $price = $activity->find('span', 1);
if(!$price) if(!$price)
$this->returnError('Cannot find price!', 404); $this->returnServerError('Cannot find price!');
return $price->innertext; return $price->innertext;
} }
@ -88,12 +88,12 @@ class CastorusBridge extends BridgeAbstract {
$html = $this->file_get_html($this->uri); $html = $this->file_get_html($this->uri);
if(!$html) 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'); $activities = $html->find('div#activite/li');
if(!$activities) if(!$activities)
$this->returnError('Failed to find activities!', 404); $this->returnServerError('Failed to find activities!');
foreach($activities as $activity){ foreach($activities as $activity){
$item = new \Item(); $item = new \Item();

View file

@ -6,7 +6,7 @@ class CollegeDeFranceBridge extends BridgeAbstract{
$this->name = "CollegeDeFrance"; $this->name = "CollegeDeFrance";
$this->uri = "http://www.college-de-france.fr/"; $this->uri = "http://www.college-de-france.fr/";
$this->description = "Returns the latest audio and video from CollegeDeFrance"; $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) { public function collectData(array $param) {
@ -33,7 +33,7 @@ class CollegeDeFranceBridge extends BridgeAbstract{
* </a> * </a>
* </li> * </li>
*/ */
$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) { foreach($html->find('a[data-target]') as $element) {
$item = new \Item(); $item = new \Item();
$item->title = $element->find('.title', 0)->plaintext; $item->title = $element->find('.title', 0)->plaintext;

View file

@ -6,7 +6,7 @@ class CommonDreamsBridge extends BridgeAbstract{
$this->name = "CommonDreams Bridge"; $this->name = "CommonDreams Bridge";
$this->uri = "http://www.commondreams.org/"; $this->uri = "http://www.commondreams.org/";
$this->description = "Returns the newest articles."; $this->description = "Returns the newest articles.";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
} }
private function CommonDreamsExtractContent($url) { private function CommonDreamsExtractContent($url) {
@ -25,7 +25,7 @@ class CommonDreamsBridge extends BridgeAbstract{
return $string; 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; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {
if($limit < 4) { if($limit < 4) {

View file

@ -7,13 +7,13 @@ class CopieDoubleBridge extends BridgeAbstract{
$this->name = "CopieDouble"; $this->name = "CopieDouble";
$this->uri = "http://www.copie-double.com/"; $this->uri = "http://www.copie-double.com/";
$this->description = "CopieDouble"; $this->description = "CopieDouble";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
} }
public function collectData(array $param){ 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); $table = $html->find('table table', 2);
foreach($table->find('tr') as $element) foreach($table->find('tr') as $element)

View file

@ -7,7 +7,7 @@ class CourrierInternationalBridge extends BridgeAbstract{
$this->name = "Courrier International Bridge"; $this->name = "Courrier International Bridge";
$this->uri = "http://CourrierInternational.fr/"; $this->uri = "http://CourrierInternational.fr/";
$this->description = "Courrier International bridge"; $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 = '';
$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.');

View file

@ -24,7 +24,7 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
$this->name = "Cpasbien Bridge"; $this->name = "Cpasbien Bridge";
$this->uri = "http://www.cpasbien.io"; $this->uri = "http://www.cpasbien.io";
$this->description = "Returns latest torrents from a request query"; $this->description = "Returns latest torrents from a request query";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -44,10 +44,10 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
$html = ''; $html = '';
if (isset($param['q'])) { /* keyword search mode */ if (isset($param['q'])) { /* keyword search mode */
$this->request = str_replace(" ","-",trim($param['q'])); $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 { 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) { foreach ($html->find('#gauche',0)->find('div') as $episode) {

View file

@ -7,7 +7,7 @@ class CryptomeBridge extends BridgeAbstract{
$this->name = "Cryptome"; $this->name = "Cryptome";
$this->uri = "http://cryptome.org/"; $this->uri = "http://cryptome.org/";
$this->description = "Returns the N most recent documents."; $this->description = "Returns the N most recent documents.";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -28,7 +28,7 @@ class CryptomeBridge extends BridgeAbstract{
// If you want HTTPS access instead, uncomment the following line: // If you want HTTPS access instead, uncomment the following line:
//$link = 'https://secure.netsolhost.com/cryptome.org/'; //$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 */ if (!empty($param['n'])) { /* number of documents */
$num = min(max(1, $param['n']+0), $num); $num = min(max(1, $param['n']+0), $num);
} }

View file

@ -9,7 +9,7 @@ class DailymotionBridge extends BridgeAbstract{
$this->name = "Dailymotion Bridge"; $this->name = "Dailymotion Bridge";
$this->uri = "https://www.dailymotion.com/"; $this->uri = "https://www.dailymotion.com/";
$this->description = "Returns the 5 newest videos by username/playlist or search"; $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"] = $this->parameters["By username"] =
'[ '[
@ -47,7 +47,7 @@ class DailymotionBridge extends BridgeAbstract{
function getMetadata($id) { function getMetadata($id) {
$metadata=array(); $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['title'] = $html2->find('meta[property=og:title]', 0)->getAttribute('content');
$metadata['timestamp'] = strtotime($html2->find('meta[property=video:release_date]', 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'); $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 if (isset($param['u'])) { // user timeline mode
$this->request = $param['u']; $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 else if (isset($param['p'])) { // playlist mode
$this->request = strtok($param['p'], '_'); $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 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']); $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 { 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) { foreach($html->find('div.media a.preview_link') as $element) {

View file

@ -7,7 +7,7 @@ class DanbooruBridge extends BridgeAbstract{
$this->name = "Danbooru"; $this->name = "Danbooru";
$this->uri = "http://donmai.us/"; $this->uri = "http://donmai.us/";
$this->description = "Returns images from given page"; $this->description = "Returns images from given page";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -31,7 +31,7 @@ class DanbooruBridge extends BridgeAbstract{
if (isset($param['t'])) { if (isset($param['t'])) {
$tags = urlencode($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) { foreach($html->find('div[id=posts] article') as $element) {
$item = new \Item(); $item = new \Item();
$item->uri = 'http://donmai.us'.$element->find('a', 0)->href; $item->uri = 'http://donmai.us'.$element->find('a', 0)->href;

View file

@ -7,7 +7,7 @@ class DansTonChatBridge extends BridgeAbstract{
$this->name = "DansTonChat Bridge"; $this->name = "DansTonChat Bridge";
$this->uri = "http://danstonchat.com"; $this->uri = "http://danstonchat.com";
$this->description = "Returns latest quotes from DansTonChat."; $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 = ''; $html = '';
$link = 'http://danstonchat.com/latest.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) { foreach($html->find('div.item') as $element) {
$item = new \Item(); $item = new \Item();

View file

@ -7,7 +7,7 @@ class DauphineLibereBridge extends BridgeAbstract {
$this->name = "Dauphine Bridge"; $this->name = "Dauphine Bridge";
$this->uri = "http://www.ledauphine.com/"; $this->uri = "http://www.ledauphine.com/";
$this->description = "Returns the newest articles."; $this->description = "Returns the newest articles.";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -102,10 +102,10 @@ class DauphineLibereBridge extends BridgeAbstract {
if (isset($param['u'])) { /* user timeline mode */ if (isset($param['u'])) { /* user timeline mode */
$this->request = $param['u']; $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 { 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; $limit = 0;

View file

@ -6,7 +6,7 @@ class DeveloppezDotComBridge extends BridgeAbstract{
$this->name = "Developpez.com Actus (FR)"; $this->name = "Developpez.com Actus (FR)";
$this->uri = "http://www.developpez.com/"; $this->uri = "http://www.developpez.com/";
$this->description = "Returns the 15 newest posts from DeveloppezDotCom (full text)."; $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) { private function DeveloppezDotComStripCDATA($string) {
@ -42,7 +42,7 @@ class DeveloppezDotComBridge extends BridgeAbstract{
} }
public function collectData(array $param){ 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; $limit = 0;
foreach($rssFeed->find('item') as $element) { foreach($rssFeed->find('item') as $element) {

View file

@ -7,13 +7,13 @@ class DilbertBridge extends BridgeAbstract {
$this->name = 'Dilbert Daily Strip'; $this->name = 'Dilbert Daily Strip';
$this->uri = 'http://dilbert.com'; $this->uri = 'http://dilbert.com';
$this->description = 'The Unofficial Dilbert Daily Comic Strip'; $this->description = 'The Unofficial Dilbert Daily Comic Strip';
$this->update = "2016-08-09"; $this->update = '2016-08-17';
} }
public function collectData(array $param) { 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) { foreach ($html->find('section.comic-item') as $element) {

View file

@ -7,7 +7,7 @@ class DollbooruBridge extends BridgeAbstract{
$this->name = "Dollbooru"; $this->name = "Dollbooru";
$this->uri = "http://dollbooru.org/"; $this->uri = "http://dollbooru.org/";
$this->description = "Returns images from given page"; $this->description = "Returns images from given page";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
@ -32,7 +32,7 @@ class DollbooruBridge extends BridgeAbstract{
if (isset($param['t'])) { if (isset($param['t'])) {
$tags = urlencode($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) { foreach($html->find('div[class=shm-image-list] a') as $element) {

View file

@ -7,7 +7,7 @@ class DuckDuckGoBridge extends BridgeAbstract{
$this->name = "DuckDuckGo"; $this->name = "DuckDuckGo";
$this->uri = "https://duckduckgo.com/"; $this->uri = "https://duckduckgo.com/";
$this->description = "Returns most recent results from DuckDuckGo."; $this->description = "Returns most recent results from DuckDuckGo.";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -22,7 +22,7 @@ class DuckDuckGoBridge extends BridgeAbstract{
$html = ''; $html = '';
$link = 'http://duckduckgo.com/html/?q='.$param[u].'+sort:date'; $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) { foreach($html->find('div.results_links') as $element) {
$item = new \Item(); $item = new \Item();

View file

@ -7,7 +7,7 @@ class EZTVBridge extends BridgeAbstract{
$this->name = "EZTV"; $this->name = "EZTV";
$this->uri = "https://eztv.ch/"; $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->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[] = $this->parameters[] =
'[ '[
@ -37,14 +37,14 @@ class EZTVBridge extends BridgeAbstract{
// Check for ID provided // Check for ID provided
if (!isset($param['i'])) 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 // Loop on show ids
$showList = explode(",",$param['i']); $showList = explode(",",$param['i']);
foreach($showList as $showID){ foreach($showList as $showID){
// Get show page // 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... // Loop on each element that look like an episode entry...
foreach($html->find('.forum_header_border') as $element) { foreach($html->find('.forum_header_border') as $element) {

View file

@ -8,12 +8,12 @@ class EliteDangerousGalnetBridge extends BridgeAbstract
$this->name = "Elite: Dangerous Galnet"; $this->name = "Elite: Dangerous Galnet";
$this->uri = "https://community.elitedangerous.com/galnet"; $this->uri = "https://community.elitedangerous.com/galnet";
$this->description = "Returns the latest page of news from 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) 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) { foreach($html->find('div.article') as $element) {
$item = new Item(); $item = new Item();

View file

@ -6,7 +6,7 @@ class ElsevierBridge extends BridgeAbstract{
$this->name = 'Elsevier journals recent articles'; $this->name = 'Elsevier journals recent articles';
$this->uri = 'http://www.journals.elsevier.com'; $this->uri = 'http://www.journals.elsevier.com';
$this->description = 'Returns the recent articles published in Elsevier journals'; $this->description = 'Returns the recent articles published in Elsevier journals';
$this->update = '2016-08-15'; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -63,7 +63,7 @@ class ElsevierBridge extends BridgeAbstract{
public function collectData(array $param){ public function collectData(array $param){
$uri = 'http://www.journals.elsevier.com/' . $param['j'] . '/recent-articles/'; $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){ foreach($html->find('.pod-listing') as $article){
$item = new \Item(); $item = new \Item();

View file

@ -6,7 +6,7 @@ class EstCeQuonMetEnProdBridge extends BridgeAbstract {
$this->name = 'Est-ce qu\'on met en prod aujourd\'hui ?'; $this->name = 'Est-ce qu\'on met en prod aujourd\'hui ?';
$this->uri = 'https://www.estcequonmetenprodaujourdhui.info/'; $this->uri = 'https://www.estcequonmetenprodaujourdhui.info/';
$this->description = 'Should we put a website in production today? (French)'; $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) { public function collectData(array $param) {
@ -18,7 +18,7 @@ class EstCeQuonMetEnProdBridge extends BridgeAbstract {
} return false; } 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 = new \Item();
$item->uri = $this->getURI().'#'.date('Y-m-d'); $item->uri = $this->getURI().'#'.date('Y-m-d');

View file

@ -7,7 +7,7 @@ class FacebookBridge extends BridgeAbstract{
$this->name = "Facebook"; $this->name = "Facebook";
$this->uri = "http://www.facebook.com/"; $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->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[] = $this->parameters[] =
'[ '[
@ -97,7 +97,7 @@ class FacebookBridge extends BridgeAbstract{
); );
$context = stream_context_create($http_options); $context = stream_context_create($http_options);
$html = file_get_contents($captcha_action, false, $context); $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']); unset($_SESSION['captcha_fields']);
$html = str_get_html($html); $html = str_get_html($html);
} }
@ -109,12 +109,12 @@ class FacebookBridge extends BridgeAbstract{
if (is_null($html)) { if (is_null($html)) {
if (isset($param['u'])) { if (isset($param['u'])) {
if (!strpos($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 { } 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 { } else {
$this->returnError('You must specify a Facebook username.', 400); $this->returnClientError('You must specify a Facebook username.');
} }
} }

View file

@ -7,14 +7,14 @@ Class FierPandaBridge extends BridgeAbstract{
$this->name = "Fier Panda Bridge"; $this->name = "Fier Panda Bridge";
$this->uri = "http://www.fier-panda.fr/"; $this->uri = "http://www.fier-panda.fr/";
$this->description = "Returns latest articles from Fier Panda."; $this->description = "Returns latest articles from Fier Panda.";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
} }
public function collectData(array $param){ public function collectData(array $param){
$link = 'http://www.fier-panda.fr/'; $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) { foreach($html->find('div.container-content article') as $element) {
$item = new \Item(); $item = new \Item();

View file

@ -7,12 +7,12 @@ class FlickrExploreBridge extends BridgeAbstract{
$this->name = "Flickr Explore"; $this->name = "Flickr Explore";
$this->uri = "https://www.flickr.com/explore"; $this->uri = "https://www.flickr.com/explore";
$this->description = "Returns the latest interesting images from Flickr"; $this->description = "Returns the latest interesting images from Flickr";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
} }
public function collectData(array $param){ 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) { foreach($html->find('.photo-list-photo-view') as $element) {
// Get the styles // Get the styles
@ -26,7 +26,7 @@ class FlickrExploreBridge extends BridgeAbstract{
$imageID = reset($imageURIs); $imageID = reset($imageURIs);
// Get the image JSON via Flickr API // 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 = new \Item();
$item->uri = 'https://flickr.com/photo.gne?id='.$imageID; $item->uri = 'https://flickr.com/photo.gne?id='.$imageID;

View file

@ -7,7 +7,7 @@ class FlickrTagBridge extends BridgeAbstract{
$this->name = "Flickr TagUser"; $this->name = "Flickr TagUser";
$this->uri = "http://www.flickr.com/"; $this->uri = "http://www.flickr.com/";
$this->description = "Returns the tagged or user images from Flickr"; $this->description = "Returns the tagged or user images from Flickr";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters["By keyword"] = $this->parameters["By keyword"] =
'[ '[
@ -27,18 +27,18 @@ class FlickrTagBridge extends BridgeAbstract{
} }
public function collectData(array $param){ 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 */ if (isset($param['q'])) { /* keyword search mode */
$this->request = $param['q']; $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 */ elseif (isset($param['u'])) { /* user timeline mode */
$this->request = $param['u']; $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 { 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) { foreach($html->find('span.photo_container') as $element) {

View file

@ -7,12 +7,12 @@ class FootitoBridge extends BridgeAbstract{
$this->name = "Footito"; $this->name = "Footito";
$this->uri = "http://www.footito.fr/"; $this->uri = "http://www.footito.fr/";
$this->description = "Footito"; $this->description = "Footito";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
} }
public function collectData(array $param){ 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) { foreach($html->find('div.post') as $element) {
$item = new Item(); $item = new Item();

View file

@ -7,7 +7,7 @@ class FourchanBridge extends BridgeAbstract{
$this->name = "4chan"; $this->name = "4chan";
$this->uri = "https://www.4chan.org/"; $this->uri = "https://www.4chan.org/";
$this->description = "Returns posts from the specified thread"; $this->description = "Returns posts from the specified thread";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -22,17 +22,17 @@ class FourchanBridge extends BridgeAbstract{
public function collectData(array $param){ public function collectData(array $param){
if (!isset($param['t'])) 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') 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) 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'].''; $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) { foreach($html->find('div.postContainer') as $element) {
$item = new \Item(); $item = new \Item();

View file

@ -7,7 +7,7 @@ class FuturaSciencesBridge extends BridgeAbstract {
$this->name = 'Futura-Sciences Bridge'; $this->name = 'Futura-Sciences Bridge';
$this->uri = 'http://www.futura-sciences.com/'; $this->uri = 'http://www.futura-sciences.com/';
$this->description = 'Returns the newest articles.'; $this->description = 'Returns the newest articles.';
$this->update = '2016-08-09'; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -167,18 +167,18 @@ class FuturaSciencesBridge extends BridgeAbstract {
} }
if (empty($param['feed'])) 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)) 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'; $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; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {
if ($limit < 10) { if ($limit < 10) {
$article_url = str_replace('#xtor=RSS-8', '', StripCDATA($element->find('guid', 0)->plaintext)); $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; $contents = $article->find('div.content', 0)->innertext;
foreach (array( foreach (array(

View file

@ -9,7 +9,7 @@ class GBAtempBridge extends BridgeAbstract {
$this->name = 'GBAtemp'; $this->name = 'GBAtemp';
$this->uri = 'http://gbatemp.net/'; $this->uri = 'http://gbatemp.net/';
$this->description = 'GBAtemp is a user friendly underground video game community.'; $this->description = 'GBAtemp is a user friendly underground video game community.';
$this->update = '2016-08-09'; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -74,7 +74,7 @@ class GBAtempBridge extends BridgeAbstract {
} }
private function fetch_post_content($uri, $site_url) { 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; $content = $html->find('div.messageContent', 0)->innertext;
return $this->cleanup_post_content($content, $site_url); return $this->cleanup_post_content($content, $site_url);
} }
@ -88,10 +88,10 @@ class GBAtempBridge extends BridgeAbstract {
if ($typeFilter == 'R') { $this->filter = 'Review'; } if ($typeFilter == 'R') { $this->filter = 'Review'; }
if ($typeFilter == 'T') { $this->filter = 'Tutorial'; } if ($typeFilter == 'T') { $this->filter = 'Tutorial'; }
if ($typeFilter == 'F') { $this->filter = 'Forum'; } if ($typeFilter == 'F') { $this->filter = 'Forum'; }
} else $this->returnError('The provided type filter is invalid. Expecting N, R, T, or F.', 400); } else $this->returnClientError('The provided type filter is invalid. Expecting N, R, T, or F.');
} else $this->returnError('Please provide a type filter. Expecting N, R, T, or F.', 400); } 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') { if ($typeFilter == 'N') {
foreach ($html->find('li[class=news_item full]') as $newsItem) { 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) { foreach ($html->find('li.portal_review') as $reviewItem) {
$url = $this->uri.$reviewItem->find('a', 0)->href; $url = $this->uri.$reviewItem->find('a', 0)->href;
$title = $reviewItem->find('span.review_title', 0)->plaintext; $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; $author = $content->find('a.username', 0)->plaintext;
$time = intval($this->ExtractFromDelimiters($content->find('abbr.DateTime', 0)->outertext, 'data-time="', '"')); $time = intval($this->ExtractFromDelimiters($content->find('abbr.DateTime', 0)->outertext, 'data-time="', '"'));
$intro = '<p><b>'.($content->find('div#review_intro', 0)->plaintext).'</b></p>'; $intro = '<p><b>'.($content->find('div#review_intro', 0)->plaintext).'</b></p>';

View file

@ -7,7 +7,7 @@ class GelbooruBridge extends BridgeAbstract{
$this->name = "Gelbooru"; $this->name = "Gelbooru";
$this->uri = "http://gelbooru.com/"; $this->uri = "http://gelbooru.com/";
$this->description = "Returns images from given page"; $this->description = "Returns images from given page";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -34,7 +34,7 @@ class GelbooruBridge extends BridgeAbstract{
if (isset($param['t'])) { if (isset($param['t'])) {
$tags = urlencode($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) { foreach($html->find('div[class=content] span') as $element) {

View file

@ -9,7 +9,7 @@ class GiphyBridge extends BridgeAbstract{
$this->name = "Giphy Bridge"; $this->name = "Giphy Bridge";
$this->uri = "http://giphy.com/"; $this->uri = "http://giphy.com/";
$this->description = "Bridge for giphy.com"; $this->description = "Bridge for giphy.com";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters["By tag"] = $this->parameters["By tag"] =
'[ '[
@ -33,10 +33,10 @@ class GiphyBridge extends BridgeAbstract{
$html = ''; $html = '';
$base_url = 'http://giphy.com'; $base_url = 'http://giphy.com';
if (isset($param['s'])) { /* keyword search mode */ 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 { else {
$this->returnError('You must specify a search worf (?s=...).', 400); $this->returnClientError('You must specify a search worf (?s=...).');
} }
$max = GIPHY_LIMIT; $max = GIPHY_LIMIT;
@ -51,7 +51,7 @@ class GiphyBridge extends BridgeAbstract{
$node = $entry->first_child(); $node = $entry->first_child();
$href = $node->getAttribute('href'); $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'); $figure = $html2->getElementByTagName('figure');
$img = $figure->firstChild(); $img = $figure->firstChild();
$caption = $figure->lastChild(); $caption = $figure->lastChild();

View file

@ -12,7 +12,7 @@ class GithubIssueBridge extends BridgeAbstract{
$this->name = 'Github Issue'; $this->name = 'Github Issue';
$this->uri = ''; $this->uri = '';
$this->description = 'Returns the comments of a github project issue'; $this->description = 'Returns the comments of a github project issue';
$this->update = '2016-08-09'; $this->update = '2016-08-17';
$this->parameters[]= $this->parameters[]=
'[ '[
@ -35,7 +35,7 @@ class GithubIssueBridge extends BridgeAbstract{
public function collectData(array $param){ public function collectData(array $param){
$uri = 'https://github.com/'.$param['u'].'/'.$param['p'].'/issues/'.$param['i']; $uri = 'https://github.com/'.$param['u'].'/'.$param['p'].'/issues/'.$param['i'];
$html = file_get_html($uri) $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){ foreach($html->find('.js-comment-container') as $comment){

View file

@ -12,7 +12,7 @@ class GitlabCommitsBridge extends BridgeAbstract{
$this->name = 'Gitlab Commits'; $this->name = 'Gitlab Commits';
$this->uri = ''; $this->uri = '';
$this->description = 'Returns the commits of a project hosted on a gitlab instance'; $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[] = $this->parameters[] =
'[ '[
@ -45,7 +45,7 @@ class GitlabCommitsBridge extends BridgeAbstract{
} }
$html = file_get_html($uri) $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){ foreach($html->find('li.commit') as $commit){

View file

@ -7,7 +7,7 @@ class GizmodoFRBridge extends BridgeAbstract{
$this->name = "GizmodoFR"; $this->name = "GizmodoFR";
$this->uri = "http://www.gizmodo.fr/"; $this->uri = "http://www.gizmodo.fr/";
$this->description = "Returns the 15 newest posts from GizmodoFR (full text)."; $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; 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; $limit = 0;
foreach($rssFeed->find('item') as $element) { foreach($rssFeed->find('item') as $element) {

View file

@ -10,7 +10,7 @@ class GooglePlusPostBridge extends BridgeAbstract
$this->name = "Google Plus Post Bridge"; $this->name = "Google Plus Post Bridge";
$this->uri = "http://plus.google.com/"; $this->uri = "http://plus.google.com/";
$this->description = "Returns user public post (without API)."; $this->description = "Returns user public post (without API).";
$this->update = "2014-07-20"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -28,7 +28,7 @@ class GooglePlusPostBridge extends BridgeAbstract
{ {
if (!isset($param['username'])) 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']; $this->request = $param['username'];
@ -39,7 +39,7 @@ class GooglePlusPostBridge extends BridgeAbstract
, false, stream_context_create(array('http'=> array( , 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" '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 // get title, url, ... there is a lot of intresting stuff in meta
$this->_title = $html->find('meta[property]', 0)->getAttribute('content'); $this->_title = $html->find('meta[property]', 0)->getAttribute('content');

View file

@ -17,7 +17,7 @@ class GoogleSearchBridge extends BridgeAbstract{
$this->name = "Google search"; $this->name = "Google search";
$this->uri = "https://www.google.com/"; $this->uri = "https://www.google.com/";
$this->description = "Returns most recent results from Google search."; $this->description = "Returns most recent results from Google search.";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -35,10 +35,10 @@ class GoogleSearchBridge extends BridgeAbstract{
if (isset($param['q'])) { /* keyword search mode */ if (isset($param['q'])) { /* keyword search mode */
$this->request = $param['q']; $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{ 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); $emIsRes = $html->find('div[id=ires]',0);

View file

@ -6,7 +6,7 @@ class GuruMedBridge extends BridgeAbstract{
$this->name = "GuruMed"; $this->name = "GuruMed";
$this->uri = "http://www.gurumed.org"; $this->uri = "http://www.gurumed.org";
$this->description = "Returns the 5 newest posts from Gurumed (full text)"; $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) { private function GurumedStripCDATA($string) {
@ -16,7 +16,7 @@ class GuruMedBridge extends BridgeAbstract{
} }
public function collectData(array $param){ 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; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {

View file

@ -10,7 +10,7 @@ class HDWallpapersBridge extends BridgeAbstract {
$this->name = "HD Wallpapers Bridge"; $this->name = "HD Wallpapers Bridge";
$this->uri = "http://www.hdwallpapers.in/"; $this->uri = "http://www.hdwallpapers.in/";
$this->description = "Returns the latests wallpapers from HDWallpapers"; $this->description = "Returns the latests wallpapers from HDWallpapers";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -48,7 +48,7 @@ class HDWallpapersBridge extends BridgeAbstract {
for ($page = 1; $page <= $lastpage; $page++) { for ($page = 1; $page <= $lastpage; $page++) {
$link = $baseUri.'/'.$category.'/page/'.$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) { if ($page === 1) {
preg_match('/page\/(\d+)$/', $html->find('.pagination a', -2)->href, $matches); preg_match('/page\/(\d+)$/', $html->find('.pagination a', -2)->href, $matches);

View file

@ -7,12 +7,12 @@ class HentaiHavenBridge extends BridgeAbstract{
$this->name = "Hentai Haven"; $this->name = "Hentai Haven";
$this->uri = "http://hentaihaven.org/"; $this->uri = "http://hentaihaven.org/";
$this->description = "Returns releases from Hentai Haven"; $this->description = "Returns releases from Hentai Haven";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
} }
public function collectData(array $param){ 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) { foreach($html->find('div.zoe-grid') as $element) {
$item = new \Item(); $item = new \Item();
$item->uri = $element->find('div.brick-content h3 a', 0)->href; $item->uri = $element->find('div.brick-content h3 a', 0)->href;

View file

@ -9,7 +9,7 @@ class IdenticaBridge extends BridgeAbstract{
$this->name = "Identica Bridge"; $this->name = "Identica Bridge";
$this->uri = "https://identi.ca/"; $this->uri = "https://identi.ca/";
$this->description = "Returns user timelines"; $this->description = "Returns user timelines";
$this->update = "2014-05-25"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -25,10 +25,10 @@ class IdenticaBridge extends BridgeAbstract{
$html = ''; $html = '';
if (isset($param['u'])) { /* user timeline mode */ if (isset($param['u'])) { /* user timeline mode */
$this->request = $param['u']; $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 { 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) { foreach($html->find('li.major') as $dent) {

View file

@ -9,7 +9,7 @@ class InstagramBridge extends BridgeAbstract{
$this->name = "Instagram Bridge"; $this->name = "Instagram Bridge";
$this->uri = "http://instagram.com/"; $this->uri = "http://instagram.com/";
$this->description = "Returns the newest images"; $this->description = "Returns the newest images";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -25,10 +25,10 @@ class InstagramBridge extends BridgeAbstract{
$html = ''; $html = '';
if (isset($param['u'])) { /* user timeline mode */ if (isset($param['u'])) { /* user timeline mode */
$this->request = $param['u']; $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 { else {
$this->returnError('You must specify a Instagram username (?u=...).', 400); $this->returnClientError('You must specify a Instagram username (?u=...).');
} }
$innertext = null; $innertext = null;

View file

@ -5,7 +5,7 @@ class IsoHuntBridge extends BridgeAbstract{
$this->name = 'isoHunt Bridge'; // Is replaced later! $this->name = 'isoHunt Bridge'; // Is replaced later!
$this->uri = 'https://isohunt.to'; // Is replaced later! $this->uri = 'https://isohunt.to'; // Is replaced later!
$this->description = 'Returns the latest results by category or search result'; $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 * Get feeds for one of the "latest" categories
@ -190,7 +190,7 @@ class IsoHuntBridge extends BridgeAbstract{
else else
$this->request_search($params['search_name']); $this->request_search($params['search_name']);
} else { } else {
$this->returnError('Unknown request!', 400); $this->returnClientError('Unknown request!');
} }
} }
@ -262,7 +262,7 @@ class IsoHuntBridge extends BridgeAbstract{
$this->uri .= '/latest.php'; $this->uri .= '/latest.php';
break; break;
default: // No category applies default: // No category applies
$this->returnError('Undefined category: ' . $category . '!', 400); $this->returnClientError('Undefined category: ' . $category . '!');
} }
$html = $this->load_html($this->uri); $html = $this->load_html($this->uri);
@ -313,21 +313,21 @@ class IsoHuntBridge extends BridgeAbstract{
private function get_movie_torrents($html){ private function get_movie_torrents($html){
$container = $html->find('div#w0', 0); $container = $html->find('div#w0', 0);
if(!$container) if(!$container)
$this->returnError('Unable to find torrent container!', 500); $this->returnServerError('Unable to find torrent container!');
$torrents = $container->find('article'); $torrents = $container->find('article');
if(!$torrents) if(!$torrents)
$this->returnError('Unable to find torrents!', 500); $this->returnServerError('Unable to find torrents!');
foreach($torrents as $torrent){ foreach($torrents as $torrent){
$anchor = $torrent->find('a', 0); $anchor = $torrent->find('a', 0);
if(!$anchor) if(!$anchor)
$this->returnError('Unable to find anchor!', 500); $this->returnServerError('Unable to find anchor!');
$date = $torrent->find('small', 0); $date = $torrent->find('small', 0);
if(!$date) if(!$date)
$this->returnError('Unable to find date!', 500); $this->returnServerError('Unable to find date!');
$item = new \Item(); $item = new \Item();
@ -348,11 +348,11 @@ class IsoHuntBridge extends BridgeAbstract{
private function get_latest_hot_torrents($html){ private function get_latest_hot_torrents($html){
$container = $html->find('div#serps', 0); $container = $html->find('div#serps', 0);
if(!$container) if(!$container)
$this->returnError('Unable to find torrent container!', 500); $this->returnServerError('Unable to find torrent container!');
$torrents = $container->find('tr'); $torrents = $container->find('tr');
if(!$torrents) if(!$torrents)
$this->returnError('Unable to find torrents!', 500); $this->returnServerError('Unable to find torrents!');
// Remove first element (header row) // Remove first element (header row)
$torrents = array_slice($torrents, 1); $torrents = array_slice($torrents, 1);
@ -361,11 +361,11 @@ class IsoHuntBridge extends BridgeAbstract{
$cell = $torrent->find('td', 0); $cell = $torrent->find('td', 0);
if(!$cell) if(!$cell)
$this->returnError('Unable to find cell!', 500); $this->returnServerError('Unable to find cell!');
$element = $cell->find('a', 0); $element = $cell->find('a', 0);
if(!$element) if(!$element)
$this->returnError('Unable to find element!', 500); $this->returnServerError('Unable to find element!');
$item = new \Item(); $item = new \Item();
@ -386,11 +386,11 @@ class IsoHuntBridge extends BridgeAbstract{
private function get_latest_news($html){ private function get_latest_news($html){
$container = $html->find('div#postcontainer', 0); $container = $html->find('div#postcontainer', 0);
if(!$container) if(!$container)
$this->returnError('Unable to find post container!', 500); $this->returnServerError('Unable to find post container!');
$posts = $container->find('div.index-post'); $posts = $container->find('div.index-post');
if(!$posts) if(!$posts)
$this->returnError('Unable to find posts!', 500); $this->returnServerError('Unable to find posts!');
foreach($posts as $post){ foreach($posts as $post){
$item = new \Item(); $item = new \Item();
@ -408,7 +408,7 @@ class IsoHuntBridge extends BridgeAbstract{
private function latest_news_extract_author($post){ private function latest_news_extract_author($post){
$author = $post->find('small', 0); $author = $post->find('small', 0);
if(!$author) 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}' // The author is hidden within a string like: 'Posted by {author} on {date}'
preg_match('/Posted\sby\s(.*)\son/i', $author->innertext, $matches); 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){ private function latest_news_extract_timestamp($post){
$date = $post->find('small', 0); $date = $post->find('small', 0);
if(!$date) 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}' // The date is hidden within a string like: 'Posted by {author} on {date}'
preg_match('/Posted\sby\s.*\son\s(.*)/i', $date->innertext, $matches); 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){ private function latest_news_extract_title($post){
$title = $post->find('a', 0); $title = $post->find('a', 0);
if(!$title) if(!$title)
$this->returnError('Unable to find title!', 500); $this->returnServerError('Unable to find title!');
return $title->plaintext; return $title->plaintext;
} }
@ -445,7 +445,7 @@ class IsoHuntBridge extends BridgeAbstract{
private function latest_news_extract_uri($post){ private function latest_news_extract_uri($post){
$uri = $post->find('a', 0); $uri = $post->find('a', 0);
if(!$uri) if(!$uri)
$this->returnError('Unable to find uri!', 500); $this->returnServerError('Unable to find uri!');
return $uri->href; return $uri->href;
} }
@ -453,7 +453,7 @@ class IsoHuntBridge extends BridgeAbstract{
private function latest_news_extract_content($post){ private function latest_news_extract_content($post){
$content = $post->find('div', 0); $content = $post->find('div', 0);
if(!$content) if(!$content)
$this->returnError('Unable to find content!', 500); $this->returnServerError('Unable to find content!');
// Remove <h2>...</h2> (title) // Remove <h2>...</h2> (title)
foreach($content->find('h2') as $element){ foreach($content->find('h2') as $element){
@ -475,11 +475,11 @@ class IsoHuntBridge extends BridgeAbstract{
private function get_latest_torrents($html){ private function get_latest_torrents($html){
$container = $html->find('div#serps', 0); $container = $html->find('div#serps', 0);
if(!$container) if(!$container)
$this->returnError('Unable to find torrent container!', 500); $this->returnServerError('Unable to find torrent container!');
$torrents = $container->find('tr[data-key]'); $torrents = $container->find('tr[data-key]');
if(!$torrents) if(!$torrents)
$this->returnError('Unable to find torrents!', 500); $this->returnServerError('Unable to find torrents!');
foreach($torrents as $torrent){ foreach($torrents as $torrent){
$item = new \Item(); $item = new \Item();
@ -497,11 +497,11 @@ class IsoHuntBridge extends BridgeAbstract{
private function latest_torrents_extract_title($torrent){ private function latest_torrents_extract_title($torrent){
$cell = $torrent->find('td.title-row', 0); $cell = $torrent->find('td.title-row', 0);
if(!$cell) if(!$cell)
$this->returnError('Unable to find title cell!', 500); $this->returnServerError('Unable to find title cell!');
$title = $cell->find('span', 0); $title = $cell->find('span', 0);
if(!$title) if(!$title)
$this->returnError('Unable to find title!', 500); $this->returnServerError('Unable to find title!');
return $title->plaintext; return $title->plaintext;
} }
@ -509,11 +509,11 @@ class IsoHuntBridge extends BridgeAbstract{
private function latest_torrents_extract_uri($torrent){ private function latest_torrents_extract_uri($torrent){
$cell = $torrent->find('td.title-row', 0); $cell = $torrent->find('td.title-row', 0);
if(!$cell) if(!$cell)
$this->returnError('Unable to find title cell!', 500); $this->returnServerError('Unable to find title cell!');
$uri = $cell->find('a', 0); $uri = $cell->find('a', 0);
if(!$uri) if(!$uri)
$this->returnError('Unable to find uri!', 500); $this->returnServerError('Unable to find uri!');
return $this->fix_relative_uri($uri->href); return $this->fix_relative_uri($uri->href);
} }
@ -525,7 +525,7 @@ class IsoHuntBridge extends BridgeAbstract{
$user = $cell->find('a', 0); $user = $cell->find('a', 0);
if(!$user) if(!$user)
$this->returnError('Unable to find user!', 500); $this->returnServerError('Unable to find user!');
return $user->plaintext; return $user->plaintext;
} }
@ -533,7 +533,7 @@ class IsoHuntBridge extends BridgeAbstract{
private function latest_torrents_extract_timestamp($torrent){ private function latest_torrents_extract_timestamp($torrent){
$cell = $torrent->find('td.date-row', 0); $cell = $torrent->find('td.date-row', 0);
if(!$cell) if(!$cell)
$this->returnError('Unable to find date cell!', 500); $this->returnServerError('Unable to find date cell!');
return strtotime('-' . $cell->plaintext, time()); return strtotime('-' . $cell->plaintext, time());
} }
@ -545,7 +545,7 @@ class IsoHuntBridge extends BridgeAbstract{
private function load_html($uri){ private function load_html($uri){
$html = $this->file_get_html($uri); $html = $this->file_get_html($uri);
if(!$html) if(!$html)
$this->returnError('Unable to load ' . $uri . '!', 500); $this->returnServerError('Unable to load ' . $uri . '!');
return $html; return $html;
} }

View file

@ -6,7 +6,7 @@ class JapanExpoBridge extends BridgeAbstract{
$this->name = 'Japan Expo Actualités'; $this->name = 'Japan Expo Actualités';
$this->uri = 'http://www.japan-expo-paris.com/fr/actualites'; $this->uri = 'http://www.japan-expo-paris.com/fr/actualites';
$this->description = 'Returns most recent entries from Japan Expo actualités.'; $this->description = 'Returns most recent entries from Japan Expo actualités.';
$this->update = '2016-08-09'; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
{ {
@ -59,7 +59,7 @@ class JapanExpoBridge extends BridgeAbstract{
}; };
$link = 'http://www.japan-expo-paris.com/fr/actualites'; $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'); $fullcontent = (!empty($param['mode']) && $param['mode'] == 'full');
$count = 0; $count = 0;
@ -73,7 +73,7 @@ class JapanExpoBridge extends BridgeAbstract{
if ($fullcontent) { if ($fullcontent) {
if ($count < 5) { 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); $header = $article_html->find('header.pageHeadBox', 0);
$timestamp = strtotime($header->find('time', 0)->datetime); $timestamp = strtotime($header->find('time', 0)->datetime);
$title_html = $header->find('div.section', 0)->next_sibling(); $title_html = $header->find('div.section', 0)->next_sibling();

View file

@ -7,7 +7,7 @@ class KonachanBridge extends BridgeAbstract{
$this->name = "Konachan"; $this->name = "Konachan";
$this->uri = "http://konachan.com/"; $this->uri = "http://konachan.com/";
$this->description = "Returns images from given page"; $this->description = "Returns images from given page";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -31,7 +31,7 @@ class KonachanBridge extends BridgeAbstract{
if (isset($param['t'])) { if (isset($param['t'])) {
$tags = urlencode($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); $input_json = explode('Post.register(', $html);
foreach($input_json as $element) foreach($input_json as $element)
$data[] = preg_replace('/}\)(.*)/', '}', $element); $data[] = preg_replace('/}\)(.*)/', '}', $element);

View file

@ -6,7 +6,7 @@ class KoreusBridge extends BridgeAbstract{
$this->name = "Koreus"; $this->name = "Koreus";
$this->uri = "http://www.koreus.com/"; $this->uri = "http://www.koreus.com/";
$this->description = "Returns the 5 newest posts from Koreus (full text)"; $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) { private function KoreusStripCDATA($string) {
@ -23,7 +23,7 @@ class KoreusBridge extends BridgeAbstract{
} }
public function collectData(array $param){ 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; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {

View file

@ -5,7 +5,7 @@ class KununuBridge extends BridgeAbstract{
$this->name = "Kununu Bridge"; /* This will be replaced later! */ $this->name = "Kununu Bridge"; /* This will be replaced later! */
$this->uri = "https://www.kununu.com"; /* 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->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'] = $this->parameters['global'] =
'[ '[
@ -64,12 +64,12 @@ class KununuBridge extends BridgeAbstract{
// Get Site // Get Site
$site = strtolower(trim($params['site'])); $site = strtolower(trim($params['site']));
if(!isset($site) || empty($site) || !$this->site_is_valid($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) // Get Company (fixing whitespace and umlauts)
$company = $this->encode_umlauts(strtolower(str_replace(' ', '-', trim($params['company'])))); $company = $this->encode_umlauts(strtolower(str_replace(' ', '-', trim($params['company']))));
if(!isset($company) || empty($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 $full = false; // By default we'll load only short article
if(isset($params['full'])) if(isset($params['full']))
@ -87,7 +87,7 @@ class KununuBridge extends BridgeAbstract{
$section = 'reviews'; $section = 'reviews';
break; break;
default: 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 // Update URI for the content
@ -96,7 +96,7 @@ class KununuBridge extends BridgeAbstract{
// Load page // Load page
$html = $this->file_get_html($this->uri); $html = $this->file_get_html($this->uri);
if($html === false) 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 // Update name for this request
$this->name = $this->extract_company_name($html) . ' - ' . $this->name; $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) // Find the section with all the panels (reviews)
$section = $html->find('section.kununu-scroll-element', 0); $section = $html->find('section.kununu-scroll-element', 0);
if($section === false) if($section === false)
$this->returnError('Unable to find panel section!', 404); $this->returnServerError('Unable to find panel section!');
// Find all articles (within the panels) // Find all articles (within the panels)
$articles = $section->find('article'); $articles = $section->find('article');
if($articles === false || empty($articles)) if($articles === false || empty($articles))
$this->returnError('Unable to find articles!', 404); $this->returnServerError('Unable to find articles!');
// Go through all articles // Go through all articles
foreach($articles as $article){ foreach($articles as $article){
@ -171,11 +171,11 @@ class KununuBridge extends BridgeAbstract{
private function extract_company_name($html){ private function extract_company_name($html){
$panel = $html->find('div.panel', 0); $panel = $html->find('div.panel', 0);
if($panel === false) 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); $company_name = $panel->find('h1', 0);
if($company_name === false) if($company_name === false)
$this->returnError('Cannot find company name!', 404); $this->returnServerError('Cannot find company name!');
return $company_name->plaintext; return $company_name->plaintext;
} }
@ -187,7 +187,7 @@ class KununuBridge extends BridgeAbstract{
// They conviniently provide a time attribute for us :) // They conviniently provide a time attribute for us :)
$date = $article->find('time[itemprop=dtreviewed]', 0); $date = $article->find('time[itemprop=dtreviewed]', 0);
if($date === false) if($date === false)
$this->returnError('Cannot find article date!', 404); $this->returnServerError('Cannot find article date!');
return strtotime($date->datetime); return strtotime($date->datetime);
} }
@ -198,7 +198,7 @@ class KununuBridge extends BridgeAbstract{
private function extract_article_rating($article){ private function extract_article_rating($article){
$rating = $article->find('span.rating', 0); $rating = $article->find('span.rating', 0);
if($rating === false) if($rating === false)
$this->returnError('Cannot find article rating!', 404); $this->returnServerError('Cannot find article rating!');
return $rating->getAttribute('aria-label'); return $rating->getAttribute('aria-label');
} }
@ -209,7 +209,7 @@ class KununuBridge extends BridgeAbstract{
private function extract_article_summary($article){ private function extract_article_summary($article){
$summary = $article->find('[itemprop=summary]', 0); $summary = $article->find('[itemprop=summary]', 0);
if($summary === false) if($summary === false)
$this->returnError('Cannot find article summary!', 404); $this->returnServerError('Cannot find article summary!');
return strip_tags($summary->innertext); 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! // Notice: This first part is the same as in extract_article_summary!
$summary = $article->find('[itemprop=summary]', 0); $summary = $article->find('[itemprop=summary]', 0);
if($summary === false) if($summary === false)
$this->returnError('Cannot find article summary!', 404); $this->returnServerError('Cannot find article summary!');
$anchor = $summary->find('a', 0); $anchor = $summary->find('a', 0);
if($anchor === false) if($anchor === false)
$this->returnError('Cannot find article URI!', 404); $this->returnServerError('Cannot find article URI!');
return 'https://www.kununu.com' . $anchor->href; return 'https://www.kununu.com' . $anchor->href;
} }
@ -237,7 +237,7 @@ class KununuBridge extends BridgeAbstract{
// We need to parse the aside manually // We need to parse the aside manually
$aside = $article->find('aside', 0); $aside = $article->find('aside', 0);
if($aside === false) 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) // Go through all h2 elements to find index of required span (I know... it's stupid)
$author_position = 'Unknown'; $author_position = 'Unknown';
@ -257,7 +257,7 @@ class KununuBridge extends BridgeAbstract{
private function extract_article_description($article){ private function extract_article_description($article){
$description = $article->find('div[itemprop=description]', 0); $description = $article->find('div[itemprop=description]', 0);
if($description === false) if($description === false)
$this->returnError('Cannot find article description!', 404); $this->returnServerError('Cannot find article description!');
return $this->fix_url($description->innertext); return $this->fix_url($description->innertext);
} }
@ -269,12 +269,12 @@ class KununuBridge extends BridgeAbstract{
// Load full article // Load full article
$html = file_get_html($uri); $html = file_get_html($uri);
if($html === false) if($html === false)
$this->returnError('Could not load full description!', 404); $this->returnServerError('Could not load full description!');
// Find the article // Find the article
$article = $html->find('article', 0); $article = $html->find('article', 0);
if($article === false) 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 :) // Luckily they use the same layout for the review overview and full article pages :)
return $this->extract_article_description($article); return $this->extract_article_description($article);

View file

@ -12,7 +12,7 @@ class LWNprevBridge extends BridgeAbstract{
$this->name = 'LWN Free Weekly Edition'; $this->name = 'LWN Free Weekly Edition';
$this->uri = 'https://lwn.net/free/bigpage'; $this->uri = 'https://lwn.net/free/bigpage';
$this->description = 'LWN Free Weekly Edition available one week late'; $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) $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); libxml_use_internal_errors(true);
$html=DOMDocument::loadHTML($html); $html=DOMDocument::loadHTML($html);

View file

@ -7,7 +7,7 @@ class LeBonCoinBridge extends BridgeAbstract{
$this->name = "LeBonCoin"; $this->name = "LeBonCoin";
$this->uri = "http://www.leboncoin.fr"; $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->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[] = $this->parameters[] =
'[ '[
@ -239,7 +239,7 @@ class LeBonCoinBridge extends BridgeAbstract{
else { else {
$link = 'http://www.leboncoin.fr/' . $param['c'] . '/offres/' . $param['r'] . '/?f=a&th=1&q=' . urlencode($param['k']); $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); $list = $html->find('.tabsContent', 0);
if($list === NULL) { if($list === NULL) {

View file

@ -6,7 +6,7 @@ class LeJournalDuGeekBridge extends BridgeAbstract{
$this->name = "journaldugeek.com (FR)"; $this->name = "journaldugeek.com (FR)";
$this->uri = "http://www.journaldugeek.com/"; $this->uri = "http://www.journaldugeek.com/";
$this->description = "Returns the 5 newest posts from LeJournalDuGeek (full text)."; $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) { private function LeJournalDuGeekStripCDATA($string) {
@ -38,7 +38,7 @@ class LeJournalDuGeekBridge extends BridgeAbstract{
} }
public function collectData(array $param){ 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; $limit = 0;
foreach($rssFeed->find('item') as $element) { foreach($rssFeed->find('item') as $element) {

View file

@ -7,7 +7,7 @@ class LeMondeInformatiqueBridge extends BridgeAbstract {
$this->name = "Le Monde Informatique"; $this->name = "Le Monde Informatique";
$this->uri = "http://www.lemondeinformatique.fr/"; $this->uri = "http://www.lemondeinformatique.fr/";
$this->description = "Returns the newest articles."; $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'; $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; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {
@ -44,7 +44,7 @@ class LeMondeInformatiqueBridge extends BridgeAbstract {
$article_uri = $element->innertext; $article_uri = $element->innertext;
$article_uri = substr($article_uri, strpos($article_uri, '<link>') + 6); $article_uri = substr($article_uri, strpos($article_uri, '<link>') + 6);
$article_uri = substr($article_uri, 0, strpos($article_uri, '</link>')); $article_uri = substr($article_uri, 0, strpos($article_uri, '</link>'));
$article_html = $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_content = CleanArticle($article_html->find('div#article', 0)->innertext);
$article_title = $article_html->find('h1.cleanprint-title', 0)->plaintext; $article_title = $article_html->find('h1.cleanprint-title', 0)->plaintext;

View file

@ -7,12 +7,12 @@ class LesJoiesDuCodeBridge extends BridgeAbstract{
$this->name = "Les Joies Du Code"; $this->name = "Les Joies Du Code";
$this->uri = "http://lesjoiesducode.fr/"; $this->uri = "http://lesjoiesducode.fr/";
$this->description = "LesJoiesDuCode"; $this->description = "LesJoiesDuCode";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
} }
public function collectData(array $param){ 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) { foreach($html->find('div.blog-post') as $element) {
$item = new Item(); $item = new Item();

View file

@ -8,12 +8,12 @@ class LichessBridge extends BridgeAbstract
$this->name = 'Lichess Blog'; $this->name = 'Lichess Blog';
$this->uri = 'http://lichess.org/blog'; $this->uri = 'http://lichess.org/blog';
$this->description = 'Returns the 5 newest posts from the Lichess blog (full text)'; $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) 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; $posts_loaded = 0;
foreach($xml_feed->find('entry') as $entry) foreach($xml_feed->find('entry') as $entry)

View file

@ -7,7 +7,7 @@ class LinkedInCompany extends BridgeAbstract{
$this->name = "LinkedIn Company"; $this->name = "LinkedIn Company";
$this->uri = "https://www.linkedin.com/"; $this->uri = "https://www.linkedin.com/";
$this->description = "Returns most recent actus from Company on LinkedIn. (https://www.linkedin.com/company/<strong style=\"font-weight:bold;\">apple</strong>)"; $this->description = "Returns most recent actus from Company on LinkedIn. (https://www.linkedin.com/company/<strong style=\"font-weight:bold;\">apple</strong>)";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -22,7 +22,7 @@ class LinkedInCompany extends BridgeAbstract{
$html = ''; $html = '';
$link = 'https://www.linkedin.com/company/'.$param[c]; $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) { foreach($html->find('//*[@id="my-feed-post"]/li') as $element) {
$title = $element->find('span.share-body', 0)->innertext; $title = $element->find('span.share-body', 0)->innertext;

View file

@ -7,7 +7,7 @@ class LolibooruBridge extends BridgeAbstract{
$this->name = "Lolibooru"; $this->name = "Lolibooru";
$this->uri = "http://lolibooru.moe/"; $this->uri = "http://lolibooru.moe/";
$this->description = "Returns images from given page and tags"; $this->description = "Returns images from given page and tags";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -32,7 +32,7 @@ class LolibooruBridge extends BridgeAbstract{
if (isset($param['t'])) { if (isset($param['t'])) {
$tags = urlencode($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); $input_json = explode('Post.register(', $html);
foreach($input_json as $element) foreach($input_json as $element)
$data[] = preg_replace('/}\)(.*)/', '}', $element); $data[] = preg_replace('/}\)(.*)/', '}', $element);

View file

@ -8,7 +8,7 @@ class MangareaderBridge extends BridgeAbstract{
$this->name = "Mangareader Bridge"; $this->name = "Mangareader Bridge";
$this->uri = "http://www.mangareader.net"; $this->uri = "http://www.mangareader.net";
$this->description = "Returns the latest updates, popular mangas or manga updates (new chapters)"; $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 latest updates"] = '[]';
$this->parameters["Get popular mangas"] = $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 // We'll use the DOM parser for this as it makes navigation easier
$html = file_get_contents("http://www.mangareader.net/" . $path); $html = file_get_contents("http://www.mangareader.net/" . $path);
if(!$html){ if(!$html){
$this->returnError('Could not receive data for ' . $path . '!', 400); $this->returnClientError('Could not receive data for ' . $path . '!');
} }
$doc = new DomDocument; $doc = new DomDocument;
@$doc->loadHTML($html); @$doc->loadHTML($html);

View file

@ -7,7 +7,7 @@ class MilbooruBridge extends BridgeAbstract{
$this->name = "Milbooru"; $this->name = "Milbooru";
$this->uri = "http://sheslostcontrol.net/moe/shimmie/"; $this->uri = "http://sheslostcontrol.net/moe/shimmie/";
$this->description = "Returns images from given page"; $this->description = "Returns images from given page";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -31,7 +31,7 @@ class MilbooruBridge extends BridgeAbstract{
if (isset($param['t'])) { if (isset($param['t'])) {
$tags = urlencode($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) { foreach($html->find('div[class=shm-image-list] span[class=thumb]') as $element) {

View file

@ -6,11 +6,11 @@ class MondeDiploBridge extends BridgeAbstract{
$this->name = 'Monde Diplomatique'; $this->name = 'Monde Diplomatique';
$this->uri = 'http://www.monde-diplomatique.fr'; $this->uri = 'http://www.monde-diplomatique.fr';
$this->description = "Returns most recent results from MondeDiplo."; $this->description = "Returns most recent results from MondeDiplo.";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
} }
public function collectData(array $param){ 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) { foreach($html->find('div.unarticle') as $article) {
$element = $article->parent(); $element = $article->parent();

View file

@ -6,7 +6,7 @@ class MsnMondeBridge extends BridgeAbstract{
$this->name = 'MSN Actu Monde'; $this->name = 'MSN Actu Monde';
$this->uri = 'http://www.msn.com/fr-fr/actualite/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->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) { private function MsnMondeExtractContent($url, &$item) {
@ -16,7 +16,7 @@ class MsnMondeBridge extends BridgeAbstract{
} }
public function collectData(array $param){ 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; $limit = 0;
foreach($html->find('.smalla') as $article) { foreach($html->find('.smalla') as $article) {
if($limit < 10) { if($limit < 10) {

View file

@ -7,7 +7,7 @@ class MspabooruBridge extends BridgeAbstract{
$this->name = "Mspabooru"; $this->name = "Mspabooru";
$this->uri = "http://mspabooru.com/"; $this->uri = "http://mspabooru.com/";
$this->description = "Returns images from given page"; $this->description = "Returns images from given page";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -34,7 +34,7 @@ class MspabooruBridge extends BridgeAbstract{
if (isset($param['t'])) { if (isset($param['t'])) {
$tags = urlencode($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) { foreach($html->find('div[class=content] span') as $element) {

View file

@ -6,7 +6,7 @@ class NakedSecurityBridge extends BridgeAbstract {
$this->name = 'Naked Security'; $this->name = 'Naked Security';
$this->uri = 'https://nakedsecurity.sophos.com/'; $this->uri = 'https://nakedsecurity.sophos.com/';
$this->description = 'Returns the newest articles.'; $this->description = 'Returns the newest articles.';
$this->update = '2016-08-09'; $this->update = '2016-08-17';
} }
public function collectData(array $param) { public function collectData(array $param) {
@ -36,7 +36,7 @@ class NakedSecurityBridge extends BridgeAbstract {
} }
$feedUrl = 'https://feeds.feedburner.com/nakedsecurity?format=xml'; $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; $limit = 0;
foreach ($html->find('item') as $element) { foreach ($html->find('item') as $element) {
@ -44,7 +44,7 @@ class NakedSecurityBridge extends BridgeAbstract {
//Retrieve article Uri and get that page //Retrieve article Uri and get that page
$article_uri = $element->find('guid', 0)->plaintext; $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 //Build article contents from corresponding elements
$article_title = trim($element->find('title', 0)->plaintext); $article_title = trim($element->find('title', 0)->plaintext);

View file

@ -7,13 +7,13 @@ class NasaApodBridge extends BridgeAbstract{
$this->name = "NASA APOD Bridge"; $this->name = "NASA APOD Bridge";
$this->uri = "http://apod.nasa.gov/apod/astropix.html"; $this->uri = "http://apod.nasa.gov/apod/astropix.html";
$this->description = "Returns the 3 latest NASA APOD pictures and explanations"; $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) { 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("<br>", $html->find('b', 0)->innertext); $list = explode("<br>", $html->find('b', 0)->innertext);
for($i = 0; $i < 3;$i++) for($i = 0; $i < 3;$i++)

View file

@ -6,7 +6,7 @@ class NeuviemeArtBridge extends BridgeAbstract {
$this->name = '9ème Art Bridge'; $this->name = '9ème Art Bridge';
$this->uri = "http://www.9emeart.fr/"; $this->uri = "http://www.9emeart.fr/";
$this->description = "Returns the newest articles."; $this->description = "Returns the newest articles.";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
} }
public function collectData(array $param) { public function collectData(array $param) {
@ -20,7 +20,7 @@ class NeuviemeArtBridge extends BridgeAbstract {
} }
$feedUrl = 'http://www.9emeart.fr/9emeart.rss'; $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; $limit = 0;
foreach ($html->find('item') as $element) { foreach ($html->find('item') as $element) {
@ -28,7 +28,7 @@ class NeuviemeArtBridge extends BridgeAbstract {
//Retrieve article Uri and get that page //Retrieve article Uri and get that page
$article_uri = $element->find('guid', 0)->plaintext; $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 //Build article contents from corresponding elements
$article_title = trim($element->find('title', 0)->plaintext); $article_title = trim($element->find('title', 0)->plaintext);

View file

@ -6,7 +6,7 @@ class NextInpactBridge extends BridgeAbstract {
$this->name = "NextInpact Bridge"; $this->name = "NextInpact Bridge";
$this->uri = "http://www.nextinpact.com/"; $this->uri = "http://www.nextinpact.com/";
$this->description = "Returns the newest articles."; $this->description = "Returns the newest articles.";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
} }
private function StripCDATA($string) { private function StripCDATA($string) {
@ -27,7 +27,7 @@ class NextInpactBridge extends BridgeAbstract {
} }
public function collectData(array $param) { 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; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {

View file

@ -7,7 +7,7 @@ class NextgovBridge extends BridgeAbstract {
$this->name = 'Nextgov Bridge'; $this->name = 'Nextgov Bridge';
$this->uri = 'https://www.nextgov.com/'; $this->uri = 'https://www.nextgov.com/';
$this->description = 'USA Federal technology news, best practices, and web 2.0 tools.'; $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[] = $this->parameters[] =
'[ '[
@ -55,9 +55,9 @@ class NextgovBridge extends BridgeAbstract {
if (empty($category)) if (empty($category))
$category = 'all'; $category = 'all';
if ($category !== preg_replace('/[^a-z-]+/', '', $category) || strlen($category > 32)) 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.'/'; $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; $limit = 0;
foreach ($html->find('item') as $element) { foreach ($html->find('item') as $element) {
@ -69,7 +69,7 @@ class NextgovBridge extends BridgeAbstract {
$article_subtitle = $element->find('description', 0)->plaintext; $article_subtitle = $element->find('description', 0)->plaintext;
$article_timestamp = strtotime($element->find('pubDate', 0)->plaintext); $article_timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$article_thumbnail = ExtractFromDelimiters($element->innertext, '<media:content url="', '"'); $article_thumbnail = ExtractFromDelimiters($element->innertext, '<media:content url="', '"');
$article = $this->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 = $article->find('div.wysiwyg', 0)->innertext;
$contents = StripWithDelimiters($contents, '<div class="ad-container">', '</div>'); $contents = StripWithDelimiters($contents, '<div class="ad-container">', '</div>');

View file

@ -6,17 +6,17 @@ class NiceMatinBridge extends BridgeAbstract{
$this->name = "NiceMatin"; $this->name = "NiceMatin";
$this->uri = "http://www.nicematin.com/"; $this->uri = "http://www.nicematin.com/";
$this->description = "Returns the 10 newest posts from NiceMatin (full text)"; $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) { private function NiceMatinExtractContent($url) {
$html = $this->file_get_html($url); $html = $this->file_get_html($url);
if(!$html) 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); $content = $html->find('article', 0);
if(!$content) if(!$content)
$this->returnError('Could not find \'section\'!', 404); $this->returnServerError('Could not find \'section\'!');
$text = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $content->innertext); $text = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $content->innertext);
$text = strip_tags($text, '<p><a><img>'); $text = strip_tags($text, '<p><a><img>');
@ -24,7 +24,7 @@ class NiceMatinBridge extends BridgeAbstract{
} }
public function collectData(array $param){ 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; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {

View file

@ -7,7 +7,7 @@ class NovelUpdatesBridge extends BridgeAbstract{
$this->name = "Novel Updates"; $this->name = "Novel Updates";
$this->uri = "http://www.novelupdates.com/"; $this->uri = "http://www.novelupdates.com/";
$this->description = "Returns releases from Novel Updates"; $this->description = "Returns releases from Novel Updates";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
{ {
@ -19,14 +19,14 @@ class NovelUpdatesBridge extends BridgeAbstract{
public function collectData(array $param){ public function collectData(array $param){
if (!isset($param['n'])) if (!isset($param['n']))
$this->returnError('You must specify the novel URL (/series/...)', 400); $this->returnClientError('You must specify the novel URL (/series/...)');
$thread = parse_url($param['n']) or $this->returnError('This URL seems malformed, please check it.', 400); $thread = parse_url($param['n']) or $this->returnClientError('This URL seems malformed, please check it.');
if($thread['host'] !== 'www.novelupdates.com') if($thread['host'] !== 'www.novelupdates.com')
$this->returnError('NovelUpdates URL only.', 400); $this->returnClientError('NovelUpdates URL only.');
if(strpos($thread['path'], 'series/') === FALSE) 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'].''; $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; $this->request = $fullhtml->find('h4.seriestitle', 0)->plaintext;
// dirty fix for nasty simpledom bug: https://github.com/sebsauvage/rss-bridge/issues/259 // dirty fix for nasty simpledom bug: https://github.com/sebsauvage/rss-bridge/issues/259
// forcefully removes tbody // forcefully removes tbody

View file

@ -7,7 +7,7 @@ class NumeramaBridge extends BridgeAbstract{
$this->name = 'Numerama'; $this->name = 'Numerama';
$this->uri = 'http://www.numerama.com/'; $this->uri = 'http://www.numerama.com/';
$this->description = 'Returns the 5 newest posts from Numerama (full text)'; $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/'; $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; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {
@ -32,7 +32,7 @@ class NumeramaBridge extends BridgeAbstract{
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$article_url = NumeramaStripCDATA($element->find('guid', 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 = $article_html->find('section[class=related-article]', 0)->innertext = ''; // remove related articles block
$contents = '<img alt="" style="max-width:300px;" src="'.$article_html->find('meta[property=og:image]', 0)->getAttribute('content').'">'; // add post picture $contents = '<img alt="" style="max-width:300px;" src="'.$article_html->find('meta[property=og:image]', 0)->getAttribute('content').'">'; // add post picture
$contents = $contents.$article_html->find('article[class=post-content]', 0)->innertext; // extract the post $contents = $contents.$article_html->find('article[class=post-content]', 0)->innertext; // extract the post

View file

@ -7,7 +7,7 @@ class OpenClassroomsBridge extends BridgeAbstract{
$this->name = "OpenClassrooms Bridge"; $this->name = "OpenClassrooms Bridge";
$this->uri = "https://openclassrooms.com/"; $this->uri = "https://openclassrooms.com/";
$this->description = "Returns latest tutorials from OpenClassrooms."; $this->description = "Returns latest tutorials from OpenClassrooms.";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
@ -62,13 +62,13 @@ class OpenClassroomsBridge extends BridgeAbstract{
public function collectData(array $param){ public function collectData(array $param){
if (empty($param['u'])) if (empty($param['u']))
{ {
$this->returnError('Error: You must chose a category.', 404); $this->returnServerError('Error: You must chose a category.');
} }
$html = ''; $html = '';
$link = 'https://openclassrooms.com/courses?categories='.$param['u'].'&title=&sort=updatedAt+desc'; $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) { foreach($html->find('.courseListItem') as $element) {
$item = new \Item(); $item = new \Item();

View file

@ -10,7 +10,7 @@ class ParuVenduImmoBridge extends BridgeAbstract
$this->name = "Paru Vendu Immobilier"; $this->name = "Paru Vendu Immobilier";
$this->uri = "http://www.paruvendu.fr"; $this->uri = "http://www.paruvendu.fr";
$this->description = "Returns the ads from the first page of search result."; $this->description = "Returns the ads from the first page of search result.";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
@ -66,7 +66,7 @@ class ParuVenduImmoBridge extends BridgeAbstract
$link .= '&lo='.urlencode($param['lo']); $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) { foreach($html->find('div.annonce a') as $element) {

View file

@ -11,7 +11,7 @@ class PickyWallpapersBridge extends BridgeAbstract {
$this->name = "PickyWallpapers Bridge"; $this->name = "PickyWallpapers Bridge";
$this->uri = "http://www.pickywallpapers.com/"; $this->uri = "http://www.pickywallpapers.com/";
$this->description = "Returns the latests wallpapers from PickyWallpapers"; $this->description = "Returns the latests wallpapers from PickyWallpapers";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -41,7 +41,7 @@ class PickyWallpapersBridge extends BridgeAbstract {
public function collectData(array $param){ public function collectData(array $param){
$html = ''; $html = '';
if (!isset($param['c'])) { 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 { } else {
$baseUri = 'http://www.pickywallpapers.com'; $baseUri = 'http://www.pickywallpapers.com';
@ -55,7 +55,7 @@ class PickyWallpapersBridge extends BridgeAbstract {
for ($page = 1; $page <= $lastpage; $page++) { for ($page = 1; $page <= $lastpage; $page++) {
$link = $baseUri.'/'.$this->resolution.'/'.$this->category.'/'.(!empty($this->subcategory)?$this->subcategory.'/':'').'page-'.$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) { if ($page === 1) {
preg_match('/page-(\d+)\/$/', $html->find('.pages li a', -2)->href, $matches); preg_match('/page-(\d+)\/$/', $html->find('.pages li a', -2)->href, $matches);

View file

@ -11,7 +11,7 @@ class PinterestBridge extends BridgeAbstract{
$this->name = "Pinterest Bridge"; $this->name = "Pinterest Bridge";
$this->uri = "http://www.pinterest.com"; $this->uri = "http://www.pinterest.com";
$this->description = "Returns the newest images on a board"; $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"] = $this->parameters["By username and board"] =
'[ '[
@ -41,26 +41,26 @@ class PinterestBridge extends BridgeAbstract{
if (empty($param['u'])) 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'])) 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->username = $param['u'];
$this->board = $param['b']; $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'])) } else if (isset($param['q']))
{ {
$this->query = $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 { 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=...).');
} }

View file

@ -6,7 +6,7 @@ class PlanetLibreBridge extends BridgeAbstract{
$this->name = "PlanetLibre"; $this->name = "PlanetLibre";
$this->uri = "http://www.planet-libre.org"; $this->uri = "http://www.planet-libre.org";
$this->description = "Returns the 5 newest posts from PlanetLibre (full text)"; $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){ private function PlanetLibreExtractContent($url){
@ -16,7 +16,7 @@ class PlanetLibreBridge extends BridgeAbstract{
} }
public function collectData(array $param){ 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; $limit = 0;
foreach($html->find('div.post') as $element) { foreach($html->find('div.post') as $element) {
if($limit < 5) { if($limit < 5) {

View file

@ -7,14 +7,14 @@ class ProjectMGameBridge extends BridgeAbstract{
$this->name = "Project M Game Bridge"; $this->name = "Project M Game Bridge";
$this->uri = "http://projectmgame.com/en/"; $this->uri = "http://projectmgame.com/en/";
$this->description = "Returns the newest articles."; $this->description = "Returns the newest articles.";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
} }
public function collectData(array $param){ public function collectData(array $param){
$html = ''; $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) { foreach($html->find('article') as $article) {
$item = new \Item(); $item = new \Item();

View file

@ -5,7 +5,7 @@ class RTBFBridge extends BridgeAbstract {
$this->uri = "http://www.rtbf.be/auvio/emissions"; $this->uri = "http://www.rtbf.be/auvio/emissions";
$this->description = "Returns the newest RTBF videos by series ID"; $this->description = "Returns the newest RTBF videos by series ID";
$this->maintainer = "Frenzie"; $this->maintainer = "Frenzie";
$this->update = "2016-08-15"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -25,7 +25,7 @@ class RTBFBridge extends BridgeAbstract {
$count = 0; $count = 0;
if (isset($param['c'])) { 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) { foreach($html->find('section[id!=widget-ml-avoiraussi-] .rtbf-media-grid article') as $element) {
if($count < $limit) { if($count < $limit) {
@ -44,7 +44,7 @@ class RTBFBridge extends BridgeAbstract {
} }
} }
else { else {
$this->returnError('You must specify a series id.', 400); $this->returnClientError('You must specify a series id.');
} }
} }

View file

@ -7,7 +7,7 @@ class Releases3DSBridge extends BridgeAbstract {
$this->name = "3DS Scene Releases"; $this->name = "3DS Scene Releases";
$this->uri = "http://www.3dsdb.com/"; $this->uri = "http://www.3dsdb.com/";
$this->description = "Returns the newest scene releases."; $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'; $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; $limit = 0;
foreach (array_reverse(explode('<release>', $xml)) as $element) { foreach (array_reverse(explode('<release>', $xml)) as $element) {

View file

@ -6,7 +6,7 @@ class ReporterreBridge extends BridgeAbstract{
$this->name = "Reporterre Bridge"; $this->name = "Reporterre Bridge";
$this->uri = "http://www.reporterre.net/"; $this->uri = "http://www.reporterre.net/";
$this->description = "Returns the newest articles."; $this->description = "Returns the newest articles.";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
} }
private function ExtractContentReporterre($url) { private function ExtractContentReporterre($url) {
@ -27,7 +27,7 @@ class ReporterreBridge extends BridgeAbstract{
} }
public function collectData(array $param){ 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; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {

View file

@ -7,7 +7,7 @@ class Rue89Bridge extends BridgeAbstract{
$this->name = "Rue89"; $this->name = "Rue89";
$this->uri = "http://rue89.nouvelobs.com/"; $this->uri = "http://rue89.nouvelobs.com/";
$this->description = "Returns the 5 newest posts from Rue89 (full text)"; $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){ 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; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {

View file

@ -7,7 +7,7 @@ class Rule34Bridge extends BridgeAbstract{
$this->name = "Rule34"; $this->name = "Rule34";
$this->uri = "http://rule34.xxx/"; $this->uri = "http://rule34.xxx/";
$this->description = "Returns images from given page"; $this->description = "Returns images from given page";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -33,7 +33,7 @@ class Rule34Bridge extends BridgeAbstract{
if (isset($param['t'])) { if (isset($param['t'])) {
$tags = urlencode($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) { foreach($html->find('div[class=content] span') as $element) {

View file

@ -7,7 +7,7 @@ class Rule34pahealBridge extends BridgeAbstract{
$this->name = "Rule34paheal"; $this->name = "Rule34paheal";
$this->uri = "http://rule34.paheal.net/"; $this->uri = "http://rule34.paheal.net/";
$this->description = "Returns images from given page"; $this->description = "Returns images from given page";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -32,7 +32,7 @@ class Rule34pahealBridge extends BridgeAbstract{
if (isset($param['t'])) { if (isset($param['t'])) {
$tags = urlencode($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) { foreach($html->find('div[class=shm-image-list] div[class=shm-thumb]') as $element) {

View file

@ -7,7 +7,7 @@ class SafebooruBridge extends BridgeAbstract{
$this->name = "Safebooru"; $this->name = "Safebooru";
$this->uri = "http://safebooru.org/"; $this->uri = "http://safebooru.org/";
$this->description = "Returns images from given page"; $this->description = "Returns images from given page";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -34,7 +34,7 @@ class SafebooruBridge extends BridgeAbstract{
if (isset($param['t'])) { if (isset($param['t'])) {
$tags = urlencode($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) { foreach($html->find('div[class=content] span') as $element) {

View file

@ -7,7 +7,7 @@ class SakugabooruBridge extends BridgeAbstract{
$this->name = "Sakugabooru"; $this->name = "Sakugabooru";
$this->uri = "http://sakuga.yshi.org/"; $this->uri = "http://sakuga.yshi.org/";
$this->description = "Returns images from given page"; $this->description = "Returns images from given page";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -31,7 +31,7 @@ class SakugabooruBridge extends BridgeAbstract{
if (isset($param['t'])) { if (isset($param['t'])) {
$tags = urlencode($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); $input_json = explode('Post.register(', $html);
foreach($input_json as $element) foreach($input_json as $element)
$data[] = preg_replace('/}\)(.*)/', '}', $element); $data[] = preg_replace('/}\)(.*)/', '}', $element);

View file

@ -7,13 +7,13 @@ class ScmbBridge extends BridgeAbstract{
$this->name = "Se Coucher Moins Bête Bridge"; $this->name = "Se Coucher Moins Bête Bridge";
$this->uri = "http://secouchermoinsbete.fr/"; $this->uri = "http://secouchermoinsbete.fr/";
$this->description = "Returns the newest anecdotes."; $this->description = "Returns the newest anecdotes.";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
} }
public function collectData(array $param){ public function collectData(array $param){
$html = ''; $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) { foreach($html->find('article') as $article) {
$item = new \Item(); $item = new \Item();

View file

@ -7,7 +7,7 @@ class ScoopItBridge extends BridgeAbstract{
$this->name = "ScoopIt"; $this->name = "ScoopIt";
$this->uri = "http://www.scoop.it"; $this->uri = "http://www.scoop.it";
$this->description = "Returns most recent results from ScoopIt."; $this->description = "Returns most recent results from ScoopIt.";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -25,7 +25,7 @@ class ScoopItBridge extends BridgeAbstract{
$this->request = $param['u']; $this->request = $param['u'];
$link = 'http://scoop.it/search?q=' .urlencode($this->request); $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) { foreach($html->find('div.post-view') as $element) {
$item = new Item(); $item = new Item();
@ -35,7 +35,7 @@ class ScoopItBridge extends BridgeAbstract{
$this->items[] = $item; $this->items[] = $item;
} }
} else { } else {
$this->returnError('You must specify a keyword', 404); $this->returnServerError('You must specify a keyword');
} }
} }

View file

@ -8,7 +8,7 @@ class SensCritiqueBridge extends BridgeAbstract {
$this->name = "Sens Critique"; $this->name = "Sens Critique";
$this->uri = "http://www.senscritique.com"; $this->uri = "http://www.senscritique.com";
$this->description = "Sens Critique news"; $this->description = "Sens Critique news";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -59,13 +59,13 @@ class SensCritiqueBridge extends BridgeAbstract {
} else if ((isset($param['mu']) && $param['mu'])) { } else if ((isset($param['mu']) && $param['mu'])) {
$this->collectMusicsData(); $this->collectMusicsData();
} else { } else {
$this->returnError('You must choose a category', 400); $this->returnClientError('You must choose a category');
} }
} }
private function collectMoviesData() { private function collectMoviesData() {
$html = ''; $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); $list = $html->find('ul.elpr-list', 0);
$this->extractDataFromList($list); $this->extractDataFromList($list);
@ -73,7 +73,7 @@ class SensCritiqueBridge extends BridgeAbstract {
private function collectSeriesData() { private function collectSeriesData() {
$html = ''; $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); $list = $html->find('ul.elpr-list', 0);
$this->extractDataFromList($list); $this->extractDataFromList($list);
@ -81,7 +81,7 @@ class SensCritiqueBridge extends BridgeAbstract {
private function collectGamesData() { private function collectGamesData() {
$html = ''; $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); $list = $html->find('ul.elpr-list', 0);
$this->extractDataFromList($list); $this->extractDataFromList($list);
@ -89,7 +89,7 @@ class SensCritiqueBridge extends BridgeAbstract {
private function collectBooksData() { private function collectBooksData() {
$html = ''; $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); $list = $html->find('ul.elpr-list', 0);
$this->extractDataFromList($list); $this->extractDataFromList($list);
@ -97,7 +97,7 @@ class SensCritiqueBridge extends BridgeAbstract {
private function collectBDsData() { private function collectBDsData() {
$html = ''; $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); $list = $html->find('ul.elpr-list', 0);
$this->extractDataFromList($list); $this->extractDataFromList($list);
@ -105,7 +105,7 @@ class SensCritiqueBridge extends BridgeAbstract {
private function collectMusicsData() { private function collectMusicsData() {
$html = ''; $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); $list = $html->find('ul.elpr-list', 0);
$this->extractDataFromList($list); $this->extractDataFromList($list);
@ -113,7 +113,7 @@ class SensCritiqueBridge extends BridgeAbstract {
private function extractDataFromList($list) { private function extractDataFromList($list) {
if ($list === null) { if ($list === null) {
$this->returnError('Cannot extract data from list', 400); $this->returnClientError('Cannot extract data from list');
} }
foreach ($list->find('li') as $movie) { foreach ($list->find('li') as $movie) {

View file

@ -7,7 +7,7 @@ class Sexactu extends BridgeAbstract{
$this->name = "Sexactu"; $this->name = "Sexactu";
$this->uri = "http://www.gqmagazine.fr"; $this->uri = "http://www.gqmagazine.fr";
$this->description = "Sexactu via rss-bridge"; $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'); $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'); $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) { foreach($html->find('.content-holder') as $contentHolder) {
// only use first list as second one only contains pages numbers // only use first list as second one only contains pages numbers

View file

@ -5,7 +5,7 @@ class ShanaprojectBridge extends BridgeAbstract {
$this->name = 'Shanaproject Bridge'; $this->name = 'Shanaproject Bridge';
$this->uri = 'http://www.shanaproject.com'; $this->uri = 'http://www.shanaproject.com';
$this->description = 'Returns a list of anime from the current Season Anime List'; $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) // 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' // 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'); $html = $this->file_get_html($this->getURI() . '/seasons');
if(!$html) 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); $season = $html->find('div.follows_menu/a', 1);
if(!$season) 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); $html = $this->file_get_html($this->getURI() . $season->href);
if(!$html) 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; return $html;
} }
@ -30,7 +30,7 @@ class ShanaprojectBridge extends BridgeAbstract {
private function ExtractAnimeTitle($anime){ private function ExtractAnimeTitle($anime){
$title = $anime->find('a', 0); $title = $anime->find('a', 0);
if(!$title) if(!$title)
$this->returnError('Could not find anime title!', 404); $this->returnServerError('Could not find anime title!');
return trim($title->innertext); return trim($title->innertext);
} }
@ -38,7 +38,7 @@ class ShanaprojectBridge extends BridgeAbstract {
private function ExtractAnimeURI($anime){ private function ExtractAnimeURI($anime){
$uri = $anime->find('a', 0); $uri = $anime->find('a', 0);
if(!$uri) if(!$uri)
$this->returnError('Could not find anime URI!', 404); $this->returnServerError('Could not find anime URI!');
return $this->getURI() . $uri->href; return $this->getURI() . $uri->href;
} }
@ -46,7 +46,7 @@ class ShanaprojectBridge extends BridgeAbstract {
private function ExtractAnimeTimestamp($anime){ private function ExtractAnimeTimestamp($anime){
$timestamp = $anime->find('span.header_info_block', 1); $timestamp = $anime->find('span.header_info_block', 1);
if(!$timestamp) if(!$timestamp)
$this->returnError('Could not find anime timestamp!', 404); $this->returnServerError('Could not find anime timestamp!');
return strtotime($timestamp->innertext); return strtotime($timestamp->innertext);
} }
@ -62,7 +62,7 @@ class ShanaprojectBridge extends BridgeAbstract {
private function ExtractAnimeEpisodeInformation($anime){ private function ExtractAnimeEpisodeInformation($anime){
$episode = $anime->find('div.header_info_episode', 0); $episode = $anime->find('div.header_info_episode', 0);
if(!$episode) 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); return preg_replace('/\r|\n/', ' ', $episode->plaintext);
} }
@ -74,7 +74,7 @@ class ShanaprojectBridge extends BridgeAbstract {
if(preg_match("/url\(\/\/([^\)]+)\)/i", $anime->parent->style, $matches)) if(preg_match("/url\(\/\/([^\)]+)\)/i", $anime->parent->style, $matches))
return $matches[1]; 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) // 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'); $animes = $html->find('div.header_display_box_info');
if(!$animes) if(!$animes)
$this->returnError('Could not find anime headers!', 404); $this->returnServerError('Could not find anime headers!');
foreach($animes as $anime){ foreach($animes as $anime){
$item = new \Item(); $item = new \Item();

View file

@ -7,7 +7,7 @@ class SiliconBridge extends BridgeAbstract {
$this->name = 'Silicon Bridge'; $this->name = 'Silicon Bridge';
$this->uri = 'http://www.silicon.fr/'; $this->uri = 'http://www.silicon.fr/';
$this->description = "Returns the newest articles."; $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'; $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; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {
@ -30,7 +30,7 @@ class SiliconBridge extends BridgeAbstract {
$article_uri = $element->innertext; $article_uri = $element->innertext;
$article_uri = substr($article_uri, strpos($article_uri, '<link>') + 6); $article_uri = substr($article_uri, strpos($article_uri, '<link>') + 6);
$article_uri = substr($article_uri, 0, strpos($article_uri, '</link>')); $article_uri = substr($article_uri, 0, strpos($article_uri, '</link>'));
$article_html = $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 //Build article contents from corresponding elements
$thumbnailUri = $element->find('enclosure', 0)->url; $thumbnailUri = $element->find('enclosure', 0)->url;

View file

@ -10,7 +10,7 @@ class SoundCloudBridge extends BridgeAbstract{
$this->name = "Soundcloud Bridge"; $this->name = "Soundcloud Bridge";
$this->uri = "http://www.soundcloud.com/"; $this->uri = "http://www.soundcloud.com/";
$this->description = "Returns 10 newest music from user profile"; $this->description = "Returns 10 newest music from user profile";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -30,12 +30,12 @@ class SoundCloudBridge extends BridgeAbstract{
{ {
$this->request = $param['u']; $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); $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->returnError('No results for this user', 404); $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 else
{ {
$this->returnError('You must specify username', 400); $this->returnClientError('You must specify username');
} }
for ($i=0; $i < 10; $i++) { for ($i=0; $i < 10; $i++) {

View file

@ -12,12 +12,12 @@ class StripeAPIChangeLogBridge extends BridgeAbstract{
$this->name = 'Stripe API Changelog'; $this->name = 'Stripe API Changelog';
$this->uri = 'https://stripe.com/docs/upgrades'; $this->uri = 'https://stripe.com/docs/upgrades';
$this->description = 'Returns the changes made to the stripe.com API'; $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){ public function collectData(array $param){
$html = file_get_html('https://stripe.com/docs/upgrades') $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){ foreach($html->find('h2') as $change){

View file

@ -10,7 +10,7 @@ class SuperbWallpapersBridge extends BridgeAbstract {
$this->name = "Superb Wallpapers Bridge"; $this->name = "Superb Wallpapers Bridge";
$this->uri = "http://www.superbwallpapers.com/"; $this->uri = "http://www.superbwallpapers.com/";
$this->description = "Returns the latests wallpapers from SuperbWallpapers"; $this->description = "Returns the latests wallpapers from SuperbWallpapers";
$this->update = "2016-08-09"; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -52,7 +52,7 @@ class SuperbWallpapersBridge extends BridgeAbstract {
for ($page = 1; $page <= $lastpage; $page++) { for ($page = 1; $page <= $lastpage; $page++) {
$link = $baseUri.'/'.$this->category.'/'.$page.'.html'; $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) { foreach($html->find('.wpl .i a') as $element) {
$thumbnail = $element->find('img', 0); $thumbnail = $element->find('img', 0);

View file

@ -7,7 +7,7 @@ class T411Bridge extends BridgeAbstract {
$this->name = 'T411 Bridge'; $this->name = 'T411 Bridge';
$this->uri = 'https://t411.ch/'; $this->uri = 'https://t411.ch/';
$this->description = 'Returns the 10 newest torrents with specified search terms <br /> Use url part after "?" mark when using their search engine.'; $this->description = 'Returns the 10 newest torrents with specified search terms <br /> Use url part after "?" mark when using their search engine.';
$this->update = '2016-08-09'; $this->update = '2016-08-17';
$this->parameters[] = $this->parameters[] =
'[ '[
@ -31,15 +31,15 @@ class T411Bridge extends BridgeAbstract {
//Ensure proper parameters have been provided //Ensure proper parameters have been provided
if (empty($param['search'])) { 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 //Retrieve torrent listing from search results, which does not contain torrent description
$url = $this->uri.'torrents/search/?'.$param['search'].'&order=added&type=desc'; $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); $results = $html->find('table.results', 0);
if (is_null($results)) if (is_null($results))
$this->returnError('No results from t411: '.$url, 500); $this->returnServerError('No results from t411: '.$url);
$limit = 0; $limit = 0;
//Process each item individually //Process each item individually

Some files were not shown because too many files have changed in this diff Show more