forked from blallo/rss-bridge
Merge branch 'cleanerProxy' of https://framagit.org/peetah/rss-bridge
This commit is contained in:
commit
6a912fba96
122 changed files with 512 additions and 484 deletions
|
@ -15,9 +15,9 @@ class ABCTabsBridge extends BridgeAbstract{
|
||||||
|
|
||||||
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->returnClientError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM('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)
|
||||||
{
|
{
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
|
|
|
@ -29,7 +29,7 @@ class AcrimedBridge extends RssExpander{
|
||||||
$item->title = trim($newsItem->title);
|
$item->title = trim($newsItem->title);
|
||||||
$item->timestamp = strtotime($dc->date);
|
$item->timestamp = strtotime($dc->date);
|
||||||
|
|
||||||
$articlePage = $this->file_get_html($newsItem->link);
|
$articlePage = $this->getSimpleHTMLDOM($newsItem->link);
|
||||||
$article = $hs->sanitize($articlePage->find('article.article1', 0)->innertext);
|
$article = $hs->sanitize($articlePage->find('article.article1', 0)->innertext);
|
||||||
$article = HTMLSanitizer::defaultImageSrcTo($article, "http://www.acrimed.org/");
|
$article = HTMLSanitizer::defaultImageSrcTo($article, "http://www.acrimed.org/");
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ class AllocineFRBridge extends BridgeAbstract{
|
||||||
$this->description = "Bridge for allocine.fr";
|
$this->description = "Bridge for allocine.fr";
|
||||||
$this->update = '2016-08-17';
|
$this->update = '2016-08-17';
|
||||||
|
|
||||||
$this->parameters[] =
|
$this->parameters[] =
|
||||||
'[
|
'[
|
||||||
{
|
{
|
||||||
"name" : "category",
|
"name" : "category",
|
||||||
|
@ -18,7 +18,7 @@ class AllocineFRBridge extends BridgeAbstract{
|
||||||
"required" : true,
|
"required" : true,
|
||||||
"exampleValue" : "Faux Raccord",
|
"exampleValue" : "Faux Raccord",
|
||||||
"title" : "Select your category",
|
"title" : "Select your category",
|
||||||
"values" :
|
"values" :
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name" : "Faux Raccord",
|
"name" : "Faux Raccord",
|
||||||
|
@ -64,12 +64,12 @@ class AllocineFRBridge extends BridgeAbstract{
|
||||||
// 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->returnServerError("Could not request {$this->uri}!");
|
$html = $this->getSimpleTMLOM($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)
|
||||||
{
|
{
|
||||||
$item = new Item();
|
$item = new Item();
|
||||||
|
|
||||||
$title = $element->find('div.titlebar h3.title a', 0);
|
$title = $element->find('div.titlebar h3.title a', 0);
|
||||||
$content = trim($element->innertext);
|
$content = trim($element->innertext);
|
||||||
$figCaption = strpos($content, $category);
|
$figCaption = strpos($content, $category);
|
||||||
|
|
|
@ -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->returnServerError('Could not request Anime-Ultime: '.$url);
|
$html = $this->getSimpleHTMLDOM($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) {
|
||||||
|
@ -110,7 +110,7 @@ class AnimeUltimeBridge extends BridgeAbstract {
|
||||||
$item->content = $item_description;
|
$item->content = $item_description;
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
$processedOK++;
|
$processedOK++;
|
||||||
|
|
||||||
//Stop processing once limit is reached
|
//Stop processing once limit is reached
|
||||||
if ($processedOK >= 10)
|
if ($processedOK >= 10)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -29,7 +29,7 @@ class ArstechnicaBridge extends BridgeAbstract {
|
||||||
|
|
||||||
function ExtractContent($url) {
|
function ExtractContent($url) {
|
||||||
#echo $url;
|
#echo $url;
|
||||||
$html2 = file_get_html($url);
|
$html2 = getSimpleHTMLDOM($url);
|
||||||
|
|
||||||
$text = $html2->find("section[id='article-guts']", 0);
|
$text = $html2->find("section[id='article-guts']", 0);
|
||||||
/*foreach ($text->find('<aside id="social-left">') as $node)
|
/*foreach ($text->find('<aside id="social-left">') as $node)
|
||||||
|
@ -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->returnServerError('Could not request NextInpact.');
|
$html = $this->getSimpleHTMLDOM('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) {
|
||||||
|
|
|
@ -22,7 +22,7 @@ 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->returnServerError('Requested username can\'t be found.');
|
$html = $this->getSimpleHTMLDOM('http://ask.fm/'.urlencode($this->request).'/answers/more?page=0') or $this->returnServerError('Requested username can\'t be found.');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->returnClientError('You must specify a username (?u=...).');
|
$this->returnClientError('You must specify a username (?u=...).');
|
||||||
|
|
|
@ -26,7 +26,7 @@ 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->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM('http://bandcamp.com/tag/'.urlencode($this->request).'?sort_field=date') or $this->returnServerError('No results for this query.');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->returnClientError('You must specify tag (/tag/...)');
|
$this->returnClientError('You must specify tag (/tag/...)');
|
||||||
|
|
|
@ -7,14 +7,14 @@ class BastaBridge extends BridgeAbstract{
|
||||||
$this->description = "Returns the newest articles.";
|
$this->description = "Returns the newest articles.";
|
||||||
$this->update = '2016-08-17';
|
$this->update = '2016-08-17';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
// Replaces all relative image URLs by absolute URLs. Relative URLs always start with 'local/'!
|
// Replaces all relative image URLs by absolute URLs. Relative URLs always start with 'local/'!
|
||||||
function ReplaceImageUrl($content){
|
function ReplaceImageUrl($content){
|
||||||
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->returnServerError('Could not request Bastamag.');
|
$html = $this->getSimpleHTMLDOM('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) {
|
||||||
|
@ -23,7 +23,7 @@ class BastaBridge extends BridgeAbstract{
|
||||||
$item->title = $element->find('title', 0)->innertext;
|
$item->title = $element->find('title', 0)->innertext;
|
||||||
$item->uri = $element->find('guid', 0)->plaintext;
|
$item->uri = $element->find('guid', 0)->plaintext;
|
||||||
$item->timestamp = strtotime($element->find('dc:date', 0)->plaintext);
|
$item->timestamp = strtotime($element->find('dc:date', 0)->plaintext);
|
||||||
$item->content = ReplaceImageUrl($this->file_get_html($item->uri)->find('div.texte', 0)->innertext);
|
$item->content = ReplaceImageUrl($this->getSimpleHTMLDOM($item->uri)->find('div.texte', 0)->innertext);
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
$limit++;
|
$limit++;
|
||||||
}
|
}
|
||||||
|
@ -34,4 +34,4 @@ class BastaBridge extends BridgeAbstract{
|
||||||
return 3600*2; // 2 hours
|
return 3600*2; // 2 hours
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -12,8 +12,8 @@ class BlaguesDeMerdeBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$html = $this->file_get_html('http://www.blaguesdemerde.fr/') or $this->returnServerError('Could not request BDM.');
|
$html = $this->getSimpleHTMLDOM('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();
|
||||||
$temp = $element->find('a');
|
$temp = $element->find('a');
|
||||||
|
|
|
@ -32,29 +32,29 @@ class BooruprojectBridge extends BridgeAbstract{
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$page = 0; $tags = '';
|
$page = 0; $tags = '';
|
||||||
if (!empty($param['p'])) {
|
if (!empty($param['p'])) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
||||||
$page = $page - 1;
|
$page = $page - 1;
|
||||||
$page = $page * 20;
|
$page = $page * 20;
|
||||||
}
|
}
|
||||||
if (!empty($param['t'])) {
|
if (!empty($param['t'])) {
|
||||||
$tags = '&tags='.urlencode($param['t']);
|
$tags = '&tags='.urlencode($param['t']);
|
||||||
}
|
}
|
||||||
if (empty($param['i'])) {
|
if (empty($param['i'])) {
|
||||||
$this->returnServerError('Please enter a ***.booru.org instance.');
|
$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->returnServerError('Could not request Booruproject.');
|
$html = $this->getSimpleHTMLDOM("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) {
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
$item->uri = 'http://'.$param['i'].'.booru.org/'.$element->find('a', 0)->href;
|
$item->uri = 'http://'.$param['i'].'.booru.org/'.$element->find('a', 0)->href;
|
||||||
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->find('a', 0)->getAttribute('id'));
|
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->find('a', 0)->getAttribute('id'));
|
||||||
$item->timestamp = time();
|
$item->timestamp = time();
|
||||||
$item->tags = $element->find('img', 0)->getAttribute('title');
|
$item->tags = $element->find('img', 0)->getAttribute('title');
|
||||||
$item->title = 'Booruproject '.$param['i'].' | '.$item->postid;
|
$item->title = 'Booruproject '.$param['i'].' | '.$item->postid;
|
||||||
$item->content = '<a href="' . $item->uri . '"><img src="' . $element->find('img', 0)->src . '" /></a><br>Tags: '.$item->tags;
|
$item->content = '<a href="' . $item->uri . '"><img src="' . $element->find('img', 0)->src . '" /></a><br>Tags: '.$item->tags;
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ class CADBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
private function CADExtractContent($url) {
|
private function CADExtractContent($url) {
|
||||||
$html3 = $this->file_get_html($url);
|
$html3 = $this->getSimpleHTMLDOM($url);
|
||||||
|
|
||||||
// The request might fail due to missing https support or wrong URL
|
// The request might fail due to missing https support or wrong URL
|
||||||
if($html3 == false)
|
if($html3 == false)
|
||||||
|
@ -27,7 +27,6 @@ class CADBridge extends BridgeAbstract{
|
||||||
default:
|
default:
|
||||||
return 'Daily comic not released yet';
|
return 'Daily comic not released yet';
|
||||||
}
|
}
|
||||||
|
|
||||||
$img = implode ($url2[0]);
|
$img = implode ($url2[0]);
|
||||||
$html3->clear();
|
$html3->clear();
|
||||||
unset ($html3);
|
unset ($html3);
|
||||||
|
@ -45,7 +44,7 @@ class CADBridge extends BridgeAbstract{
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = $this->file_get_html('http://cdn2.cad-comic.com/rss.xml') or $this->returnServerError('Could not request CAD.');
|
$html = $this->getSimpleHTMLDOM('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) {
|
||||||
|
@ -67,4 +66,4 @@ class CADBridge extends BridgeAbstract{
|
||||||
return 3600*2; // 2 hours
|
return 3600*2; // 2 hours
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -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->returnServerError('Could not request CNET: '.$pageUrl);
|
$html = $this->getSimpleHTMLDOM($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->returnServerError('Could not request CNET: '.$article_uri);
|
$article_html = $this->getSimpleHTMLDOM($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>')));
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ class CastorusBridge extends BridgeAbstract {
|
||||||
$this->update = '2016-08-17';
|
$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"] =
|
||||||
'[
|
'[
|
||||||
{
|
{
|
||||||
"name": "ZIP code",
|
"name": "ZIP code",
|
||||||
|
@ -19,7 +19,7 @@ class CastorusBridge extends BridgeAbstract {
|
||||||
"title" : "Insert ZIP code (complete or partial)"
|
"title" : "Insert ZIP code (complete or partial)"
|
||||||
}
|
}
|
||||||
]';
|
]';
|
||||||
$this->parameters["Get latest changes via city name"] =
|
$this->parameters["Get latest changes via city name"] =
|
||||||
'[
|
'[
|
||||||
{
|
{
|
||||||
"name": "City name",
|
"name": "City name",
|
||||||
|
@ -38,7 +38,7 @@ class CastorusBridge extends BridgeAbstract {
|
||||||
|
|
||||||
if(!$title)
|
if(!$title)
|
||||||
$this->returnServerError('Cannot find title!');
|
$this->returnServerError('Cannot find title!');
|
||||||
|
|
||||||
return htmlspecialchars(trim($title->plaintext));
|
return htmlspecialchars(trim($title->plaintext));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,19 +48,19 @@ class CastorusBridge extends BridgeAbstract {
|
||||||
|
|
||||||
if(!$url)
|
if(!$url)
|
||||||
$this->returnServerError('Cannot find url!');
|
$this->returnServerError('Cannot find url!');
|
||||||
|
|
||||||
return $this->uri . $url->href;
|
return $this->uri . $url->href;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extracts the time from an activity
|
// Extracts the time from an activity
|
||||||
private function ExtractActivityTime($activity){
|
private function ExtractActivityTime($activity){
|
||||||
// Unfortunately the time is part of the parent node,
|
// Unfortunately the time is part of the parent node,
|
||||||
// so we have to clear all child nodes first
|
// so we have to clear all child nodes first
|
||||||
$nodes = $activity->find('*');
|
$nodes = $activity->find('*');
|
||||||
|
|
||||||
if(!$nodes)
|
if(!$nodes)
|
||||||
$this->returnServerError('Cannot find nodes!');
|
$this->returnServerError('Cannot find nodes!');
|
||||||
|
|
||||||
foreach($nodes as $node){
|
foreach($nodes as $node){
|
||||||
$node->outertext = '';
|
$node->outertext = '';
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ class CastorusBridge extends BridgeAbstract {
|
||||||
|
|
||||||
if(!$price)
|
if(!$price)
|
||||||
$this->returnServerError('Cannot find price!');
|
$this->returnServerError('Cannot find price!');
|
||||||
|
|
||||||
return $price->innertext;
|
return $price->innertext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,23 +85,23 @@ class CastorusBridge extends BridgeAbstract {
|
||||||
if(isset($params['city']))
|
if(isset($params['city']))
|
||||||
$city_filter = trim($params['city']);
|
$city_filter = trim($params['city']);
|
||||||
|
|
||||||
$html = $this->file_get_html($this->uri);
|
$html = $this->getSimpleHTMLDOM($this->uri);
|
||||||
|
|
||||||
if(!$html)
|
if(!$html)
|
||||||
$this->returnServerError('Could not load data from ' . $this->uri . '!');
|
$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->returnServerError('Failed to find activities!');
|
$this->returnServerError('Failed to find activities!');
|
||||||
|
|
||||||
foreach($activities as $activity){
|
foreach($activities as $activity){
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
|
|
||||||
$item->title = $this->ExtractActivityTitle($activity);
|
$item->title = $this->ExtractActivityTitle($activity);
|
||||||
$item->uri = $this->ExtractActivityUrl($activity);
|
$item->uri = $this->ExtractActivityUrl($activity);
|
||||||
$item->timestamp = $this->ExtractActivityTime($activity);
|
$item->timestamp = $this->ExtractActivityTime($activity);
|
||||||
$item->content = '<a href="' . $item->uri . '">' . $item->title . '</a><br><p>'
|
$item->content = '<a href="' . $item->uri . '">' . $item->title . '</a><br><p>'
|
||||||
. $this->ExtractActivityPrice($activity) . '</p>';
|
. $this->ExtractActivityPrice($activity) . '</p>';
|
||||||
|
|
||||||
if(isset($zip_filter) && !(substr($item->title, 0, strlen($zip_filter)) === $zip_filter)){
|
if(isset($zip_filter) && !(substr($item->title, 0, strlen($zip_filter)) === $zip_filter)){
|
||||||
|
|
|
@ -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->returnServerError('Could not request CollegeDeFrance.');
|
$html = $this->getSimpleHTMLDOM('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;
|
||||||
|
|
|
@ -10,7 +10,7 @@ class CommonDreamsBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
private function CommonDreamsExtractContent($url) {
|
private function CommonDreamsExtractContent($url) {
|
||||||
$html3 = $this->file_get_html($url);
|
$html3 = $this->getSimpleHTMLDOM($url);
|
||||||
$text = $html3->find('div[class=field--type-text-with-summary]', 0)->innertext;
|
$text = $html3->find('div[class=field--type-text-with-summary]', 0)->innertext;
|
||||||
$html3->clear();
|
$html3->clear();
|
||||||
unset ($html3);
|
unset ($html3);
|
||||||
|
@ -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->returnServerError('Could not request CommonDreams.');
|
$html = $this->getSimpleHTMLDOM('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) {
|
||||||
|
|
|
@ -13,9 +13,9 @@ class CopieDoubleBridge extends BridgeAbstract{
|
||||||
|
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$html = $this->file_get_html('http://www.copie-double.com/') or $this->returnServerError('Could not request CopieDouble.');
|
$html = $this->getSimpleHTMLDOM('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)
|
||||||
{
|
{
|
||||||
$td = $element->find('td', 0);
|
$td = $element->find('td', 0);
|
||||||
|
@ -23,7 +23,7 @@ class CopieDoubleBridge extends BridgeAbstract{
|
||||||
if($td->class == "couleur_1")
|
if($td->class == "couleur_1")
|
||||||
{
|
{
|
||||||
$item = new Item();
|
$item = new Item();
|
||||||
|
|
||||||
$title = $td->innertext;
|
$title = $td->innertext;
|
||||||
$pos = strpos($title, "<a");
|
$pos = strpos($title, "<a");
|
||||||
$title = substr($title, 0, $pos);
|
$title = substr($title, 0, $pos);
|
||||||
|
@ -33,7 +33,7 @@ class CopieDoubleBridge extends BridgeAbstract{
|
||||||
{
|
{
|
||||||
$a=$element->find("a", 0);
|
$a=$element->find("a", 0);
|
||||||
$item->uri = "http://www.copie-double.com" . $a->href;
|
$item->uri = "http://www.copie-double.com" . $a->href;
|
||||||
|
|
||||||
$content = str_replace('src="/', 'src="http://www.copie-double.com/',$element->find("td", 0)->innertext);
|
$content = str_replace('src="/', 'src="http://www.copie-double.com/',$element->find("td", 0)->innertext);
|
||||||
$content = str_replace('href="/', 'href="http://www.copie-double.com/',$content);
|
$content = str_replace('href="/', 'href="http://www.copie-double.com/',$content);
|
||||||
$item->content = $content;
|
$item->content = $content;
|
||||||
|
|
|
@ -12,49 +12,49 @@ class CourrierInternationalBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
|
|
||||||
$html = '';
|
$html = '';
|
||||||
|
|
||||||
$html = $this->file_get_html('http://www.courrierinternational.com/') or $this->returnServerError('Error.');
|
$html = $this->getSimpleHTMLDOM('http://www.courrierinternational.com/') or $this->returnServerError('Error.');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$element = $html->find("article");
|
$element = $html->find("article");
|
||||||
|
|
||||||
$article_count = 1;
|
$article_count = 1;
|
||||||
|
|
||||||
foreach($element as $article) {
|
foreach($element as $article) {
|
||||||
|
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
|
|
||||||
$item->uri = $article->parent->getAttribute("href");
|
$item->uri = $article->parent->getAttribute("href");
|
||||||
|
|
||||||
if(strpos($item->uri, "http") === FALSE) {
|
if(strpos($item->uri, "http") === FALSE) {
|
||||||
$item->uri = "http://courrierinternational.fr/".$item->uri;
|
$item->uri = "http://courrierinternational.fr/".$item->uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
$page = $this->file_get_html($item->uri);
|
$page = $this->getSimpleHTMLDOM($item->uri);
|
||||||
|
|
||||||
$cleaner = new HTMLSanitizer();
|
$cleaner = new HTMLSanitizer();
|
||||||
|
|
||||||
$item->content = $cleaner->sanitize($page->find("div.article-text")[0]);
|
$item->content = $cleaner->sanitize($page->find("div.article-text")[0]);
|
||||||
$item->title = strip_tags($article->find(".title")[0]);
|
$item->title = strip_tags($article->find(".title")[0]);
|
||||||
|
|
||||||
$dateTime = date_parse($page->find("time")[0]);
|
$dateTime = date_parse($page->find("time")[0]);
|
||||||
|
|
||||||
$item->timestamp = mktime(
|
$item->timestamp = mktime(
|
||||||
$dateTime['hour'],
|
$dateTime['hour'],
|
||||||
$dateTime['minute'],
|
$dateTime['minute'],
|
||||||
$dateTime['second'],
|
$dateTime['second'],
|
||||||
$dateTime['month'],
|
$dateTime['month'],
|
||||||
$dateTime['day'],
|
$dateTime['day'],
|
||||||
$dateTime['year']
|
$dateTime['year']
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
$article_count ++;
|
$article_count ++;
|
||||||
if($article_count > 5) break;
|
if($article_count > 5) break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ function content_get_html($contents, $maxLen=-1, $lowercase = true, $forceTagsCl
|
||||||
}
|
}
|
||||||
|
|
||||||
class CpasbienBridge extends HttpCachingBridgeAbstract{
|
class CpasbienBridge extends HttpCachingBridgeAbstract{
|
||||||
|
|
||||||
private $request;
|
private $request;
|
||||||
|
|
||||||
public function loadMetadatas() {
|
public function loadMetadatas() {
|
||||||
|
@ -44,7 +44,7 @@ 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->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM($this->uri.'/recherche/'.urlencode($this->request).'.html') or $this->returnServerError('No results for this query.');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->returnClientError('You must specify a keyword (?q=...).');
|
$this->returnClientError('You must specify a keyword (?q=...).');
|
||||||
|
@ -53,7 +53,7 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
|
||||||
foreach ($html->find('#gauche',0)->find('div') as $episode) {
|
foreach ($html->find('#gauche',0)->find('div') as $episode) {
|
||||||
if ($episode->getAttribute('class')=='ligne0' || $episode->getAttribute('class')=='ligne1')
|
if ($episode->getAttribute('class')=='ligne0' || $episode->getAttribute('class')=='ligne1')
|
||||||
{
|
{
|
||||||
|
|
||||||
$htmlepisode=content_get_html($this->get_cached($episode->find('a', 0)->getAttribute('href')));
|
$htmlepisode=content_get_html($this->get_cached($episode->find('a', 0)->getAttribute('href')));
|
||||||
|
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
|
@ -65,7 +65,7 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
|
||||||
$item->content = $textefiche->text();
|
$item->content = $textefiche->text();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$item->content = $htmlepisode->find('#textefiche', 0)->find('p',0)->text();
|
$item->content = $htmlepisode->find('#textefiche', 0)->find('p',0)->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
$item->id = $episode->find('a', 0)->getAttribute('href');
|
$item->id = $episode->find('a', 0)->getAttribute('href');
|
||||||
|
|
|
@ -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->returnServerError('Could not request Cryptome.');
|
$html = $this->getSimpleHTMLDOM($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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,14 +47,14 @@ 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->returnServerError('Could not request Dailymotion.');
|
$html2 = $this->getSimpleHTMLDOM('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');
|
||||||
$metadata['uri'] = $html2->find('meta[property=og:url]', 0)->getAttribute('content');
|
$metadata['uri'] = $html2->find('meta[property=og:url]', 0)->getAttribute('content');
|
||||||
|
|
||||||
return $metadata;
|
return $metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$html = '';
|
$html = '';
|
||||||
|
@ -63,15 +63,15 @@ 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->returnServerError('Could not request Dailymotion.');
|
$html = $this->getSimpleHTMLDOM('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->returnServerError('Could not request Dailymotion.');
|
$html = $this->getSimpleHTMLDOM('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->returnServerError('Could not request Dailymotion.');
|
$html = $this->getSimpleHTMLDOM('http://www.dailymotion.com/search/'.urlencode($this->request).'/'.$page.'') or $this->returnServerError('Could not request Dailymotion.');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->returnClientError('You must either specify a Dailymotion username (?u=...) or a playlist id (?p=...) or search (?s=...)');
|
$this->returnClientError('You must either specify a Dailymotion username (?u=...) or a playlist id (?p=...) or search (?s=...)');
|
||||||
|
|
|
@ -25,23 +25,23 @@ class DanbooruBridge extends BridgeAbstract{
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$page = 1;$tags='';
|
$page = 1;$tags='';
|
||||||
if (isset($param['p'])) {
|
if (isset($param['p'])) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
||||||
}
|
}
|
||||||
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->returnServerError('Could not request Danbooru.');
|
$html = $this->getSimpleHTMLDOM("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;
|
||||||
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('data-id'));
|
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('data-id'));
|
||||||
$item->timestamp = time();
|
$item->timestamp = time();
|
||||||
$thumbnailUri = 'http://donmai.us'.$element->find('img', 0)->src;
|
$thumbnailUri = 'http://donmai.us'.$element->find('img', 0)->src;
|
||||||
$item->tags = $element->find('img', 0)->getAttribute('alt');
|
$item->tags = $element->find('img', 0)->getAttribute('alt');
|
||||||
$item->title = 'Danbooru | '.$item->postid;
|
$item->title = 'Danbooru | '.$item->postid;
|
||||||
$item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item->tags;
|
$item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item->tags;
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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->returnServerError('Could not request DansTonChat.');
|
$html = $this->getSimpleHTMLDOM($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();
|
||||||
|
|
|
@ -82,7 +82,7 @@ class DauphineLibereBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
private function ExtractContent($url, $context) {
|
private function ExtractContent($url, $context) {
|
||||||
$html2 = $this->file_get_html($url, false, $context);
|
$html2 = $this->getSimpleHTMLDOM($url,false,$context);
|
||||||
$text = $html2->find('div.column', 0)->innertext;
|
$text = $html2->find('div.column', 0)->innertext;
|
||||||
$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
|
$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
|
||||||
return $text;
|
return $text;
|
||||||
|
@ -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->returnServerError('Could not request DauphineLibere.');
|
$html = $this->getSimpleHTMLDOM('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->returnServerError('Could not request DauphineLibere.');
|
$html = $this->getSimpleHTMLDOM('http://www.ledauphine.com/rss',false,$context) or $this->returnServerError('Could not request DauphineLibere.');
|
||||||
}
|
}
|
||||||
$limit = 0;
|
$limit = 0;
|
||||||
|
|
||||||
|
@ -126,4 +126,4 @@ class DauphineLibereBridge extends BridgeAbstract {
|
||||||
return 3600*2; // 2 hours
|
return 3600*2; // 2 hours
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -15,7 +15,7 @@ class DeveloppezDotComBridge extends BridgeAbstract{
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// F***ing quotes from Microsoft Word badly encoded, here was the trick:
|
// F***ing quotes from Microsoft Word badly encoded, here was the trick:
|
||||||
// http://stackoverflow.com/questions/1262038/how-to-replace-microsoft-encoded-quotes-in-php
|
// http://stackoverflow.com/questions/1262038/how-to-replace-microsoft-encoded-quotes-in-php
|
||||||
private function convert_smart_quotes($string)
|
private function convert_smart_quotes($string)
|
||||||
{
|
{
|
||||||
|
@ -35,14 +35,14 @@ class DeveloppezDotComBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
private function DeveloppezDotComExtractContent($url) {
|
private function DeveloppezDotComExtractContent($url) {
|
||||||
$articleHTMLContent = $this->file_get_html($url);
|
$articleHTMLContent = $this->getSimpleHTMLDOM($url);
|
||||||
$text = $this->convert_smart_quotes($articleHTMLContent->find('div.content', 0)->innertext);
|
$text = $this->convert_smart_quotes($articleHTMLContent->find('div.content', 0)->innertext);
|
||||||
$text = utf8_encode($text);
|
$text = utf8_encode($text);
|
||||||
return trim($text);
|
return trim($text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$rssFeed = $this->file_get_html('http://www.developpez.com/index/rss') or $this->returnServerError('Could not request http://www.developpez.com/index/rss');
|
$rssFeed = $this->getSimpleHTMLDOM('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) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ class DilbertBridge extends BridgeAbstract {
|
||||||
|
|
||||||
public function collectData(array $param) {
|
public function collectData(array $param) {
|
||||||
|
|
||||||
$html = $this->file_get_html($this->getURI()) or $this->returnServerError('Could not request Dilbert: '.$this->getURI());
|
$html = $this->getSimpleHTMLDOM($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) {
|
||||||
|
|
||||||
|
|
|
@ -26,25 +26,25 @@ class DollbooruBridge extends BridgeAbstract{
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$page = 0;$tags='';
|
$page = 0;$tags='';
|
||||||
if (isset($param['p'])) {
|
if (isset($param['p'])) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
||||||
}
|
}
|
||||||
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->returnServerError('Could not request Dollbooru.');
|
$html = $this->getSimpleHTMLDOM("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) {
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
$item->uri = 'http://dollbooru.org'.$element->href;
|
$item->uri = 'http://dollbooru.org'.$element->href;
|
||||||
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('data-post-id'));
|
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('data-post-id'));
|
||||||
$item->timestamp = time();
|
$item->timestamp = time();
|
||||||
$thumbnailUri = 'http://dollbooru.org'.$element->find('img', 0)->src;
|
$thumbnailUri = 'http://dollbooru.org'.$element->find('img', 0)->src;
|
||||||
$item->tags = $element->getAttribute('data-tags');
|
$item->tags = $element->getAttribute('data-tags');
|
||||||
$item->title = 'Dollbooru | '.$item->postid;
|
$item->title = 'Dollbooru | '.$item->postid;
|
||||||
$item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item->tags;
|
$item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item->tags;
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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->returnServerError('Could not request DuckDuckGo.');
|
$html = $this->getSimpleHTMLDOM($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();
|
||||||
|
|
|
@ -40,11 +40,11 @@ class EZTVBridge extends BridgeAbstract{
|
||||||
$this->returnClientError('You must provide a list of ID (?i=showID1,showID2,...)');
|
$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->returnServerError('Could not request EZTV for id "'.$showID.'"');
|
$html = $this->getSimpleHTMLDOM('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) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ class EliteDangerousGalnetBridge extends BridgeAbstract
|
||||||
|
|
||||||
public function collectData(array $param)
|
public function collectData(array $param)
|
||||||
{
|
{
|
||||||
$html = $this->file_get_html('https://community.elitedangerous.com/galnet') or $this->returnServerError('Error while downloading the website content');
|
$html = $this->getSimpleHTMLDOM('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();
|
||||||
|
|
||||||
|
@ -40,4 +40,4 @@ class EliteDangerousGalnetBridge extends BridgeAbstract
|
||||||
{
|
{
|
||||||
return 3600 * 2; // 2 hours
|
return 3600 * 2; // 2 hours
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ class ElsevierBridge extends BridgeAbstract{
|
||||||
$time = $article->find('.article-info', 0);
|
$time = $article->find('.article-info', 0);
|
||||||
if($time){
|
if($time){
|
||||||
$timestring = trim($time->plaintext);
|
$timestring = trim($time->plaintext);
|
||||||
/*
|
/*
|
||||||
The format depends on the age of an article:
|
The format depends on the age of an article:
|
||||||
- Available online 29 July 2016
|
- Available online 29 July 2016
|
||||||
- July 2016
|
- July 2016
|
||||||
|
@ -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->returnServerError('No results for Elsevier journal '.$param['j']);
|
$html = $this->getSimpleHTMLDOM($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();
|
||||||
|
@ -80,4 +80,4 @@ class ElsevierBridge extends BridgeAbstract{
|
||||||
return 43200; // 12h
|
return 43200; // 12h
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -18,7 +18,7 @@ class EstCeQuonMetEnProdBridge extends BridgeAbstract {
|
||||||
} return false;
|
} return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = $this->file_get_html($this->getURI()) or $this->returnServerError('Could not request EstCeQuonMetEnProd: '.$this->getURI());
|
$html = $this->getSimpleHTMLDOM($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');
|
||||||
|
@ -33,4 +33,4 @@ class EstCeQuonMetEnProdBridge extends BridgeAbstract {
|
||||||
return 21600; // 6 hours
|
return 21600; // 6 hours
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -109,9 +109,9 @@ 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->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM('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->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM('https://www.facebook.com/pages/'.$param['u'].'?_fb_noscript=1') or $this->returnServerError('No results for this query.');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->returnClientError('You must specify a Facebook username.');
|
$this->returnClientError('You must specify a Facebook username.');
|
||||||
|
@ -155,7 +155,7 @@ class FacebookBridge extends BridgeAbstract{
|
||||||
$this->name = $author;
|
$this->name = $author;
|
||||||
|
|
||||||
foreach($element->children() as $post) {
|
foreach($element->children() as $post) {
|
||||||
|
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
|
|
||||||
if (count($post->find('abbr')) > 0) {
|
if (count($post->find('abbr')) > 0) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ Class FierPandaBridge extends BridgeAbstract{
|
||||||
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->returnServerError('Could not request Fier Panda.');
|
$html = $this->getSimpleHTMLDOM($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();
|
||||||
|
|
|
@ -12,7 +12,7 @@ class FlickrExploreBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$html = $this->file_get_html('https://www.flickr.com/explore') or $this->returnServerError('Could not request Flickr.');
|
$html = $this->getSimpleHTMLDOM('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
|
||||||
|
|
|
@ -27,16 +27,16 @@ 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->returnServerError('Could not request Flickr.');
|
$html = $this->getSimpleHTMLDOM('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->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM('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->returnServerError('Requested username can\'t be found.');
|
$html = $this->getSimpleHTMLDOM('http://www.flickr.com/photos/'.urlencode($this->request).'/') or $this->returnServerError('Requested username can\'t be found.');
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
$this->returnClientError('You must specify a keyword or a Flickr username.');
|
$this->returnClientError('You must specify a keyword or a Flickr username.');
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,11 +12,11 @@ class FootitoBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$html = $this->file_get_html('http://www.footito.fr/') or $this->returnServerError('Could not request Footito.');
|
$html = $this->getSimpleHTMLDOM('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();
|
||||||
|
|
||||||
$content = trim($element->innertext);
|
$content = trim($element->innertext);
|
||||||
$content = str_replace("<img", "<img style='float : left;'", $content );
|
$content = str_replace("<img", "<img style='float : left;'", $content );
|
||||||
$content = str_replace("class=\"logo\"", "style='float : left;'", $content );
|
$content = str_replace("class=\"logo\"", "style='float : left;'", $content );
|
||||||
|
@ -27,17 +27,17 @@ class FootitoBridge extends BridgeAbstract{
|
||||||
$content = str_replace("class=\"report-abuse-button\"", "style='display : none;'", $content );
|
$content = str_replace("class=\"report-abuse-button\"", "style='display : none;'", $content );
|
||||||
$content = str_replace("class=\"reaction clearfix\"", "style='margin : 10px 0px; padding : 5px; border-bottom : 1px #DDD solid;'", $content );
|
$content = str_replace("class=\"reaction clearfix\"", "style='margin : 10px 0px; padding : 5px; border-bottom : 1px #DDD solid;'", $content );
|
||||||
$content = str_replace("class=\"infos\"", "style='font-size : 0.7em;'", $content );
|
$content = str_replace("class=\"infos\"", "style='font-size : 0.7em;'", $content );
|
||||||
|
|
||||||
$item->content = $content;
|
$item->content = $content;
|
||||||
|
|
||||||
$title = $element->find('.contenu .texte ', 0)->plaintext;
|
$title = $element->find('.contenu .texte ', 0)->plaintext;
|
||||||
$item->title = $title;
|
$item->title = $title;
|
||||||
|
|
||||||
$info = $element->find('div.infos', 0);
|
$info = $element->find('div.infos', 0);
|
||||||
|
|
||||||
$item->timestamp = strtotime($info->find('time', 0)->datetime);
|
$item->timestamp = strtotime($info->find('time', 0)->datetime);
|
||||||
$item->author = $info->find('a.auteur', 0)->plaintext;
|
$item->author = $info->find('a.auteur', 0)->plaintext;
|
||||||
|
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ class FourchanBridge extends BridgeAbstract{
|
||||||
$this->returnClientError('You must specify the thread URL.');
|
$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->returnServerError("Could not request 4chan, thread not found");
|
$html = $this->getSimpleHTMLDOM($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();
|
||||||
|
@ -59,7 +59,7 @@ class FourchanBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
$this->items = array_reverse($this->items);
|
$this->items = array_reverse($this->items);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCacheDuration(){
|
public function getCacheDuration(){
|
||||||
return 300; // 5min
|
return 300; // 5min
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,13 +172,13 @@ class FuturaSciencesBridge extends BridgeAbstract {
|
||||||
$this->returnClientError('Invalid "feed" parameter.'.$url);
|
$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->returnServerError('Could not request Futura-Sciences: '.$url);
|
$html = $this->getSimpleHTMLDOM($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->returnServerError('Could not request Futura-Sciences: '.$article_url);
|
$article = $this->getSimpleHTMLDOM($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(
|
||||||
|
|
|
@ -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->returnServerError('Could not request GBAtemp: '.$uri);
|
$html = $this->getSimpleHTMLDOM($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);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ class GBAtempBridge extends BridgeAbstract {
|
||||||
} else $this->returnClientError('The provided type filter is invalid. Expecting N, R, T, or F.');
|
} else $this->returnClientError('The provided type filter is invalid. Expecting N, R, T, or F.');
|
||||||
} else $this->returnClientError('Please provide a type filter. Expecting N, R, T, or F.');
|
} else $this->returnClientError('Please provide a type filter. Expecting N, R, T, or F.');
|
||||||
|
|
||||||
$html = $this->file_get_html($this->uri) or $this->returnServerError('Could not request GBAtemp.');
|
$html = $this->getSimpleHTMLDOM($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->returnServerError('Could not request GBAtemp: '.$uri);
|
$content = $this->getSimpleHTMLDOM($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>';
|
||||||
|
|
|
@ -26,27 +26,27 @@ class GelbooruBridge extends BridgeAbstract{
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$page = 0;
|
$page = 0;
|
||||||
if (isset($param['p'])) {
|
if (isset($param['p'])) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
||||||
$page = $page - 1;
|
$page = $page - 1;
|
||||||
$page = $page * 63;
|
$page = $page * 63;
|
||||||
}
|
}
|
||||||
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->returnServerError('Could not request Gelbooru.');
|
$html = $this->getSimpleHTMLDOM("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) {
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
$item->uri = 'http://gelbooru.com/'.$element->find('a', 0)->href;
|
$item->uri = 'http://gelbooru.com/'.$element->find('a', 0)->href;
|
||||||
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
|
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
|
||||||
$item->timestamp = time();
|
$item->timestamp = time();
|
||||||
$thumbnailUri = $element->find('img', 0)->src;
|
$thumbnailUri = $element->find('img', 0)->src;
|
||||||
$item->tags = $element->find('img', 0)->getAttribute('alt');
|
$item->tags = $element->find('img', 0)->getAttribute('alt');
|
||||||
$item->title = 'Gelbooru | '.$item->postid;
|
$item->title = 'Gelbooru | '.$item->postid;
|
||||||
$item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item->tags;
|
$item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item->tags;
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,10 +30,10 @@ class GiphyBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$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->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM($base_url.'/search/'.urlencode($param['s'].'/')) or $this->returnServerError('No results for this query.');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->returnClientError('You must specify a search worf (?s=...).');
|
$this->returnClientError('You must specify a search worf (?s=...).');
|
||||||
|
@ -43,22 +43,22 @@ class GiphyBridge extends BridgeAbstract{
|
||||||
if (isset($param['n'])) {
|
if (isset($param['n'])) {
|
||||||
$max = (integer) $param['n'];
|
$max = (integer) $param['n'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$limit = 0;
|
$limit = 0;
|
||||||
$kw = urlencode($param['s']);
|
$kw = urlencode($param['s']);
|
||||||
foreach($html->find('div.hoverable-gif') as $entry) {
|
foreach($html->find('div.hoverable-gif') as $entry) {
|
||||||
if($limit < $max) {
|
if($limit < $max) {
|
||||||
$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->returnServerError('No results for this query.');
|
$html2 = $this->getSimpleHTMLDOM($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();
|
||||||
|
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
$item->id = $img->getAttribute('data-gif_id');
|
$item->id = $img->getAttribute('data-gif_id');
|
||||||
$item->uri = $img->getAttribute('data-bitly_gif_url');
|
$item->uri = $img->getAttribute('data-bitly_gif_url');
|
||||||
$item->username = 'Giphy - '.ucfirst($kw);
|
$item->username = 'Giphy - '.ucfirst($kw);
|
||||||
$title = $caption->innertext();
|
$title = $caption->innertext();
|
||||||
$title = preg_replace('/\s+/', ' ',$title);
|
$title = preg_replace('/\s+/', ' ',$title);
|
||||||
|
@ -74,8 +74,8 @@ class GiphyBridge extends BridgeAbstract{
|
||||||
'<a href="'.$item->uri.'">'
|
'<a href="'.$item->uri.'">'
|
||||||
.'<img src="'.$img->getAttribute('src').'" width="'.$img->getAttribute('data-original-width').'" height="'.$img->getAttribute('data-original-height').'" />'
|
.'<img src="'.$img->getAttribute('src').'" width="'.$img->getAttribute('data-original-width').'" height="'.$img->getAttribute('data-original-height').'" />'
|
||||||
.'</a>';
|
.'</a>';
|
||||||
|
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
$limit++;
|
$limit++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,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 = $this->getSimpleHTMLDOM($uri)
|
||||||
or $this->returnServerError('No results for Github Issue '.$param['i'].' in project '.$param['u'].'/'.$param['p']);
|
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){
|
||||||
|
|
|
@ -44,7 +44,7 @@ class GitlabCommitsBridge extends BridgeAbstract{
|
||||||
$uri.='master';
|
$uri.='master';
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = file_get_html($uri)
|
$html = $this->getSimpleHTMLDOM($uri)
|
||||||
or $this->returnServerError('No results for Gitlab Commits of project '.$param['uri'].'/'.$param['u'].'/'.$param['p']);
|
or $this->returnServerError('No results for Gitlab Commits of project '.$param['uri'].'/'.$param['u'].'/'.$param['p']);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class GizmodoFRBridge extends BridgeAbstract{
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
|
|
||||||
function GizmodoFRExtractContent($url) {
|
function GizmodoFRExtractContent($url) {
|
||||||
$articleHTMLContent = $this->file_get_html($url);
|
$articleHTMLContent = $this->getSimpleHTMLDOM($url);
|
||||||
$text = $articleHTMLContent->find('div.entry-thumbnail', 0)->innertext;
|
$text = $articleHTMLContent->find('div.entry-thumbnail', 0)->innertext;
|
||||||
$text = $text.$articleHTMLContent->find('div.entry-excerpt', 0)->innertext;
|
$text = $text.$articleHTMLContent->find('div.entry-excerpt', 0)->innertext;
|
||||||
$text = $text.$articleHTMLContent->find('div.entry-content', 0)->innertext;
|
$text = $text.$articleHTMLContent->find('div.entry-content', 0)->innertext;
|
||||||
|
@ -26,7 +26,7 @@ class GizmodoFRBridge extends BridgeAbstract{
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
$rssFeed = $this->file_get_html('http://www.gizmodo.fr/feed') or $this->returnServerError('Could not request http://www.gizmodo.fr/feed');
|
$rssFeed = $this->getSimpleHTMLDOM('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) {
|
||||||
|
|
|
@ -33,8 +33,8 @@ class GooglePlusPostBridge extends BridgeAbstract
|
||||||
|
|
||||||
$this->request = $param['username'];
|
$this->request = $param['username'];
|
||||||
// get content parsed
|
// get content parsed
|
||||||
// $html = $this->file_get_html(__DIR__ . '/../posts2.html'
|
// $html = $this->getSimpleHTMLDOM(__DIR__ . '/../posts2.html'
|
||||||
$html = $this->file_get_html(self::GOOGLE_PLUS_BASE_URL . urlencode($this->request) . '/posts'
|
$html = $this->getSimpleHTMLDOM(self::GOOGLE_PLUS_BASE_URL . urlencode($this->request) . '/posts'
|
||||||
// force language
|
// force language
|
||||||
, 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"
|
||||||
|
|
|
@ -35,7 +35,7 @@ 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->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM('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->returnClientError('You must specify a keyword (?q=...).');
|
$this->returnClientError('You must specify a keyword (?q=...).');
|
||||||
|
@ -45,7 +45,7 @@ class GoogleSearchBridge extends BridgeAbstract{
|
||||||
if( !is_null($emIsRes) ){
|
if( !is_null($emIsRes) ){
|
||||||
foreach($emIsRes->find('li[class=g]') as $element) {
|
foreach($emIsRes->find('li[class=g]') as $element) {
|
||||||
$item = new Item();
|
$item = new Item();
|
||||||
|
|
||||||
// Extract direct URL from google href (eg. /url?q=...)
|
// Extract direct URL from google href (eg. /url?q=...)
|
||||||
$t = $element->find('a[href]',0)->href;
|
$t = $element->find('a[href]',0)->href;
|
||||||
$item->uri = ''.$t;
|
$item->uri = ''.$t;
|
||||||
|
|
|
@ -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->returnServerError('Could not request Gurumed.');
|
$html = $this->getSimpleHTMLDOM('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) {
|
||||||
|
|
|
@ -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->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM($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);
|
||||||
|
|
|
@ -12,7 +12,7 @@ class HentaiHavenBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$html = $this->file_get_html('http://hentaihaven.org/') or $this->returnServerError('Could not request Hentai Haven.');
|
$html = $this->getSimpleHTMLDOM('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;
|
||||||
|
|
|
@ -25,7 +25,7 @@ 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->returnServerError('Requested username can\'t be found.');
|
$html = $this->getSimpleHTMLDOM('https://identi.ca/'.urlencode($this->request)) or $this->returnServerError('Requested username can\'t be found.');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->returnClientError('You must specify an Identica username (?u=...).');
|
$this->returnClientError('You must specify an Identica username (?u=...).');
|
||||||
|
|
|
@ -25,35 +25,35 @@ 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->returnServerError('Could not request Instagram.');
|
$html = $this->getSimpleHTMLDOM('http://instagram.com/'.urlencode($this->request)) or $this->returnServerError('Could not request Instagram.');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->returnClientError('You must specify a Instagram username (?u=...).');
|
$this->returnClientError('You must specify a Instagram username (?u=...).');
|
||||||
}
|
}
|
||||||
|
|
||||||
$innertext = null;
|
$innertext = null;
|
||||||
|
|
||||||
foreach($html->find('script') as $script)
|
foreach($html->find('script') as $script)
|
||||||
{
|
{
|
||||||
if ('' === $script->innertext) {
|
if ('' === $script->innertext) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pos = strpos(trim($script->innertext), 'window._sharedData');
|
$pos = strpos(trim($script->innertext), 'window._sharedData');
|
||||||
if (0 !== $pos)
|
if (0 !== $pos)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$innertext = $script->innertext;
|
$innertext = $script->innertext;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$json = trim(substr($innertext, $pos+18), ' =;');
|
$json = trim(substr($innertext, $pos+18), ' =;');
|
||||||
$data = json_decode($json);
|
$data = json_decode($json);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$userMedia = $data->entry_data->ProfilePage[0]->user->media->nodes;
|
$userMedia = $data->entry_data->ProfilePage[0]->user->media->nodes;
|
||||||
|
|
||||||
foreach($userMedia as $media)
|
foreach($userMedia as $media)
|
||||||
|
@ -70,7 +70,7 @@ class InstagramBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
$item->timestamp = $media->date;
|
$item->timestamp = $media->date;
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -543,7 +543,7 @@ class IsoHuntBridge extends BridgeAbstract{
|
||||||
#region Generic helper functions
|
#region Generic helper functions
|
||||||
|
|
||||||
private function load_html($uri){
|
private function load_html($uri){
|
||||||
$html = $this->file_get_html($uri);
|
$html = $this->getSimpleHTMLDOM($uri);
|
||||||
if(!$html)
|
if(!$html)
|
||||||
$this->returnServerError('Unable to load ' . $uri . '!');
|
$this->returnServerError('Unable to load ' . $uri . '!');
|
||||||
|
|
||||||
|
|
|
@ -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->returnServerError('Could not request JapanExpo: '.$link);
|
$html = $this->getSimpleHTMLDOM($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->returnServerError('Could not request JapanExpo: '.$url);
|
$article_html = $this->getSimpleHTMLDOM($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();
|
||||||
|
|
|
@ -25,18 +25,18 @@ class KonachanBridge extends BridgeAbstract{
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$page = 1;$tags='';
|
$page = 1;$tags='';
|
||||||
if (isset($param['p'])) {
|
if (isset($param['p'])) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
||||||
}
|
}
|
||||||
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->returnServerError('Could not request Konachan.');
|
$html = $this->getSimpleHTMLDOM("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);
|
||||||
unset($data[0]);
|
unset($data[0]);
|
||||||
|
|
||||||
foreach($data as $datai) {
|
foreach($data as $datai) {
|
||||||
$json = json_decode($datai, TRUE);
|
$json = json_decode($datai, TRUE);
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
|
@ -45,7 +45,7 @@ class KonachanBridge extends BridgeAbstract{
|
||||||
$item->timestamp = $json['created_at'];
|
$item->timestamp = $json['created_at'];
|
||||||
$item->imageUri = $json['file_url'];
|
$item->imageUri = $json['file_url'];
|
||||||
$item->title = 'Konachan | '.$json['id'];
|
$item->title = 'Konachan | '.$json['id'];
|
||||||
$item->content = '<a href="' . $item->imageUri . '"><img src="' . $json['preview_url'] . '" /></a><br>Tags: '.$json['tags'];
|
$item->content = '<a href="' . $item->imageUri . '"><img src="' . $json['preview_url'] . '" /></a><br>Tags: '.$json['tags'];
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,14 +16,14 @@ class KoreusBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
private function KoreusExtractContent($url) {
|
private function KoreusExtractContent($url) {
|
||||||
$html2 = $this->file_get_html($url);
|
$html2 = $this->getSimpeHTMLDOM($url);
|
||||||
$text = $html2->find('p[class=itemText]', 0)->innertext;
|
$text = $html2->find('p[class=itemText]', 0)->innertext;
|
||||||
$text = utf8_encode(preg_replace('/(Sur le m.+?)+$/i','',$text));
|
$text = utf8_encode(preg_replace('/(Sur le m.+?)+$/i','',$text));
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$html = $this->file_get_html('http://feeds.feedburner.com/Koreus-articles') or $this->returnServerError('Could not request Koreus.');
|
$html = $this->getSimpleHTMLDOM('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) {
|
||||||
|
|
|
@ -94,7 +94,7 @@ class KununuBridge extends BridgeAbstract{
|
||||||
$this->uri .= "/{$site}/{$company}/{$section}";
|
$this->uri .= "/{$site}/{$company}/{$section}";
|
||||||
|
|
||||||
// Load page
|
// Load page
|
||||||
$html = $this->file_get_html($this->uri);
|
$html = $this->getSimplHTMLDOM($this->uri);
|
||||||
if($html === false)
|
if($html === false)
|
||||||
$this->returnServerError('Unable to receive data from ' . $this->uri . '!');
|
$this->returnServerError('Unable to receive data from ' . $this->uri . '!');
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ class KununuBridge extends BridgeAbstract{
|
||||||
*/
|
*/
|
||||||
private function extract_full_description($uri){
|
private function extract_full_description($uri){
|
||||||
// Load full article
|
// Load full article
|
||||||
$html = file_get_html($uri);
|
$html = $this->getSimpleHTMLDOM($uri);
|
||||||
if($html === false)
|
if($html === false)
|
||||||
$this->returnServerError('Could not load full description!');
|
$this->returnServerError('Could not load full description!');
|
||||||
|
|
||||||
|
|
|
@ -134,10 +134,10 @@ class LeBonCoinBridge extends BridgeAbstract{
|
||||||
"type" : "list",
|
"type" : "list",
|
||||||
"values" : [
|
"values" : [
|
||||||
{ "name" : "---- Select ----", "value" : "" },
|
{ "name" : "---- Select ----", "value" : "" },
|
||||||
|
|
||||||
{ "name" : "", "value" : "" },
|
{ "name" : "", "value" : "" },
|
||||||
{ "name" : "EMPLOI", "value" : "_emploi_" },
|
{ "name" : "EMPLOI", "value" : "_emploi_" },
|
||||||
|
|
||||||
{ "name" : "", "value" : "" },
|
{ "name" : "", "value" : "" },
|
||||||
{ "name" : "VEHICULES", "value" : "_vehicules_" },
|
{ "name" : "VEHICULES", "value" : "_vehicules_" },
|
||||||
{ "name" : " Voitures", "value" : "voitures" },
|
{ "name" : " Voitures", "value" : "voitures" },
|
||||||
|
@ -149,14 +149,14 @@ class LeBonCoinBridge extends BridgeAbstract{
|
||||||
{ "name" : " Equipement Caravaning", "value" : "equipement_caravaning" },
|
{ "name" : " Equipement Caravaning", "value" : "equipement_caravaning" },
|
||||||
{ "name" : " Nautisme", "value" : "nautisme" },
|
{ "name" : " Nautisme", "value" : "nautisme" },
|
||||||
{ "name" : " Equipement Nautisme", "value" : "equipement_nautisme" },
|
{ "name" : " Equipement Nautisme", "value" : "equipement_nautisme" },
|
||||||
|
|
||||||
{ "name" : "", "value" : "" },
|
{ "name" : "", "value" : "" },
|
||||||
{ "name" : "IMMOBILIER", "value" : "_immobilier_" },
|
{ "name" : "IMMOBILIER", "value" : "_immobilier_" },
|
||||||
{ "name" : " Ventes immobilieres", "value" : "ventes_immobilieres" },
|
{ "name" : " Ventes immobilieres", "value" : "ventes_immobilieres" },
|
||||||
{ "name" : " Locations", "value" : "locations" },
|
{ "name" : " Locations", "value" : "locations" },
|
||||||
{ "name" : " Colocations", "value" : "colocations" },
|
{ "name" : " Colocations", "value" : "colocations" },
|
||||||
{ "name" : " Bureaux & Commerces", "value" : "bureaux_commerces" },
|
{ "name" : " Bureaux & Commerces", "value" : "bureaux_commerces" },
|
||||||
|
|
||||||
{ "name" : "", "value" : "" },
|
{ "name" : "", "value" : "" },
|
||||||
{ "name" : "VACANCES", "value" : "_vacances_" },
|
{ "name" : "VACANCES", "value" : "_vacances_" },
|
||||||
{ "name" : " Locations gites", "value" : "locations_gites" },
|
{ "name" : " Locations gites", "value" : "locations_gites" },
|
||||||
|
@ -164,14 +164,14 @@ class LeBonCoinBridge extends BridgeAbstract{
|
||||||
{ "name" : " Campings", "value" : "campings" },
|
{ "name" : " Campings", "value" : "campings" },
|
||||||
{ "name" : " Hôtels", "value" : "hotels" },
|
{ "name" : " Hôtels", "value" : "hotels" },
|
||||||
{ "name" : " Hébergements insolites", "value" : "hebergements_insolites" },
|
{ "name" : " Hébergements insolites", "value" : "hebergements_insolites" },
|
||||||
|
|
||||||
{ "name" : "", "value" : "" },
|
{ "name" : "", "value" : "" },
|
||||||
{ "name" : "MULTIMEDIA", "value" : "_multimedia_" },
|
{ "name" : "MULTIMEDIA", "value" : "_multimedia_" },
|
||||||
{ "name" : " Informatique", "value" : "informatique" },
|
{ "name" : " Informatique", "value" : "informatique" },
|
||||||
{ "name" : " Consoles & Jeux vidéo", "value" : "consoles_jeux_video" },
|
{ "name" : " Consoles & Jeux vidéo", "value" : "consoles_jeux_video" },
|
||||||
{ "name" : " Image & Son", "value" : "image_son" },
|
{ "name" : " Image & Son", "value" : "image_son" },
|
||||||
{ "name" : " Téléphonie", "value" : "telephonie" },
|
{ "name" : " Téléphonie", "value" : "telephonie" },
|
||||||
|
|
||||||
{ "name" : "", "value" : "" },
|
{ "name" : "", "value" : "" },
|
||||||
{ "name" : "LOISIRS", "value" : "_loisirs_" },
|
{ "name" : "LOISIRS", "value" : "_loisirs_" },
|
||||||
{ "name" : " DVD / Films", "value" : "dvd_films" },
|
{ "name" : " DVD / Films", "value" : "dvd_films" },
|
||||||
|
@ -184,7 +184,7 @@ class LeBonCoinBridge extends BridgeAbstract{
|
||||||
{ "name" : " Collection", "value" : "collection" },
|
{ "name" : " Collection", "value" : "collection" },
|
||||||
{ "name" : " Jeux & Jouets", "value" : "jeux_jouets" },
|
{ "name" : " Jeux & Jouets", "value" : "jeux_jouets" },
|
||||||
{ "name" : " Vins & Gastronomie", "value" : "vins_gastronomie" },
|
{ "name" : " Vins & Gastronomie", "value" : "vins_gastronomie" },
|
||||||
|
|
||||||
{ "name" : "", "value" : "" },
|
{ "name" : "", "value" : "" },
|
||||||
{ "name" : "MATERIEL PROFESSIONNEL", "value" : "_materiel_professionnel_" },
|
{ "name" : "MATERIEL PROFESSIONNEL", "value" : "_materiel_professionnel_" },
|
||||||
{ "name" : " Materiel Agricole", "value" : "materiel_agricole" },
|
{ "name" : " Materiel Agricole", "value" : "materiel_agricole" },
|
||||||
|
@ -196,7 +196,7 @@ class LeBonCoinBridge extends BridgeAbstract{
|
||||||
{ "name" : " Fournitures de Bureau", "value" : "fournitures_de_bureau" },
|
{ "name" : " Fournitures de Bureau", "value" : "fournitures_de_bureau" },
|
||||||
{ "name" : " Commerces & Marchés", "value" : "commerces_marches" },
|
{ "name" : " Commerces & Marchés", "value" : "commerces_marches" },
|
||||||
{ "name" : " Matériel médical", "value" : "materiel_medical" },
|
{ "name" : " Matériel médical", "value" : "materiel_medical" },
|
||||||
|
|
||||||
{ "name" : "", "value" : "" },
|
{ "name" : "", "value" : "" },
|
||||||
{ "name" : "SERVICES", "value" : "_services_" },
|
{ "name" : "SERVICES", "value" : "_services_" },
|
||||||
{ "name" : " Prestations de services", "value" : "prestations_de_services" },
|
{ "name" : " Prestations de services", "value" : "prestations_de_services" },
|
||||||
|
@ -204,7 +204,7 @@ class LeBonCoinBridge extends BridgeAbstract{
|
||||||
{ "name" : " Evénements", "value" : "evenements" },
|
{ "name" : " Evénements", "value" : "evenements" },
|
||||||
{ "name" : " Cours particuliers", "value" : "cours_particuliers" },
|
{ "name" : " Cours particuliers", "value" : "cours_particuliers" },
|
||||||
{ "name" : " Covoiturage", "value" : "covoiturage" },
|
{ "name" : " Covoiturage", "value" : "covoiturage" },
|
||||||
|
|
||||||
{ "name" : "", "value" : "" },
|
{ "name" : "", "value" : "" },
|
||||||
{ "name" : "MAISON", "value" : "_maison_" },
|
{ "name" : "MAISON", "value" : "_maison_" },
|
||||||
{ "name" : " Ameublement", "value" : "ameublement" },
|
{ "name" : " Ameublement", "value" : "ameublement" },
|
||||||
|
@ -220,7 +220,7 @@ class LeBonCoinBridge extends BridgeAbstract{
|
||||||
{ "name" : " Montres & Bijoux", "value" : "montres_bijoux" },
|
{ "name" : " Montres & Bijoux", "value" : "montres_bijoux" },
|
||||||
{ "name" : " Equipement bébé", "value" : "equipement_bebe" },
|
{ "name" : " Equipement bébé", "value" : "equipement_bebe" },
|
||||||
{ "name" : " Vêtements bébé", "value" : "vetements_bebe" },
|
{ "name" : " Vêtements bébé", "value" : "vetements_bebe" },
|
||||||
|
|
||||||
{ "name" : "", "value" : "" },
|
{ "name" : "", "value" : "" },
|
||||||
{ "name" : "AUTRES", "value" : "autres" }
|
{ "name" : "AUTRES", "value" : "autres" }
|
||||||
]
|
]
|
||||||
|
@ -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->returnServerError('Could not request LeBonCoin.');
|
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request LeBonCoin.');
|
||||||
|
|
||||||
$list = $html->find('.tabsContent', 0);
|
$list = $html->find('.tabsContent', 0);
|
||||||
if($list === NULL) {
|
if($list === NULL) {
|
||||||
|
@ -275,4 +275,4 @@ class LeBonCoinBridge extends BridgeAbstract{
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ class LeJournalDuGeekBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
private function LeJournalDuGeekExtractContent($url) {
|
private function LeJournalDuGeekExtractContent($url) {
|
||||||
$articleHTMLContent = $this->file_get_html($url);
|
$articleHTMLContent = $this->getSimpleHMLDOM($url);
|
||||||
$text = $articleHTMLContent->find('div.post-content', 0)->innertext;
|
$text = $articleHTMLContent->find('div.post-content', 0)->innertext;
|
||||||
|
|
||||||
foreach($articleHTMLContent->find('a.more') as $element) {
|
foreach($articleHTMLContent->find('a.more') as $element) {
|
||||||
|
@ -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->returnServerError('Could not request http://www.journaldugeek.com/rss');
|
$rssFeed = $this->getSimpleHTMLDOM('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) {
|
||||||
|
|
|
@ -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->returnServerError('Could not request LeMondeInformatique: '.$feedUrl);
|
$html = $this->getSimpleHTMLDOM($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->returnServerError('Could not request LeMondeInformatique: '.$article_uri);
|
$article_html = $this->getSimpleHTMLDOM($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;
|
||||||
|
|
||||||
|
|
|
@ -12,14 +12,14 @@ class LesJoiesDuCodeBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$html = $this->file_get_html('http://lesjoiesducode.fr/') or $this->returnServerError('Could not request LesJoiesDuCode.');
|
$html = $this->getSimpleHTMLDOM('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();
|
||||||
$temp = $element->find('h1 a', 0);
|
$temp = $element->find('h1 a', 0);
|
||||||
$titre = html_entity_decode($temp->innertext);
|
$titre = html_entity_decode($temp->innertext);
|
||||||
$url = $temp->href;
|
$url = $temp->href;
|
||||||
|
|
||||||
$temp = $element->find('div.blog-post-content', 0);
|
$temp = $element->find('div.blog-post-content', 0);
|
||||||
|
|
||||||
// retrieve .gif instead of static .jpg
|
// retrieve .gif instead of static .jpg
|
||||||
|
@ -29,21 +29,21 @@ class LesJoiesDuCodeBridge extends BridgeAbstract{
|
||||||
$image->src = $img_src;
|
$image->src = $img_src;
|
||||||
}
|
}
|
||||||
$content = $temp->innertext;
|
$content = $temp->innertext;
|
||||||
|
|
||||||
$auteur = $temp->find('i', 0);
|
$auteur = $temp->find('i', 0);
|
||||||
$pos = strpos($auteur->innertext, "by");
|
$pos = strpos($auteur->innertext, "by");
|
||||||
|
|
||||||
if($pos > 0)
|
if($pos > 0)
|
||||||
{
|
{
|
||||||
$auteur = trim(str_replace("*/", "", substr($auteur->innertext, ($pos + 2))));
|
$auteur = trim(str_replace("*/", "", substr($auteur->innertext, ($pos + 2))));
|
||||||
$item->author = $auteur;
|
$item->author = $auteur;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$item->content .= trim($content);
|
$item->content .= trim($content);
|
||||||
$item->uri = $url;
|
$item->uri = $url;
|
||||||
$item->title = trim($titre);
|
$item->title = trim($titre);
|
||||||
|
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ class LichessBridge extends BridgeAbstract
|
||||||
|
|
||||||
public function collectData(array $param)
|
public function collectData(array $param)
|
||||||
{
|
{
|
||||||
$xml_feed = $this->file_get_html('http://fr.lichess.org/blog.atom') or $this->returnServerError('Could not retrieve Lichess blog feed.');
|
$xml_feed = $this->getSimpleHTMLDOM('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)
|
||||||
|
@ -37,7 +37,7 @@ class LichessBridge extends BridgeAbstract
|
||||||
|
|
||||||
private function retrieve_lichess_post($blog_post_uri)
|
private function retrieve_lichess_post($blog_post_uri)
|
||||||
{
|
{
|
||||||
$blog_post_html = $this->file_get_html($blog_post_uri);
|
$blog_post_html = $this->getSimpleHTMLDOM($blog_post_uri);
|
||||||
$blog_post_div = $blog_post_html->find('#lichess_blog', 0);
|
$blog_post_div = $blog_post_html->find('#lichess_blog', 0);
|
||||||
|
|
||||||
$post_chapo = $blog_post_div->find('.shortlede', 0)->innertext;
|
$post_chapo = $blog_post_div->find('.shortlede', 0)->innertext;
|
||||||
|
|
|
@ -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->returnServerError('Could not request LinkedIn.');
|
$html = $this->getSimpleHTMLDOM($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;
|
||||||
|
|
|
@ -26,18 +26,18 @@ class LolibooruBridge extends BridgeAbstract{
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$page = 1; $tags = '';
|
$page = 1; $tags = '';
|
||||||
if (isset($param['p'])) {
|
if (isset($param['p'])) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
||||||
}
|
}
|
||||||
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->returnServerError('Could not request Lolibooru.');
|
$html = $this->getSimpleHTMLDOM("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);
|
||||||
unset($data[0]);
|
unset($data[0]);
|
||||||
|
|
||||||
foreach($data as $datai) {
|
foreach($data as $datai) {
|
||||||
$json = json_decode($datai, TRUE);
|
$json = json_decode($datai, TRUE);
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
|
@ -46,7 +46,7 @@ class LolibooruBridge extends BridgeAbstract{
|
||||||
$item->timestamp = $json['created_at'];
|
$item->timestamp = $json['created_at'];
|
||||||
$item->imageUri = $json['file_url'];
|
$item->imageUri = $json['file_url'];
|
||||||
$item->title = 'Lolibooru | '.$json['id'];
|
$item->title = 'Lolibooru | '.$json['id'];
|
||||||
$item->content = '<a href="' . $item->imageUri . '"><img src="' . $json['preview_url'] . '" /></a><br>Tags: '.$json['tags'];
|
$item->content = '<a href="' . $item->imageUri . '"><img src="' . $json['preview_url'] . '" /></a><br>Tags: '.$json['tags'];
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,25 +25,25 @@ class MilbooruBridge extends BridgeAbstract{
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$page = 0;$tags='';
|
$page = 0;$tags='';
|
||||||
if (isset($param['p'])) {
|
if (isset($param['p'])) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
||||||
}
|
}
|
||||||
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->returnServerError('Could not request Milbooru.');
|
$html = $this->getSimpleHTMLDOM("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) {
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
$item->uri = 'http://sheslostcontrol.net/moe/shimmie/'.$element->find('a', 0)->href;
|
$item->uri = 'http://sheslostcontrol.net/moe/shimmie/'.$element->find('a', 0)->href;
|
||||||
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->find('a', 0)->getAttribute('data-post-id'));
|
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->find('a', 0)->getAttribute('data-post-id'));
|
||||||
$item->timestamp = time();
|
$item->timestamp = time();
|
||||||
$thumbnailUri = 'http://sheslostcontrol.net/moe/shimmie/'.$element->find('img', 0)->src;
|
$thumbnailUri = 'http://sheslostcontrol.net/moe/shimmie/'.$element->find('img', 0)->src;
|
||||||
$item->tags = $element->find('a', 0)->getAttribute('data-tags');
|
$item->tags = $element->find('a', 0)->getAttribute('data-tags');
|
||||||
$item->title = 'Milbooru | '.$item->postid;
|
$item->title = 'Milbooru | '.$item->postid;
|
||||||
$item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item->tags;
|
$item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item->tags;
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ class MondeDiploBridge extends BridgeAbstract{
|
||||||
$this->update = '2016-08-17';
|
$this->update = '2016-08-17';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$html = $this->file_get_html($this->uri) or $this->returnServerError('Could not request MondeDiplo. for : ' . $link);
|
$html = $this->getSimpleHTMLDOM($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();
|
||||||
|
|
|
@ -10,13 +10,13 @@ class MsnMondeBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
private function MsnMondeExtractContent($url, &$item) {
|
private function MsnMondeExtractContent($url, &$item) {
|
||||||
$html2 = $this->file_get_html($url);
|
$html2 = $this->getSimpleHTLDOM($url);
|
||||||
$item->content = $html2->find('#content', 0)->find('article', 0)->find('section', 0)->plaintext;
|
$item->content = $html2->find('#content', 0)->find('article', 0)->find('section', 0)->plaintext;
|
||||||
$item->timestamp = strtotime($html2->find('.authorinfo-txt', 0)->find('time', 0)->datetime);
|
$item->timestamp = strtotime($html2->find('.authorinfo-txt', 0)->find('time', 0)->datetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$html = $this->file_get_html($this->uri) or $this->returnServerError('Could not request MsnMonde.');
|
$html = $this->getSimpleHTMLDOM($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) {
|
||||||
|
|
|
@ -26,27 +26,27 @@ class MspabooruBridge extends BridgeAbstract{
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$page = 0;$tags='';
|
$page = 0;$tags='';
|
||||||
if (isset($param['p'])) {
|
if (isset($param['p'])) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
||||||
$page = $page - 1;
|
$page = $page - 1;
|
||||||
$page = $page * 50;
|
$page = $page * 50;
|
||||||
}
|
}
|
||||||
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->returnServerError('Could not request Mspabooru.');
|
$html = $this->getSimpleHTMLDOM("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) {
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
$item->uri = 'http://mspabooru.com/'.$element->find('a', 0)->href;
|
$item->uri = 'http://mspabooru.com/'.$element->find('a', 0)->href;
|
||||||
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
|
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
|
||||||
$item->timestamp = time();
|
$item->timestamp = time();
|
||||||
$thumbnailUri = $element->find('img', 0)->src;
|
$thumbnailUri = $element->find('img', 0)->src;
|
||||||
$item->tags = $element->find('img', 0)->getAttribute('alt');
|
$item->tags = $element->find('img', 0)->getAttribute('alt');
|
||||||
$item->title = 'Mspabooru | '.$item->postid;
|
$item->title = 'Mspabooru | '.$item->postid;
|
||||||
$item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item->tags;
|
$item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item->tags;
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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->returnServerError('Could not request '.$this->getName().': '.$feedUrl);
|
$html = $this->getSimpleHTMLDOM($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->returnServerError('Could not request '.$this->getName().': '.$article_uri);
|
$article_html = $this->getSimpleHTMLDOM($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);
|
||||||
|
@ -68,4 +68,4 @@ class NakedSecurityBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ class NasaApodBridge extends BridgeAbstract{
|
||||||
|
|
||||||
public function collectData(array $param) {
|
public function collectData(array $param) {
|
||||||
|
|
||||||
$html = $this->file_get_html('http://apod.nasa.gov/apod/archivepix.html') or $this->returnServerError('Error while downloading the website content');
|
$html = $this->getSimpleHTMLDOM('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++)
|
||||||
|
@ -25,7 +25,7 @@ class NasaApodBridge extends BridgeAbstract{
|
||||||
$uri = 'http://apod.nasa.gov/apod/'.$uri_page;
|
$uri = 'http://apod.nasa.gov/apod/'.$uri_page;
|
||||||
$item->uri = $uri;
|
$item->uri = $uri;
|
||||||
|
|
||||||
$picture_html = $this->file_get_html($uri);
|
$picture_html = $this->getSimpleHTMLDOM($uri);
|
||||||
$picture_html_string = $picture_html->innertext;
|
$picture_html_string = $picture_html->innertext;
|
||||||
|
|
||||||
//Extract image and explanation
|
//Extract image and explanation
|
||||||
|
|
|
@ -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->returnServerError('Could not request 9eme Art: '.$feedUrl);
|
$html = $this->getSimpleHTMLDOM($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->returnServerError('Could not request 9eme Art: '.$article_uri);
|
$article_html = $this->getSimpleHTMLDOM($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);
|
||||||
|
|
|
@ -16,7 +16,7 @@ class NextInpactBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
private function ExtractContent($url) {
|
private function ExtractContent($url) {
|
||||||
$html2 = $this->file_get_html($url);
|
$html2 = $this->getSimpleHTLDOM($url);
|
||||||
$text = '<p><em>'.$html2->find('span.sub_title', 0)->innertext.'</em></p>'
|
$text = '<p><em>'.$html2->find('span.sub_title', 0)->innertext.'</em></p>'
|
||||||
.'<p><img src="'.$html2->find('div.container_main_image_article', 0)->find('img.dedicated',0)->src.'" alt="-" /></p>'
|
.'<p><img src="'.$html2->find('div.container_main_image_article', 0)->find('img.dedicated',0)->src.'" alt="-" /></p>'
|
||||||
.'<div>'.$html2->find('div[itemprop=articleBody]', 0)->innertext.'</div>';
|
.'<div>'.$html2->find('div[itemprop=articleBody]', 0)->innertext.'</div>';
|
||||||
|
@ -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->returnServerError('Could not request NextInpact.');
|
$html = $this->getSimpleHTMLDOM('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) {
|
||||||
|
|
|
@ -57,7 +57,7 @@ class NextgovBridge extends BridgeAbstract {
|
||||||
if ($category !== preg_replace('/[^a-z-]+/', '', $category) || strlen($category > 32))
|
if ($category !== preg_replace('/[^a-z-]+/', '', $category) || strlen($category > 32))
|
||||||
$this->returnClientError('Invalid "category" parameter.');
|
$this->returnClientError('Invalid "category" parameter.');
|
||||||
$url = $this->getURI().'rss/'.$category.'/';
|
$url = $this->getURI().'rss/'.$category.'/';
|
||||||
$html = $this->file_get_html($url) or $this->returnServerError('Could not request Nextgov: '.$url);
|
$html = $this->getSimpleHTMLDOM($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->returnServerError('Could not request Nextgov: '.$article_url);
|
$article = $this->getSimpleHTMLDOM($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>');
|
||||||
|
@ -91,4 +91,4 @@ class NextgovBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,21 +10,21 @@ class NiceMatinBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
private function NiceMatinExtractContent($url) {
|
private function NiceMatinExtractContent($url) {
|
||||||
$html = $this->file_get_html($url);
|
$html = $this->getSimpleHTMLDOM($url);
|
||||||
if(!$html)
|
if(!$html)
|
||||||
$this->returnServerError('Could not acquire content from url: ' . $url . '!');
|
$this->returnServerError('Could not acquire content from url: ' . $url . '!');
|
||||||
|
|
||||||
$content = $html->find('article', 0);
|
$content = $html->find('article', 0);
|
||||||
if(!$content)
|
if(!$content)
|
||||||
$this->returnServerError('Could not find \'section\'!');
|
$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>');
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$html = $this->file_get_html('http://www.nicematin.com/derniere-minute/rss') or $this->returnServerError('Could not request NiceMatin.');
|
$html = $this->getSimpleHTMLDOM('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) {
|
||||||
|
|
|
@ -26,7 +26,7 @@ class NovelUpdatesBridge extends BridgeAbstract{
|
||||||
if(strpos($thread['path'], 'series/') === FALSE)
|
if(strpos($thread['path'], 'series/') === FALSE)
|
||||||
$this->returnClientError('You must specify the novel URL.');
|
$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->returnServerError("Could not request NovelUpdates, novel not found");
|
$fullhtml = $this->getSimpleHTMLDOM($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
|
||||||
|
|
|
@ -20,7 +20,7 @@ class NumeramaBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
$feed = $this->uri.'feed/';
|
$feed = $this->uri.'feed/';
|
||||||
$html = $this->file_get_html($feed) or $this->returnServerError('Could not request Numerama: '.$feed);
|
$html = $this->getSimpleHTMLDOM($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->returnServerError('Could not request Numerama: '.$article_url);
|
$article_html = $this->getSimpleHTMLDOM($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
|
||||||
|
@ -42,7 +42,6 @@ class NumeramaBridge extends BridgeAbstract{
|
||||||
$limit++;
|
$limit++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCacheDuration() {
|
public function getCacheDuration() {
|
||||||
|
|
|
@ -64,11 +64,11 @@ class OpenClassroomsBridge extends BridgeAbstract{
|
||||||
{
|
{
|
||||||
$this->returnServerError('Error: You must chose a category.');
|
$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->returnServerError('Could not request OpenClassrooms.');
|
$html = $this->getSimpleHTMLDOM($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();
|
||||||
|
|
|
@ -47,7 +47,7 @@ class ParuVenduImmoBridge extends BridgeAbstract
|
||||||
$appartment = '&tbApp=1&tbDup=1&tbChb=1&tbLof=1&tbAtl=1&tbPla=1';
|
$appartment = '&tbApp=1&tbDup=1&tbChb=1&tbLof=1&tbAtl=1&tbPla=1';
|
||||||
$maison = '&tbMai=1&tbVil=1&tbCha=1&tbPro=1&tbHot=1&tbMou=1&tbFer=1';
|
$maison = '&tbMai=1&tbVil=1&tbCha=1&tbPro=1&tbHot=1&tbMou=1&tbFer=1';
|
||||||
$link = $this->uri.'/immobilier/annonceimmofo/liste/listeAnnonces?tt=1'.$appartment.$maison;
|
$link = $this->uri.'/immobilier/annonceimmofo/liste/listeAnnonces?tt=1'.$appartment.$maison;
|
||||||
|
|
||||||
if (isset($param['minarea'])) {
|
if (isset($param['minarea'])) {
|
||||||
$this->request .= ' '.$param['minarea'].' m2';
|
$this->request .= ' '.$param['minarea'].' m2';
|
||||||
$link .= '&sur0='.urlencode($param['minarea']);
|
$link .= '&sur0='.urlencode($param['minarea']);
|
||||||
|
@ -56,39 +56,39 @@ class ParuVenduImmoBridge extends BridgeAbstract
|
||||||
if (isset($param['maxprice'])) {
|
if (isset($param['maxprice'])) {
|
||||||
$link .= '&px1='.urlencode($param['maxprice']);
|
$link .= '&px1='.urlencode($param['maxprice']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($param['pa'])) {
|
if (isset($param['pa'])) {
|
||||||
$link .= '&pa='.urlencode($param['pa']);
|
$link .= '&pa='.urlencode($param['pa']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($param['lo'])) {
|
if (isset($param['lo'])) {
|
||||||
$this->request .= ' In: '.$param['lo'];
|
$this->request .= ' In: '.$param['lo'];
|
||||||
$link .= '&lo='.urlencode($param['lo']);
|
$link .= '&lo='.urlencode($param['lo']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = $this->file_get_html($link) or $this->returnServerError('Could not request paruvendu.');
|
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request paruvendu.');
|
||||||
|
|
||||||
|
|
||||||
foreach($html->find('div.annonce a') as $element) {
|
foreach($html->find('div.annonce a') as $element) {
|
||||||
|
|
||||||
if (!$element->title) {
|
if (!$element->title) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$img ='';
|
$img ='';
|
||||||
foreach($element->find('span.img img') as $img) {
|
foreach($element->find('span.img img') as $img) {
|
||||||
if ($img->original) {
|
if ($img->original) {
|
||||||
$img = '<img src="'.$img->original.'" />';
|
$img = '<img src="'.$img->original.'" />';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$desc = $element->find('span.desc')[0]->innertext;
|
$desc = $element->find('span.desc')[0]->innertext;
|
||||||
$desc = str_replace("voir l'annonce", '', $desc);
|
$desc = str_replace("voir l'annonce", '', $desc);
|
||||||
|
|
||||||
$price = $element->find('span.price')[0]->innertext;
|
$price = $element->find('span.price')[0]->innertext;
|
||||||
|
|
||||||
list($href) = explode('#', $element->href);
|
list($href) = explode('#', $element->href);
|
||||||
|
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
$item->uri = $this->uri.$href;
|
$item->uri = $this->uri.$href;
|
||||||
$item->title = $element->title;
|
$item->title = $element->title;
|
||||||
|
|
|
@ -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->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM($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);
|
||||||
|
|
|
@ -38,7 +38,7 @@ class PinterestBridge extends BridgeAbstract{
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$html = '';
|
$html = '';
|
||||||
if (isset($param['u']) || isset($param['b'])) {
|
if (isset($param['u']) || isset($param['b'])) {
|
||||||
|
|
||||||
if (empty($param['u']))
|
if (empty($param['u']))
|
||||||
{
|
{
|
||||||
$this->returnClientError('You must specify a Pinterest username (?u=...).');
|
$this->returnClientError('You must specify a Pinterest username (?u=...).');
|
||||||
|
@ -48,33 +48,33 @@ class PinterestBridge extends BridgeAbstract{
|
||||||
{
|
{
|
||||||
$this->returnClientError('You must specify a Pinterest board for this username (?b=...).');
|
$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->returnServerError('Username and/or board not found');
|
$html = $this->getSimpleHTMLDOM($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->returnServerError('Could not request Pinterest.');
|
$html = $this->getSimpleHTMLDOM($this->getURI().'/search/?q='.urlencode($this->query)) or $this->returnServerError('Could not request Pinterest.');
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
$this->returnClientError('You must specify a Pinterest username and a board name (?u=...&b=...).');
|
$this->returnClientError('You must specify a Pinterest username and a board name (?u=...&b=...).');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach($html->find('div.pinWrapper') as $div)
|
foreach($html->find('div.pinWrapper') as $div)
|
||||||
{
|
{
|
||||||
$a = $div->find('a.pinImageWrapper',0);
|
$a = $div->find('a.pinImageWrapper',0);
|
||||||
|
|
||||||
$img = $a->find('img', 0);
|
$img = $a->find('img', 0);
|
||||||
|
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
$item->uri = $this->getURI().$a->getAttribute('href');
|
$item->uri = $this->getURI().$a->getAttribute('href');
|
||||||
$item->content = '<img src="' . htmlentities(str_replace('/236x/', '/736x/', $img->getAttribute('src'))) . '" alt="" />';
|
$item->content = '<img src="' . htmlentities(str_replace('/236x/', '/736x/', $img->getAttribute('src'))) . '" alt="" />';
|
||||||
|
|
||||||
|
|
||||||
if (isset($this->query))
|
if (isset($this->query))
|
||||||
{
|
{
|
||||||
$avatar = $div->find('div.creditImg', 0)->find('img', 0);
|
$avatar = $div->find('div.creditImg', 0)->find('img', 0);
|
||||||
|
@ -84,25 +84,25 @@ class PinterestBridge extends BridgeAbstract{
|
||||||
|
|
||||||
$username = $div->find('div.creditName', 0);
|
$username = $div->find('div.creditName', 0);
|
||||||
$board = $div->find('div.creditTitle', 0);
|
$board = $div->find('div.creditTitle', 0);
|
||||||
|
|
||||||
$item->username =$username->innertext;
|
$item->username =$username->innertext;
|
||||||
$item->fullname = $board->innertext;
|
$item->fullname = $board->innertext;
|
||||||
$item->avatar = $avatar;
|
$item->avatar = $avatar;
|
||||||
|
|
||||||
$item->content .= '<br /><img align="left" style="margin: 2px 4px;" src="'.htmlentities($item->avatar).'" /> <strong>'.$item->username.'</strong>';
|
$item->content .= '<br /><img align="left" style="margin: 2px 4px;" src="'.htmlentities($item->avatar).'" /> <strong>'.$item->username.'</strong>';
|
||||||
$item->content .= '<br />'.$item->fullname;
|
$item->content .= '<br />'.$item->fullname;
|
||||||
}
|
}
|
||||||
|
|
||||||
$item->title = $img->getAttribute('alt');
|
$item->title = $img->getAttribute('alt');
|
||||||
|
|
||||||
//$item->timestamp = $media->created_time;
|
//$item->timestamp = $media->created_time;
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName(){
|
||||||
|
|
||||||
if (isset($this->query))
|
if (isset($this->query))
|
||||||
{
|
{
|
||||||
return $this->query .' - Pinterest';
|
return $this->query .' - Pinterest';
|
||||||
|
|
|
@ -10,13 +10,13 @@ class PlanetLibreBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
private function PlanetLibreExtractContent($url){
|
private function PlanetLibreExtractContent($url){
|
||||||
$html2 = $this->file_get_html($url);
|
$html2 = $this->geSimpleHTMLDOM($url);
|
||||||
$text = $html2->find('div[class="post-text"]', 0)->innertext;
|
$text = $html2->find('div[class="post-text"]', 0)->innertext;
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$html = $this->file_get_html('http://www.planet-libre.org/') or $this->returnServerError('Could not request PlanetLibre.');
|
$html = $this->getSimpleHTMLDOM('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) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ class ProjectMGameBridge extends BridgeAbstract{
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$html = '';
|
$html = '';
|
||||||
$html = $this->file_get_html('http://projectmgame.com/en/') or $this->returnServerError('Error while downloading the Project M homepage');
|
$html = $this->getSimpleHTMLDOM('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();
|
||||||
|
|
|
@ -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->returnServerError('Could not request RTBF.');
|
$html = $this->getSimpleHTMLDOM('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) {
|
||||||
|
|
|
@ -66,7 +66,7 @@ class Releases3DSBridge extends BridgeAbstract {
|
||||||
//Retrieve cover art and short desc from IGN?
|
//Retrieve cover art and short desc from IGN?
|
||||||
$ignResult = false; $ignDescription = ''; $ignLink = ''; $ignDate = time(); $ignCoverArt = '';
|
$ignResult = false; $ignDescription = ''; $ignLink = ''; $ignDate = time(); $ignCoverArt = '';
|
||||||
$ignSearchUrl = 'http://www.ign.com/search?q='.urlencode($name);
|
$ignSearchUrl = 'http://www.ign.com/search?q='.urlencode($name);
|
||||||
if ($ignResult = $this->file_get_html($ignSearchUrl)) {
|
if ($ignResult = $this->getSimpleHTMLDOM($ignSearchUrl)) {
|
||||||
$ignCoverArt = $ignResult->find('div.search-item-media', 0)->find('img', 0)->src;
|
$ignCoverArt = $ignResult->find('div.search-item-media', 0)->find('img', 0)->src;
|
||||||
$ignDesc = $ignResult->find('div.search-item-description', 0)->plaintext;
|
$ignDesc = $ignResult->find('div.search-item-description', 0)->plaintext;
|
||||||
$ignLink = $ignResult->find('div.search-item-sub-title', 0)->find('a', 1)->href;
|
$ignLink = $ignResult->find('div.search-item-sub-title', 0)->find('a', 1)->href;
|
||||||
|
|
|
@ -10,7 +10,7 @@ class ReporterreBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
private function ExtractContentReporterre($url) {
|
private function ExtractContentReporterre($url) {
|
||||||
$html2 = $this->file_get_html($url);
|
$html2 = $this->getSimpleHTMLDOM($url);
|
||||||
|
|
||||||
foreach($html2->find('div[style=text-align:justify]') as $e) {
|
foreach($html2->find('div[style=text-align:justify]') as $e) {
|
||||||
$text = $e->outertext;
|
$text = $e->outertext;
|
||||||
|
@ -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->returnServerError('Could not request Reporterre.');
|
$html = $this->getSimpleHTMLDOM('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) {
|
||||||
|
|
|
@ -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->returnServerError('Could not request Rue89.');
|
$html = $this->getSimpleHTMLDOM('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) {
|
||||||
|
|
|
@ -25,27 +25,27 @@ class Rule34Bridge extends BridgeAbstract{
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$page = 0;$tags='';
|
$page = 0;$tags='';
|
||||||
if (isset($param['p'])) {
|
if (isset($param['p'])) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
||||||
$page = $page - 1;
|
$page = $page - 1;
|
||||||
$page = $page * 50;
|
$page = $page * 50;
|
||||||
}
|
}
|
||||||
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->returnServerError('Could not request Rule34.');
|
$html = $this->getSimpleHTMLDOM("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) {
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
$item->uri = 'http://rule34.xxx/'.$element->find('a', 0)->href;
|
$item->uri = 'http://rule34.xxx/'.$element->find('a', 0)->href;
|
||||||
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
|
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
|
||||||
$item->timestamp = time();
|
$item->timestamp = time();
|
||||||
$thumbnailUri = $element->find('img', 0)->src;
|
$thumbnailUri = $element->find('img', 0)->src;
|
||||||
$item->tags = $element->find('img', 0)->getAttribute('alt');
|
$item->tags = $element->find('img', 0)->getAttribute('alt');
|
||||||
$item->title = 'Rule34 | '.$item->postid;
|
$item->title = 'Rule34 | '.$item->postid;
|
||||||
$item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item->tags;
|
$item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item->tags;
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,25 +26,25 @@ class Rule34pahealBridge extends BridgeAbstract{
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$page = 0;$tags='';
|
$page = 0;$tags='';
|
||||||
if (isset($param['p'])) {
|
if (isset($param['p'])) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
||||||
}
|
}
|
||||||
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->returnServerError('Could not request Rule34paheal.');
|
$html = $this->getSimpleHTMLDOM("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) {
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
$item->uri = 'http://rule34.paheal.net'.$element->find('a', 0)->href;
|
$item->uri = 'http://rule34.paheal.net'.$element->find('a', 0)->href;
|
||||||
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->find('img', 0)->getAttribute('id'));
|
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->find('img', 0)->getAttribute('id'));
|
||||||
$item->timestamp = time();
|
$item->timestamp = time();
|
||||||
$thumbnailUri = $element->find('img', 0)->src;
|
$thumbnailUri = $element->find('img', 0)->src;
|
||||||
$item->tags = $element->getAttribute('data-tags');
|
$item->tags = $element->getAttribute('data-tags');
|
||||||
$item->title = 'Rule34paheal | '.$item->postid;
|
$item->title = 'Rule34paheal | '.$item->postid;
|
||||||
$item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item->tags;
|
$item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item->tags;
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,27 +26,27 @@ class SafebooruBridge extends BridgeAbstract{
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$page = 0;$tags='';
|
$page = 0;$tags='';
|
||||||
if (isset($param['p'])) {
|
if (isset($param['p'])) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
||||||
$page = $page - 1;
|
$page = $page - 1;
|
||||||
$page = $page * 40;
|
$page = $page * 40;
|
||||||
}
|
}
|
||||||
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->returnServerError('Could not request Safebooru.');
|
$html = $this->getSimpleHTMLDOM("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) {
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
$item->uri = 'http://safebooru.org/'.$element->find('a', 0)->href;
|
$item->uri = 'http://safebooru.org/'.$element->find('a', 0)->href;
|
||||||
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
|
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
|
||||||
$item->timestamp = time();
|
$item->timestamp = time();
|
||||||
$thumbnailUri = $element->find('img', 0)->src;
|
$thumbnailUri = $element->find('img', 0)->src;
|
||||||
$item->tags = $element->find('img', 0)->getAttribute('alt');
|
$item->tags = $element->find('img', 0)->getAttribute('alt');
|
||||||
$item->title = 'Safebooru | '.$item->postid;
|
$item->title = 'Safebooru | '.$item->postid;
|
||||||
$item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item->tags;
|
$item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item->tags;
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,18 +25,18 @@ class SakugabooruBridge extends BridgeAbstract{
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$page = 1;$tags='';
|
$page = 1;$tags='';
|
||||||
if (isset($param['p'])) {
|
if (isset($param['p'])) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
||||||
}
|
}
|
||||||
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->returnServerError('Could not request Sakugabooru.');
|
$html = $this->getSimpleHTMLDOM("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);
|
||||||
unset($data[0]);
|
unset($data[0]);
|
||||||
|
|
||||||
foreach($data as $datai) {
|
foreach($data as $datai) {
|
||||||
$json = json_decode($datai, TRUE);
|
$json = json_decode($datai, TRUE);
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
|
@ -45,7 +45,7 @@ class SakugabooruBridge extends BridgeAbstract{
|
||||||
$item->timestamp = $json['created_at'];
|
$item->timestamp = $json['created_at'];
|
||||||
$item->imageUri = $json['file_url'];
|
$item->imageUri = $json['file_url'];
|
||||||
$item->title = 'Sakugabooru | '.$json['id'];
|
$item->title = 'Sakugabooru | '.$json['id'];
|
||||||
$item->content = '<a href="' . $item->imageUri . '"><img src="' . $json['preview_url'] . '" /></a><br>Tags: '.$json['tags'];
|
$item->content = '<a href="' . $item->imageUri . '"><img src="' . $json['preview_url'] . '" /></a><br>Tags: '.$json['tags'];
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,20 +10,20 @@ class ScmbBridge extends BridgeAbstract{
|
||||||
$this->update = '2016-08-17';
|
$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->returnServerError('Could not request Se Coucher Moins Bete.');
|
$html = $this->getSimpleHTMLDOM('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();
|
||||||
$item->uri = 'http://secouchermoinsbete.fr'.$article->find('p.summary a',0)->href;
|
$item->uri = 'http://secouchermoinsbete.fr'.$article->find('p.summary a',0)->href;
|
||||||
$item->title = $article->find('header h1 a',0)->innertext;
|
$item->title = $article->find('header h1 a',0)->innertext;
|
||||||
|
|
||||||
$article->find('span.read-more',0)->outertext=''; // remove text "En savoir plus" from anecdote content
|
$article->find('span.read-more',0)->outertext=''; // remove text "En savoir plus" from anecdote content
|
||||||
$content = $article->find('p.summary a',0)->innertext;
|
$content = $article->find('p.summary a',0)->innertext;
|
||||||
$content =substr($content,0,strlen($content)-17); // remove superfluous spaces at the end
|
$content =substr($content,0,strlen($content)-17); // remove superfluous spaces at the end
|
||||||
|
|
||||||
// get publication date
|
// get publication date
|
||||||
$str_date = $article->find('time',0)->datetime;
|
$str_date = $article->find('time',0)->datetime;
|
||||||
list($date, $time) = explode(' ', $str_date);
|
list($date, $time) = explode(' ', $str_date);
|
||||||
|
@ -31,8 +31,8 @@ class ScmbBridge extends BridgeAbstract{
|
||||||
list($h, $i) = explode(':', $time);
|
list($h, $i) = explode(':', $time);
|
||||||
$timestamp = mktime($h,$i,0,$m,$d,$y);
|
$timestamp = mktime($h,$i,0,$m,$d,$y);
|
||||||
$item->timestamp = $timestamp;
|
$item->timestamp = $timestamp;
|
||||||
|
|
||||||
|
|
||||||
$item->content = $content;
|
$item->content = $content;
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,9 @@ class ScoopItBridge extends BridgeAbstract{
|
||||||
if ($param['u'] != '') {
|
if ($param['u'] != '') {
|
||||||
$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->returnServerError('Could not request ScoopIt. for : ' . $link);
|
$html = $this->getSimpleHTMLDOM($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();
|
||||||
$item->uri = $element->find('a', 0)->href;
|
$item->uri = $element->find('a', 0)->href;
|
||||||
|
|
|
@ -65,7 +65,7 @@ class SensCritiqueBridge extends BridgeAbstract {
|
||||||
|
|
||||||
private function collectMoviesData() {
|
private function collectMoviesData() {
|
||||||
$html = '';
|
$html = '';
|
||||||
$html = $this->file_get_html('http://www.senscritique.com/films/cette-semaine') or $this->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM('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->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM('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->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM('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->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM('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->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM('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->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM('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);
|
||||||
|
|
|
@ -15,10 +15,10 @@ 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->returnServerError('Could not request '.$this->getURI());
|
$html = $this->getSimpleHTMLDOM($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
|
||||||
$articles = $contentHolder->find('ul', 0);
|
$articles = $contentHolder->find('ul', 0);
|
||||||
foreach($articles->find('li') as $element) {
|
foreach($articles->find('li') as $element) {
|
||||||
// if you ask about that method_exists, there seems to be a bug in simple html dom
|
// if you ask about that method_exists, there seems to be a bug in simple html dom
|
||||||
|
@ -38,7 +38,7 @@ $replace = array('January', 'February', 'March', 'April', 'May', 'June', 'July',
|
||||||
$dateText = $titleTimestamp->innertext;
|
$dateText = $titleTimestamp->innertext;
|
||||||
$dateText = substr($dateText, strpos($dateText,',')+1);
|
$dateText = substr($dateText, strpos($dateText,',')+1);
|
||||||
$dateText = str_replace($find, $replace, strtolower($dateText));
|
$dateText = str_replace($find, $replace, strtolower($dateText));
|
||||||
$date = strtotime($dateText);
|
$date = strtotime($dateText);
|
||||||
$item->timestamp = $date;
|
$item->timestamp = $date;
|
||||||
|
|
||||||
$item->author = "Maïa Mazaurette";
|
$item->author = "Maïa Mazaurette";
|
||||||
|
@ -50,9 +50,9 @@ $replace = array('January', 'February', 'March', 'April', 'May', 'June', 'July',
|
||||||
$item->content = $elementText->innertext;
|
$item->content = $elementText->innertext;
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ $replace = array('January', 'February', 'March', 'April', 'May', 'June', 'July',
|
||||||
public function getCacheDuration(){
|
public function getCacheDuration(){
|
||||||
return 7200; // 2h hours
|
return 7200; // 2h hours
|
||||||
}
|
}
|
||||||
|
|
||||||
private function correctCase($str) {
|
private function correctCase($str) {
|
||||||
$sentences=explode('.', mb_strtolower($str, "UTF-8"));
|
$sentences=explode('.', mb_strtolower($str, "UTF-8"));
|
||||||
$str="";
|
$str="";
|
||||||
|
@ -73,7 +73,7 @@ $replace = array('January', 'February', 'March', 'April', 'May', 'June', 'July',
|
||||||
{
|
{
|
||||||
//upper case first char
|
//upper case first char
|
||||||
$sentence=ucfirst(trim($sentence));
|
$sentence=ucfirst(trim($sentence));
|
||||||
|
|
||||||
//append sentence to output
|
//append sentence to output
|
||||||
$str=$str.$sep.$sentence;
|
$str=$str.$sep.$sentence;
|
||||||
$sep=". ";
|
$sep=". ";
|
||||||
|
|
|
@ -11,7 +11,7 @@ class ShanaprojectBridge extends BridgeAbstract {
|
||||||
// Returns an html object for the Season Anime List (latest season)
|
// Returns an html object for the Season Anime List (latest season)
|
||||||
private function LoadSeasonAnimeList(){
|
private function LoadSeasonAnimeList(){
|
||||||
// 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->getSimpleHTMLDOM($this->getURI() . '/seasons');
|
||||||
if(!$html)
|
if(!$html)
|
||||||
$this->returnServerError('Could not load \'seasons\' page!');
|
$this->returnServerError('Could not load \'seasons\' page!');
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ class ShanaprojectBridge extends BridgeAbstract {
|
||||||
if(!$season)
|
if(!$season)
|
||||||
$this->returnServerError('Could not find \'Season Anime List\'!');
|
$this->returnServerError('Could not find \'Season Anime List\'!');
|
||||||
|
|
||||||
$html = $this->file_get_html($this->getURI() . $season->href);
|
$html = $this->getSimpleHTMLDOM($this->getURI() . $season->href);
|
||||||
if(!$html)
|
if(!$html)
|
||||||
$this->returnServerError('Could not load \'Season Anime List\' from \'' . $season->innertext . '\'!');
|
$this->returnServerError('Could not load \'Season Anime List\' from \'' . $season->innertext . '\'!');
|
||||||
|
|
||||||
|
|
|
@ -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->returnServerError('Could not request Silicon: '.$feedUrl);
|
$html = $this->getSimpleHTMLDOM($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->returnServerError('Could not request Silicon: '.$article_uri);
|
$article_html = $this->getSimpleHTMLDOM($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;
|
||||||
|
|
|
@ -16,7 +16,7 @@ class StripeAPIChangeLogBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$html = $this->file_get_html('https://stripe.com/docs/upgrades')
|
$html = $this->getSimpleHTMLDOM('https://stripe.com/docs/upgrades')
|
||||||
or $this->returnServerError('No results for Stripe API Changelog');
|
or $this->returnServerError('No results for Stripe API Changelog');
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,12 +47,12 @@ class SuperbWallpapersBridge extends BridgeAbstract {
|
||||||
|
|
||||||
// Get last page number
|
// Get last page number
|
||||||
$link = $baseUri.'/'.$this->category.'/9999.html';
|
$link = $baseUri.'/'.$this->category.'/9999.html';
|
||||||
$html = $this->file_get_html($link);
|
$html = $this->getSimpleHTMLDOM($link);
|
||||||
$lastpage = min($html->find('.paging .cpage', 0)->innertext(), ceil($max/36));
|
$lastpage = min($html->find('.paging .cpage', 0)->innertext(), ceil($max/36));
|
||||||
|
|
||||||
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->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM($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);
|
||||||
|
|
|
@ -36,7 +36,7 @@ class T411Bridge extends BridgeAbstract {
|
||||||
|
|
||||||
//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->returnServerError('Could not request t411: '.$url);
|
$html = $this->getSimpleHTMLDOM($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->returnServerError('No results from t411: '.$url);
|
$this->returnServerError('No results from t411: '.$url);
|
||||||
|
@ -57,7 +57,7 @@ class T411Bridge extends BridgeAbstract {
|
||||||
$item_date = strtotime($element->find('dd', 0)->plaintext);
|
$item_date = strtotime($element->find('dd', 0)->plaintext);
|
||||||
|
|
||||||
//Retrieve full description from torrent page
|
//Retrieve full description from torrent page
|
||||||
if ($item_html = $this->file_get_html($item_uri)) {
|
if ($item_html = $this->getSimpleHTMLDOM($item_uri)) {
|
||||||
|
|
||||||
//Retrieve data from page contents
|
//Retrieve data from page contents
|
||||||
$item_desc = $item_html->find('div.description', 0);
|
$item_desc = $item_html->find('div.description', 0);
|
||||||
|
|
|
@ -23,8 +23,8 @@ class TagBoardBridge extends BridgeAbstract{
|
||||||
$html = '';
|
$html = '';
|
||||||
$this->request = $param['u'];
|
$this->request = $param['u'];
|
||||||
$link = 'https://post-cache.tagboard.com/search/' .$this->request;
|
$link = 'https://post-cache.tagboard.com/search/' .$this->request;
|
||||||
|
|
||||||
$html = $this->file_get_html($link) or $this->returnServerError('Could not request TagBoard for : ' . $link);
|
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request TagBoard for : ' . $link);
|
||||||
$parsed_json = json_decode($html);
|
$parsed_json = json_decode($html);
|
||||||
|
|
||||||
foreach($parsed_json->{'posts'} as $element) {
|
foreach($parsed_json->{'posts'} as $element) {
|
||||||
|
@ -49,4 +49,4 @@ class TagBoardBridge extends BridgeAbstract{
|
||||||
return 21600; // 6 hours
|
return 21600; // 6 hours
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,27 +25,27 @@ class TbibBridge extends BridgeAbstract{
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
$page = 0;$tags='';
|
$page = 0;$tags='';
|
||||||
if (isset($param['p'])) {
|
if (isset($param['p'])) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
||||||
$page = $page - 1;
|
$page = $page - 1;
|
||||||
$page = $page * 50;
|
$page = $page * 50;
|
||||||
}
|
}
|
||||||
if (isset($param['t'])) {
|
if (isset($param['t'])) {
|
||||||
$tags = urlencode($param['t']);
|
$tags = urlencode($param['t']);
|
||||||
}
|
}
|
||||||
$html = $this->file_get_html("http://tbib.org/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Tbib.');
|
$html = $this->getSimpleHTMLDOM("http://tbib.org/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Tbib.');
|
||||||
|
|
||||||
|
|
||||||
foreach($html->find('div[class=content] span') as $element) {
|
foreach($html->find('div[class=content] span') as $element) {
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
$item->uri = 'http://tbib.org/'.$element->find('a', 0)->href;
|
$item->uri = 'http://tbib.org/'.$element->find('a', 0)->href;
|
||||||
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
|
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
|
||||||
$item->timestamp = time();
|
$item->timestamp = time();
|
||||||
$thumbnailUri = $element->find('img', 0)->src;
|
$thumbnailUri = $element->find('img', 0)->src;
|
||||||
$item->tags = $element->find('img', 0)->getAttribute('alt');
|
$item->tags = $element->find('img', 0)->getAttribute('alt');
|
||||||
$item->title = 'Tbib | '.$item->postid;
|
$item->title = 'Tbib | '.$item->postid;
|
||||||
$item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item->tags;
|
$item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item->tags;
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue