1
0
Fork 0
forked from blallo/rss-bridge

[bridges] Change all occurrences of the Item object to array

This commit is contained in:
logmanoriginal 2016-08-22 18:55:59 +02:00
parent 1f3361c6b4
commit bf0a9d754e
130 changed files with 844 additions and 844 deletions

View file

@ -19,12 +19,12 @@ class ABCTabsBridge extends BridgeAbstract{
foreach ($table->find('tr') as $tab) foreach ($table->find('tr') as $tab)
{ {
$item = new \Item(); $item = array();
$item->author = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext; $item['author'] = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext;
$item->title = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext; $item['title'] = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext;
$item->content = 'Le ' . $tab->find('td', 0)->plaintext . '<br> Par: ' . $tab->find('td', 5)->plaintext . '<br> Type: ' . $tab->find('td', 3)->plaintext; $item['content'] = 'Le ' . $tab->find('td', 0)->plaintext . '<br> Par: ' . $tab->find('td', 5)->plaintext . '<br> Type: ' . $tab->find('td', 3)->plaintext;
$item->id = 'http://www.abc-tabs.com' . $tab->find('td', 2)->find('a', 0)->getAttribute('href'); $item['id'] = 'http://www.abc-tabs.com' . $tab->find('td', 2)->find('a', 0)->getAttribute('href');
$item->uri = 'http://www.abc-tabs.com' . $tab->find('td', 2)->find('a', 0)->getAttribute('href'); $item['uri'] = 'http://www.abc-tabs.com' . $tab->find('td', 2)->find('a', 0)->getAttribute('href');
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -23,16 +23,16 @@ class AcrimedBridge extends RssExpander{
$namespaces = $newsItem->getNameSpaces(true); $namespaces = $newsItem->getNameSpaces(true);
$dc = $newsItem->children($namespaces['dc']); $dc = $newsItem->children($namespaces['dc']);
$item = new Item(); $item = array();
$item->uri = trim($newsItem->link); $item['uri'] = trim($newsItem->link);
$item->title = trim($newsItem->title); $item['title'] = trim($newsItem->title);
$item->timestamp = strtotime($dc->date); $item['timestamp'] = strtotime($dc->date);
$articlePage = $this->getSimpleHTMLDOM($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/");
$item->content = $article; $item['content'] = $article;
return $item; return $item;

View file

@ -55,7 +55,7 @@ class AllocineFRBridge extends BridgeAbstract{
foreach($html->find('figure.media-meta-fig') as $element) foreach($html->find('figure.media-meta-fig') as $element)
{ {
$item = new Item(); $item = array();
$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);
@ -67,9 +67,9 @@ class AllocineFRBridge extends BridgeAbstract{
$content = str_replace('href="/', 'href="http://www.allocine.fr/', $content); $content = str_replace('href="/', 'href="http://www.allocine.fr/', $content);
$content = str_replace('src=\'/', 'src=\'http://www.allocine.fr/', $content); $content = str_replace('src=\'/', 'src=\'http://www.allocine.fr/', $content);
$content = str_replace('href=\'/', 'href=\'http://www.allocine.fr/', $content); $content = str_replace('href=\'/', 'href=\'http://www.allocine.fr/', $content);
$item->content = $content; $item['content'] = $content;
$item->title = trim($title->innertext); $item['title'] = trim($title->innertext);
$item->uri = "http://www.allocine.fr" . $title->href; $item['uri'] = "http://www.allocine.fr" . $title->href;
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -83,12 +83,12 @@ class AnimeUltimeBridge extends BridgeAbstract {
$item_description = utf8_encode($item_description); $item_description = utf8_encode($item_description);
//Build and add final item //Build and add final item
$item = new \Item(); $item = array();
$item->uri = $item_uri; $item['uri'] = $item_uri;
$item->title = $item_name.' '.$item_type.' '.$item_episode; $item['title'] = $item_name.' '.$item_type.' '.$item_episode;
$item->author = $item_fansub; $item['author'] = $item_fansub;
$item->timestamp = $item_date; $item['timestamp'] = $item_date;
$item->content = $item_description; $item['content'] = $item_description;
$this->items[] = $item; $this->items[] = $item;
$processedOK++; $processedOK++;

View file

@ -49,13 +49,13 @@ class ArstechnicaBridge extends BridgeAbstract {
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {
if($limit < 5) { if($limit < 5) {
$item = new \Item(); $item = array();
$item->title = $this->StripCDATA($element->find('title', 0)->innertext); $item['title'] = $this->StripCDATA($element->find('title', 0)->innertext);
$item->uri = $this->StripCDATA($element->find('guid', 0)->plaintext); $item['uri'] = $this->StripCDATA($element->find('guid', 0)->plaintext);
$item->author = $this->StripCDATA($element->find('author', 0)->innertext); $item['author'] = $this->StripCDATA($element->find('author', 0)->innertext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = $this->ExtractContent($item->uri); $item['content'] = $this->ExtractContent($item['uri']);
//$item->content = $item->uri; //$item['content'] = $item['uri'];
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }

View file

@ -76,18 +76,18 @@ class Arte7Bridge extends BridgeAbstract{
$input_json = extractVideoset($category, $lang); $input_json = extractVideoset($category, $lang);
foreach($input_json['videos'] as $element) { foreach($input_json['videos'] as $element) {
$item = new \Item(); $item = array();
$item->uri = str_replace("autoplay=1", "", $element['url']); $item['uri'] = str_replace("autoplay=1", "", $element['url']);
$item->id = $element['id']; $item['id'] = $element['id'];
$hack_broadcast_time = $element['rights_end']; $hack_broadcast_time = $element['rights_end'];
$hack_broadcast_time = strtok($hack_broadcast_time, 'T'); $hack_broadcast_time = strtok($hack_broadcast_time, 'T');
$hack_broadcast_time = strtok('T'); $hack_broadcast_time = strtok('T');
$item->timestamp = strtotime($element['scheduled_on'].'T'.$hack_broadcast_time); $item['timestamp'] = strtotime($element['scheduled_on'].'T'.$hack_broadcast_time);
$item->title = $element['title']; $item['title'] = $element['title'];
if (!empty($element['subtitle'])) if (!empty($element['subtitle']))
$item->title = $element['title'].' | '.$element['subtitle']; $item['title'] = $element['title'].' | '.$element['subtitle'];
$item->duration = round((int)$element['duration']/60); $item['duration'] = round((int)$element['duration']/60);
$item->content = $element['teaser'].'<br><br>'.$item->duration.'min<br><a href="'.$item->uri.'"><img src="' . $element['thumbnail_url'] . '" /></a>'; $item['content'] = $element['teaser'].'<br><br>'.$item['duration'].'min<br><a href="'.$item['uri'].'"><img src="' . $element['thumbnail_url'] . '" /></a>';
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -26,12 +26,12 @@ class AskfmBridge extends BridgeAbstract{
} }
foreach($html->find('div.streamItem-answer') as $element) { foreach($html->find('div.streamItem-answer') as $element) {
$item = new \Item(); $item = array();
$item->uri = 'http://ask.fm'.$element->find('a.streamItemsAge',0)->href; $item['uri'] = 'http://ask.fm'.$element->find('a.streamItemsAge',0)->href;
$question = trim($element->find('h1.streamItemContent-question',0)->innertext); $question = trim($element->find('h1.streamItemContent-question',0)->innertext);
$item->title = trim(htmlspecialchars_decode($element->find('h1.streamItemContent-question',0)->plaintext, ENT_QUOTES)); $item['title'] = trim(htmlspecialchars_decode($element->find('h1.streamItemContent-question',0)->plaintext, ENT_QUOTES));
$answer = trim($element->find('p.streamItemContent-answer',0)->innertext); $answer = trim($element->find('p.streamItemContent-answer',0)->innertext);
#$item->update = $element->find('a.streamitemsage',0)->data-hint; // Doesn't work, DOM parser doesn't seem to like data-hint, dunno why #$item['update'] = $element->find('a.streamitemsage',0)->data-hint; // Doesn't work, DOM parser doesn't seem to like data-hint, dunno why
$visual = $element->find('div.streamItemContent-visual',0)->innertext; // This probably should be cleaned up, especially for YouTube embeds $visual = $element->find('div.streamItemContent-visual',0)->innertext; // This probably should be cleaned up, especially for YouTube embeds
//Fix tracking links, also doesn't work //Fix tracking links, also doesn't work
foreach($element->find('a') as $link) { foreach($element->find('a') as $link) {
@ -43,7 +43,7 @@ class AskfmBridge extends BridgeAbstract{
$content = '<p>' . $question . '</p><p>' . $answer . '</p><p>' . $visual . '</p>'; $content = '<p>' . $question . '</p><p>' . $answer . '</p><p>' . $visual . '</p>';
// Fix relative links without breaking // scheme used by YouTube stuff // Fix relative links without breaking // scheme used by YouTube stuff
$content = preg_replace('#href="\/(?!\/)#', 'href="http://ask.fm/',$content); $content = preg_replace('#href="\/(?!\/)#', 'href="http://ask.fm/',$content);
$item->content = $content; $item['content'] = $content;
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -33,12 +33,12 @@ class BandcampBridge extends BridgeAbstract{
$uri = ltrim($script, "return 'url("); $uri = ltrim($script, "return 'url(");
$uri = rtrim($uri, "')"); $uri = rtrim($uri, "')");
$item = new \Item(); $item = array();
$item->author = $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext; $item['author'] = $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext;
$item->title = $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext; $item['title'] = $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext;
$item->content = '<img src="' . $uri . '"/><br/>' . $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext; $item['content'] = '<img src="' . $uri . '"/><br/>' . $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext;
$item->id = $release->find('a',0)->getAttribute('href'); $item['id'] = $release->find('a',0)->getAttribute('href');
$item->uri = $release->find('a',0)->getAttribute('href'); $item['uri'] = $release->find('a',0)->getAttribute('href');
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -18,11 +18,11 @@ class BastaBridge extends BridgeAbstract{
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {
if($limit < 10) { if($limit < 10) {
$item = new \Item(); $item = array();
$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->getSimpleHTMLDOM($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++;
} }

View file

@ -14,18 +14,18 @@ class BlaguesDeMerdeBridge extends BridgeAbstract{
$html = $this->getSimpleHTMLDOM('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 = array();
$temp = $element->find('a'); $temp = $element->find('a');
if(isset($temp[2])) if(isset($temp[2]))
{ {
$item->content = trim($element->find('div.joke_text_contener', 0)->innertext); $item['content'] = trim($element->find('div.joke_text_contener', 0)->innertext);
$uri = $temp[2]->href; $uri = $temp[2]->href;
$item->uri = $uri; $item['uri'] = $uri;
$item->title = substr($uri, (strrpos($uri, "/") + 1)); $item['title'] = substr($uri, (strrpos($uri, "/") + 1));
$date = $element->find("li.bdm_date",0)->innertext; $date = $element->find("li.bdm_date",0)->innertext;
$time = mktime(0, 0, 0, substr($date, 3, 2), substr($date, 0, 2), substr($date, 6, 4)); $time = mktime(0, 0, 0, substr($date, 3, 2), substr($date, 0, 2), substr($date, 6, 4));
$item->timestamp = $time; $item['timestamp'] = $time;
$item->author = $element->find("li.bdm_pseudo",0)->innertext;; $item['author'] = $element->find("li.bdm_pseudo",0)->innertext;;
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -36,13 +36,13 @@ class BooruprojectBridge extends BridgeAbstract{
foreach($html->find('div[class=content] span') as $element) { foreach($html->find('div[class=content] span') as $element) {
$item = new \Item(); $item = array();
$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;
} }
} }

View file

@ -48,12 +48,12 @@ class CADBridge extends BridgeAbstract{
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {
if($limit < 5) { if($limit < 5) {
$item = new \Item(); $item = array();
$item->title = $element->find('title', 0)->innertext; $item['title'] = $element->find('title', 0)->innertext;
$item->uri = CADUrl($element->find('description', 0)->innertext); $item['uri'] = CADUrl($element->find('description', 0)->innertext);
if ($item->uri != 'notanurl') { if ($item['uri'] != 'notanurl') {
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = $this->CADExtractContent($item->uri); $item['content'] = $this->CADExtractContent($item['uri']);
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }

View file

@ -63,12 +63,12 @@ class CNETBridge extends BridgeAbstract {
$article_content = trim(CleanArticle(ExtractFromDelimiters($article_html, '<div class="articleContent', '<footer>'))); $article_content = trim(CleanArticle(ExtractFromDelimiters($article_html, '<div class="articleContent', '<footer>')));
$item = new \Item(); $item = array();
$item->uri = $article_uri; $item['uri'] = $article_uri;
$item->title = $article_title; $item['title'] = $article_title;
$item->author = $article_author; $item['author'] = $article_author;
$item->timestamp = $article_timestamp; $item['timestamp'] = $article_timestamp;
$item->content = $article_content; $item['content'] = $article_content;
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }

View file

@ -91,19 +91,19 @@ class CastorusBridge extends BridgeAbstract {
$this->returnServerError('Failed to find activities!'); $this->returnServerError('Failed to find activities!');
foreach($activities as $activity){ foreach($activities as $activity){
$item = new \Item(); $item = array();
$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)){
continue; // Skip this item continue; // Skip this item
} }
if(isset($city_filter) && !(substr($item->title, strpos($item->title, ' ') + 1, strlen($city_filter)) === $city_filter)){ if(isset($city_filter) && !(substr($item['title'], strpos($item['title'], ' ') + 1, strlen($city_filter)) === $city_filter)){
continue; // Skip this item continue; // Skip this item
} }

View file

@ -34,8 +34,8 @@ class CollegeDeFranceBridge extends BridgeAbstract{
*/ */
$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.'); $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 = array();
$item->title = $element->find('.title', 0)->plaintext; $item['title'] = $element->find('.title', 0)->plaintext;
// Most relative URLs contains an hour in addition to the date, so let's use it // Most relative URLs contains an hour in addition to the date, so let's use it
// <a href="/site/yann-lecun/course-2016-04-08-11h00.htm" data-target="after"> // <a href="/site/yann-lecun/course-2016-04-08-11h00.htm" data-target="after">
// //
@ -46,9 +46,9 @@ class CollegeDeFranceBridge extends BridgeAbstract{
$timezone = new DateTimeZone('Europe/Paris'); $timezone = new DateTimeZone('Europe/Paris');
// strpos($element->href, '201') will break in 2020 but it'll probably break prior to then due to site changes anyway // strpos($element->href, '201') will break in 2020 but it'll probably break prior to then due to site changes anyway
$d = DateTime::createFromFormat('!Y-m-d-H\hi', substr($element->href, strpos($element->href, '201'), 16), $timezone) ?: DateTime::createFromFormat('!d m Y', trim(str_replace(array_values($months), array_keys($months), $element->find('.date', 0)->plaintext)), $timezone); $d = DateTime::createFromFormat('!Y-m-d-H\hi', substr($element->href, strpos($element->href, '201'), 16), $timezone) ?: DateTime::createFromFormat('!d m Y', trim(str_replace(array_values($months), array_keys($months), $element->find('.date', 0)->plaintext)), $timezone);
$item->timestamp = $d->format('U'); $item['timestamp'] = $d->format('U');
$item->content = $element->find('.lecturer', 0)->innertext . ' - ' . $element->find('.title', 0)->innertext; $item['content'] = $element->find('.lecturer', 0)->innertext . ' - ' . $element->find('.title', 0)->innertext;
$item->uri = 'http://www.college-de-france.fr' . $element->href; $item['uri'] = 'http://www.college-de-france.fr' . $element->href;
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -28,11 +28,11 @@ class CommonDreamsBridge extends BridgeAbstract{
$limit = 0; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {
if($limit < 4) { if($limit < 4) {
$item = new \Item(); $item = array();
$item->title = $element->find('title', 0)->innertext; $item['title'] = $element->find('title', 0)->innertext;
$item->uri = CommonDreamsUrl($element->find('guid', 0)->innertext); $item['uri'] = CommonDreamsUrl($element->find('guid', 0)->innertext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = $this->CommonDreamsExtractContent($item->uri); $item['content'] = $this->CommonDreamsExtractContent($item['uri']);
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }

View file

@ -21,21 +21,21 @@ class CopieDoubleBridge extends BridgeAbstract{
$cpt++; $cpt++;
if($td->class == "couleur_1") if($td->class == "couleur_1")
{ {
$item = new Item(); $item = array();
$title = $td->innertext; $title = $td->innertext;
$pos = strpos($title, "<a"); $pos = strpos($title, "<a");
$title = substr($title, 0, $pos); $title = substr($title, 0, $pos);
$item->title = $title; $item['title'] = $title;
} }
elseif(strpos($element->innertext, "/images/suivant.gif") === false) elseif(strpos($element->innertext, "/images/suivant.gif") === false)
{ {
$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;
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -24,24 +24,24 @@ class CourrierInternationalBridge extends BridgeAbstract{
foreach($element as $article) { foreach($element as $article) {
$item = new \Item(); $item = array();
$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->getSimpleHTMLDOM($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'],

View file

@ -53,20 +53,20 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
$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 = array();
$item->author = $episode->find('a', 0)->text(); $item['author'] = $episode->find('a', 0)->text();
$item->title = $episode->find('a', 0)->text(); $item['title'] = $episode->find('a', 0)->text();
$item->timestamp = $this->get_cached_time($episode->find('a', 0)->getAttribute('href')); $item['timestamp'] = $this->get_cached_time($episode->find('a', 0)->getAttribute('href'));
$textefiche=$htmlepisode->find('#textefiche', 0)->find('p',1); $textefiche=$htmlepisode->find('#textefiche', 0)->find('p',1);
if (isset($textefiche)) { if (isset($textefiche)) {
$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');
$item->uri = $this->uri . $htmlepisode->find('#telecharger',0)->getAttribute('href'); $item['uri'] = $this->uri . $htmlepisode->find('#telecharger',0)->getAttribute('href');
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -33,10 +33,10 @@ class CryptomeBridge extends BridgeAbstract{
foreach($html->find('pre') as $element) { foreach($html->find('pre') as $element) {
for ( $i = 0; $i < $num; ++$i ) { for ( $i = 0; $i < $num; ++$i ) {
$item = new \Item(); $item = array();
$item->uri = $link.substr($element->find('a', $i)->href, 20); $item['uri'] = $link.substr($element->find('a', $i)->href, 20);
$item->title = substr($element->find('b', $i)->plaintext, 22); $item['title'] = substr($element->find('b', $i)->plaintext, 22);
$item->content = preg_replace('#http://cryptome.org/#', $link, $element->find('b', $i)->innertext); $item['content'] = preg_replace('#http://cryptome.org/#', $link, $element->find('b', $i)->innertext);
$this->items[] = $item; $this->items[] = $item;
} }
break; break;

View file

@ -63,13 +63,13 @@ class DailymotionBridge extends BridgeAbstract{
foreach($html->find('div.media a.preview_link') as $element) { foreach($html->find('div.media a.preview_link') as $element) {
if($count < $limit) { if($count < $limit) {
$item = new \Item(); $item = array();
$item->id = str_replace('/video/', '', strtok($element->href, '_')); $item['id'] = str_replace('/video/', '', strtok($element->href, '_'));
$metadata = $this->getMetadata($item->id); $metadata = $this->getMetadata($item['id']);
$item->uri = $metadata['uri']; $item['uri'] = $metadata['uri'];
$item->title = $metadata['title']; $item['title'] = $metadata['title'];
$item->timestamp = $metadata['timestamp']; $item['timestamp'] = $metadata['timestamp'];
$item->content = '<a href="' . $item->uri . '"><img src="' . $metadata['thumbnailUri'] . '" /></a><br><a href="' . $item->uri . '">' . $item->title . '</a>'; $item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $metadata['thumbnailUri'] . '" /></a><br><a href="' . $item['uri'] . '">' . $item['title'] . '</a>';
$this->items[] = $item; $this->items[] = $item;
$count++; $count++;
} }

View file

@ -24,14 +24,14 @@ class DanbooruBridge extends BridgeAbstract{
} }
$html = $this->getSimpleHTMLDOM("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 = array();
$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;
} }
} }

View file

@ -17,10 +17,10 @@ class DansTonChatBridge extends BridgeAbstract{
$html = $this->getSimpleHTMLDOM($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 = array();
$item->uri = $element->find('a', 0)->href; $item['uri'] = $element->find('a', 0)->href;
$item->title = 'DansTonChat '.$element->find('a', 1)->plaintext; $item['title'] = 'DansTonChat '.$element->find('a', 1)->plaintext;
$item->content = $element->find('a', 0)->innertext; $item['content'] = $element->find('a', 0)->innertext;
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -63,11 +63,11 @@ class DauphineLibereBridge extends BridgeAbstract {
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {
if($limit < 10) { if($limit < 10) {
$item = new \Item(); $item = array();
$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('pubDate', 0)->plaintext); $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = $this->ExtractContent($item->uri, $context); $item['content'] = $this->ExtractContent($item['uri'], $context);
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }

View file

@ -37,12 +37,12 @@ class DemoBridge extends BridgeAbstract{
public function collectData(array $param){ public function collectData(array $param){
$item = new \Item(); $item = array();
$item->author = "Me!"; $item['author'] = "Me!";
$item->title = "Test"; $item['title'] = "Test";
$item->content = "Awesome content !"; $item['content'] = "Awesome content !";
$item->id = "Lalala"; $item['id'] = "Lalala";
$item->uri = "http://test.test/test"; $item['uri'] = "http://test.test/test";
$this->items[] = $item; $this->items[] = $item;

View file

@ -46,12 +46,12 @@ class DeveloppezDotComBridge extends BridgeAbstract{
foreach($rssFeed->find('item') as $element) { foreach($rssFeed->find('item') as $element) {
if($limit < 10) { if($limit < 10) {
$item = new \Item(); $item = array();
$item->title = $this->DeveloppezDotComStripCDATA($element->find('title', 0)->innertext); $item['title'] = $this->DeveloppezDotComStripCDATA($element->find('title', 0)->innertext);
$item->uri = $this->DeveloppezDotComStripCDATA($element->find('guid', 0)->plaintext); $item['uri'] = $this->DeveloppezDotComStripCDATA($element->find('guid', 0)->plaintext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext);
$content = $this->DeveloppezDotComExtractContent($item->uri); $content = $this->DeveloppezDotComExtractContent($item['uri']);
$item->content = strlen($content) ? $content : $element->description; //In case of it is a tutorial, we just keep the original description $item['content'] = strlen($content) ? $content : $element->description; //In case of it is a tutorial, we just keep the original description
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }

View file

@ -26,12 +26,12 @@ class DilbertBridge extends BridgeAbstract {
$title = 'Dilbert Comic Strip on '.$date; $title = 'Dilbert Comic Strip on '.$date;
$date = strtotime($date); $date = strtotime($date);
$item = new \Item(); $item = array();
$item->uri = $url; $item['uri'] = $url;
$item->title = $title; $item['title'] = $title;
$item->author = 'Scott Adams'; $item['author'] = 'Scott Adams';
$item->timestamp = $date; $item['timestamp'] = $date;
$item->content = '<img src="'.$comic.'" alt="'.$img->alt.'" />'; $item['content'] = '<img src="'.$comic.'" alt="'.$img->alt.'" />';
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -30,14 +30,14 @@ class DollbooruBridge extends BridgeAbstract{
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 = array();
$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;
} }
} }

View file

@ -22,10 +22,10 @@ class DuckDuckGoBridge extends BridgeAbstract{
$html = $this->getSimpleHTMLDOM($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 = array();
$item->uri = $element->find('a', 0)->href; $item['uri'] = $element->find('a', 0)->href;
$item->title = $element->find('a', 1)->innertext; $item['title'] = $element->find('a', 1)->innertext;
$item->content = $element->find('div.snippet', 0)->plaintext; $item['content'] = $element->find('div.snippet', 0)->plaintext;
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -58,13 +58,13 @@ class EZTVBridge extends BridgeAbstract{
if ($released->plaintext == '&gt;1 week') continue; if ($released->plaintext == '&gt;1 week') continue;
// Fill item // Fill item
$item = new \Item(); $item = array();
$item->uri = 'https://eztv.ch/'.$epinfo->href; $item['uri'] = 'https://eztv.ch/'.$epinfo->href;
$item->id = $item->uri; $item['id'] = $item['uri'];
$item->timestamp = makeTimestamp($released->plaintext); $item['timestamp'] = makeTimestamp($released->plaintext);
$item->title = $epinfo->plaintext; $item['title'] = $epinfo->plaintext;
$item->content = $epinfo->alt; $item['content'] = $epinfo->alt;
if(!empty($item->title)) if(isset($item['title']))
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -14,22 +14,22 @@ class EliteDangerousGalnetBridge extends BridgeAbstract
{ {
$html = $this->getSimpleHTMLDOM('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 = array();
$uri = $element->find('h3 a', 0)->href; $uri = $element->find('h3 a', 0)->href;
$uri = 'https://community.elitedangerous.com' . $uri; $uri = 'https://community.elitedangerous.com' . $uri;
$item->uri = $uri; $item['uri'] = $uri;
$title = $element->find('h3 a', 0)->plaintext; $title = $element->find('h3 a', 0)->plaintext;
$item->title = substr($title, 1); //remove the space between icon and title $item['title'] = substr($title, 1); //remove the space between icon and title
$content = $element->find('p', -1)->innertext; $content = $element->find('p', -1)->innertext;
$item->content = $content; $item['content'] = $content;
$date = $element->find('p.small', 0)->innertext; $date = $element->find('p.small', 0)->innertext;
$article_year = substr($date, -4) - 1286; //Convert E:D date to actual date $article_year = substr($date, -4) - 1286; //Convert E:D date to actual date
$date = substr($date, 0, -4) . $article_year; $date = substr($date, 0, -4) . $article_year;
$item->timestamp = strtotime($date); $item['timestamp'] = strtotime($date);
$this->items[] = $item; $this->items[] = $item;
} }

View file

@ -63,12 +63,12 @@ class ElsevierBridge extends BridgeAbstract{
$html = $this->getSimpleHTMLDOM($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 = array();
$item->uri = $article->find('.pod-listing-header>a',0)->getAttribute('href').'?np=y'; $item['uri'] = $article->find('.pod-listing-header>a',0)->getAttribute('href').'?np=y';
$item->title = $article->find('.pod-listing-header>a',0)->plaintext; $item['title'] = $article->find('.pod-listing-header>a',0)->plaintext;
$item->author = $this->ExtractArticleName($article); $item['author'] = $this->ExtractArticleName($article);
$item->timestamp = $this->ExtractArticleTimestamp($article); $item['timestamp'] = $this->ExtractArticleTimestamp($article);
$item->content = $this->ExtractArticleContent($article); $item['content'] = $this->ExtractArticleContent($article);
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -19,12 +19,12 @@ class EstCeQuonMetEnProdBridge extends BridgeAbstract {
$html = $this->getSimpleHTMLDOM($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 = array();
$item->uri = $this->getURI().'#'.date('Y-m-d'); $item['uri'] = $this->getURI().'#'.date('Y-m-d');
$item->title = $this->getName(); $item['title'] = $this->getName();
$item->author = 'Nicolas Hoffmann'; $item['author'] = 'Nicolas Hoffmann';
$item->timestamp = strtotime('today midnight'); $item['timestamp'] = strtotime('today midnight');
$item->content = str_replace('src="/', 'src="'.$this->getURI(), trim(ExtractFromDelimiters($html->outertext, '<body role="document">', '<br /><br />'))); $item['content'] = str_replace('src="/', 'src="'.$this->getURI(), trim(ExtractFromDelimiters($html->outertext, '<body role="document">', '<br /><br />')));
$this->items[] = $item; $this->items[] = $item;
} }

View file

@ -153,7 +153,7 @@ class FacebookBridge extends BridgeAbstract{
foreach($element->children() as $post) { foreach($element->children() as $post) {
$item = new \Item(); $item = array();
if (count($post->find('abbr')) > 0) { if (count($post->find('abbr')) > 0) {
@ -195,11 +195,11 @@ class FacebookBridge extends BridgeAbstract{
$title = substr($title, 0, strpos(wordwrap($title, 64), "\n")).'...'; $title = substr($title, 0, strpos(wordwrap($title, 64), "\n")).'...';
//Build and add final item //Build and add final item
$item->uri = 'https://facebook.com'.$post->find('abbr')[0]->parent()->getAttribute('href'); $item['uri'] = 'https://facebook.com'.$post->find('abbr')[0]->parent()->getAttribute('href');
$item->content = $content; $item['content'] = $content;
$item->title = $title; $item['title'] = $title;
$item->author = $author; $item['author'] = $author;
$item->timestamp = $date; $item['timestamp'] = $date;
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -16,12 +16,12 @@ Class FierPandaBridge extends BridgeAbstract{
$html = $this->getSimpleHTMLDOM($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 = array();
$item->uri = $this->getURI().$element->find('a', 0)->href; $item['uri'] = $this->getURI().$element->find('a', 0)->href;
$item->title = trim($element->find('h2 a', 0)->innertext); $item['title'] = trim($element->find('h2 a', 0)->innertext);
// Remove the link at the end of the article // Remove the link at the end of the article
$element->find('p a', 0)->outertext = ''; $element->find('p a', 0)->outertext = '';
$item->content = $element->find('p', 0)->innertext; $item['content'] = $element->find('p', 0)->innertext;
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -27,10 +27,10 @@ class FlickrExploreBridge extends BridgeAbstract{
// Get the image JSON via Flickr API // Get the image JSON via Flickr API
$imageJSON = json_decode(file_get_contents('https://api.flickr.com/services/rest/?method=flickr.photos.getInfo&api_key=103b574d49bd51f0e18bfe907da44a0f&photo_id='.$imageID.'&format=json&nojsoncallback=1')) or $this->returnServerError('Could not request Flickr.'); // FIXME: Request time too long... $imageJSON = json_decode(file_get_contents('https://api.flickr.com/services/rest/?method=flickr.photos.getInfo&api_key=103b574d49bd51f0e18bfe907da44a0f&photo_id='.$imageID.'&format=json&nojsoncallback=1')) or $this->returnServerError('Could not request Flickr.'); // FIXME: Request time too long...
$item = new \Item(); $item = array();
$item->uri = 'https://flickr.com/photo.gne?id='.$imageID; $item['uri'] = 'https://flickr.com/photo.gne?id='.$imageID;
$item->content = '<a href="' . $item->uri . '"><img src="' . $imageURI . '" /></a>'; // FIXME: Filter javascript ? $item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $imageURI . '" /></a>'; // FIXME: Filter javascript ?
$item->title = $imageJSON->photo->title->_content; $item['title'] = $imageJSON->photo->title->_content;
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -33,11 +33,11 @@ class FlickrTagBridge extends BridgeAbstract{
} }
foreach($html->find('span.photo_container') as $element) { foreach($html->find('span.photo_container') as $element) {
$item = new \Item(); $item = array();
$item->uri = 'http://flickr.com'.$element->find('a',0)->href; $item['uri'] = 'http://flickr.com'.$element->find('a',0)->href;
$thumbnailUri = $element->find('img',0)->getAttribute('data-defer-src'); $thumbnailUri = $element->find('img',0)->getAttribute('data-defer-src');
$item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a>'; // FIXME: Filter javascript ? $item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $thumbnailUri . '" /></a>'; // FIXME: Filter javascript ?
$item->title = $element->find('a',0)->title; $item['title'] = $element->find('a',0)->title;
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -14,7 +14,7 @@ class FootitoBridge extends BridgeAbstract{
$html = $this->getSimpleHTMLDOM('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 = array();
$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 );
@ -27,15 +27,15 @@ class FootitoBridge extends BridgeAbstract{
$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;
} }

View file

@ -30,26 +30,26 @@ class FourchanBridge extends BridgeAbstract{
$html = $this->getSimpleHTMLDOM($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 = array();
$item->id = $element->find('.post', 0)->getAttribute('id'); $item['id'] = $element->find('.post', 0)->getAttribute('id');
$item->uri = $url.'#'.$item->id; $item['uri'] = $url.'#'.$item['id'];
$item->timestamp = $element->find('span.dateTime', 0)->getAttribute('data-utc'); $item['timestamp'] = $element->find('span.dateTime', 0)->getAttribute('data-utc');
$item->author = $element->find('span.name', 0)->plaintext; $item['author'] = $element->find('span.name', 0)->plaintext;
if(!empty($element->find('.file', 0) ) ) { if(!empty($element->find('.file', 0) ) ) {
$item->image = $element->find('.file a', 0)->href; $item['image'] = $element->find('.file a', 0)->href;
$item->imageThumb = $element->find('.file img', 0)->src; $item['imageThumb'] = $element->find('.file img', 0)->src;
if(empty($item->imageThumb) and strpos($item->image, '.swf') !== FALSE) if(!isset($item['imageThumb']) and strpos($item['image'], '.swf') !== FALSE)
$item->imageThumb = 'http://i.imgur.com/eO0cxf9.jpg'; $item['imageThumb'] = 'http://i.imgur.com/eO0cxf9.jpg';
} }
if(!empty($element->find('span.subject', 0)->innertext )) { if(!empty($element->find('span.subject', 0)->innertext )) {
$item->subject = $element->find('span.subject', 0)->innertext; $item['subject'] = $element->find('span.subject', 0)->innertext;
} }
$item->title = (!empty($item->subject) ? $item->subject.' - ' : '' ) . 'reply '.$item->id.' | '.$item->author; $item['title'] = (isset($item['subject']) ? $item['subject'].' - ' : '' ) . 'reply '.$item['id'].' | '.$item['author'];
$item->content = (!empty($item->image) ? '<a href="'.$item->image.'"><img alt="'.$item->id.'" src="'.$item->imageThumb.'" /></a><br>' : '') . '<span id="'.$item->id.'">'.$element->find('.postMessage', 0)->innertext.'</span>'; $item['content'] = (isset($item['image']) ? '<a href="'.$item['image'].'"><img alt="'.$item['id'].'" src="'.$item['imageThumb'].'" /></a><br>' : '') . '<span id="'.$item['id'].'">'.$element->find('.postMessage', 0)->innertext.'</span>';
$this->items[] = $item; $this->items[] = $item;
} }
$this->items = array_reverse($this->items); $this->items = array_reverse($this->items);

View file

@ -19,23 +19,23 @@ class Freenews extends RssExpander {
} }
protected function parseRSSItem($newsItem) { protected function parseRSSItem($newsItem) {
$item = new Item(); $item = array();
$item->title = trim($newsItem->title); $item['title'] = trim($newsItem->title);
// $this->message("item has for title \"".$item->title."\""); // $this->message("item has for title \"".$item['title']."\"");
if(empty($newsItem->guid)) { if(empty($newsItem->guid)) {
$item->uri = (string) $newsItem->link; $item['uri'] = (string) $newsItem->link;
} else { } else {
$item->uri = (string) $newsItem->guid; $item['uri'] = (string) $newsItem->guid;
} }
// now load that uri from cache // now load that uri from cache
// $this->message("now loading page ".$item->uri); // $this->message("now loading page ".$item['uri']);
$articlePage = str_get_html($this->get_cached($item->uri)); $articlePage = str_get_html($this->get_cached($item['uri']));
$content = $articlePage->find('.post-container', 0); $content = $articlePage->find('.post-container', 0);
$item->content = $content->innertext; $item['content'] = $content->innertext;
$item->author = $articlePage->find('a[rel=author]', 0)->innertext; $item['author'] = $articlePage->find('a[rel=author]', 0)->innertext;
// format should parse 2014-03-25T16:21:20Z. But, according to http://stackoverflow.com/a/10478469, it is not that simple // format should parse 2014-03-25T16:21:20Z. But, according to http://stackoverflow.com/a/10478469, it is not that simple
$item->timestamp = $this->RSS_2_0_time_to_timestamp($newsItem); $item['timestamp'] = $this->RSS_2_0_time_to_timestamp($newsItem);
return $item; return $item;
} }
} }

View file

@ -177,12 +177,12 @@ class FuturaSciencesBridge extends BridgeAbstract {
$contents = StripWithDelimiters($contents, 'fs:xt:clicktype="', '"'); $contents = StripWithDelimiters($contents, 'fs:xt:clicktype="', '"');
$contents = StripWithDelimiters($contents, 'fs:xt:clickname="', '"'); $contents = StripWithDelimiters($contents, 'fs:xt:clickname="', '"');
$item = new \Item(); $item = array();
$item->author = ExtractAuthor($article, $element); $item['author'] = ExtractAuthor($article, $element);
$item->uri = $article_url; $item['uri'] = $article_url;
$item->title = StripCDATA($element->find('title', 0)->innertext); $item['title'] = StripCDATA($element->find('title', 0)->innertext);
$item->timestamp = strtotime(StripCDATA($element->find('pubDate', 0)->plaintext)); $item['timestamp'] = strtotime(StripCDATA($element->find('pubDate', 0)->plaintext));
$item->content = trim($contents); $item['content'] = trim($contents);
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }

View file

@ -41,12 +41,12 @@ class GBAtempBridge extends BridgeAbstract {
} }
private function build_item($uri, $title, $author, $timestamp, $content) { private function build_item($uri, $title, $author, $timestamp, $content) {
$item = new \Item(); $item = array();
$item->uri = $uri; $item['uri'] = $uri;
$item->title = $title; $item['title'] = $title;
$item->author = $author; $item['author'] = $author;
$item->timestamp = $timestamp; $item['timestamp'] = $timestamp;
$item->content = $content; $item['content'] = $content;
return $item; return $item;
} }

View file

@ -33,35 +33,35 @@ class Gawker extends RssExpander{
} }
protected function parseRSSItem($newsItem) { protected function parseRSSItem($newsItem) {
$item = new Item(); $item = array();
$item->uri = trim($newsItem->link); $item['uri'] = trim($newsItem->link);
$item->title = trim($newsItem->title); $item['title'] = trim($newsItem->title);
$item->timestamp = $this->RSS_2_0_time_to_timestamp($newsItem); $item['timestamp'] = $this->RSS_2_0_time_to_timestamp($newsItem);
// $this->message("///////////////////////////////////////////////////////////////////////////////////////\nprocessing item ".var_export($item, true)."\n\n\nbuilt from\n\n\n".var_export($newsItem, true)); // $this->message("///////////////////////////////////////////////////////////////////////////////////////\nprocessing item ".var_export($item, true)."\n\n\nbuilt from\n\n\n".var_export($newsItem, true));
try { try {
// now load that uri from cache // now load that uri from cache
// $this->message("loading page ".$item->uri); // $this->message("loading page ".$item['uri']);
$articlePage = str_get_html($this->get_cached($item->uri)); $articlePage = str_get_html($this->get_cached($item['uri']));
if(is_object($articlePage)) { if(is_object($articlePage)) {
$content = $articlePage->find('.post-content', 0); $content = $articlePage->find('.post-content', 0);
HTMLSanitizer::defaultImageSrcTo($content, $this->getURI()); HTMLSanitizer::defaultImageSrcTo($content, $this->getURI());
$vcard = $articlePage->find('.vcard', 0); $vcard = $articlePage->find('.vcard', 0);
if(is_object($vcard)) { if(is_object($vcard)) {
$authorLink = $vcard->find('a', 0); $authorLink = $vcard->find('a', 0);
$item->author = $authorLink->innertext; $item['author'] = $authorLink->innertext;
// TODO use author link href to fill the feed info // TODO use author link href to fill the feed info
} }
// $this->message("item quite loaded : ".var_export($item, true)); // $this->message("item quite loaded : ".var_export($item, true));
// I set item content as last element, for easier var_export reading // I set item content as last element, for easier var_export reading
$item->content = $content->innertext; $item['content'] = $content->innertext;
} else { } else {
throw new Exception("cache content for ".$item->uri." is NOT a Simple DOM parser object !"); throw new Exception("cache content for ".$item['uri']." is NOT a Simple DOM parser object !");
} }
} catch(Exception $e) { } catch(Exception $e) {
$this->message("obtaining ".$item->uri." resulted in exception ".$e->getMessage().". Deleting cached page ..."); $this->message("obtaining ".$item['uri']." resulted in exception ".$e->getMessage().". Deleting cached page ...");
// maybe file is incorrect. it should be discarded from cache // maybe file is incorrect. it should be discarded from cache
$this->remove_from_cache($item->url); $this->remove_from_cache($item['url']);
$item->content = $e->getMessage(); $item['content'] = $e->getMessage();
} }
return $item; return $item;
} }

View file

@ -32,14 +32,14 @@ class GelbooruBridge extends BridgeAbstract{
foreach($html->find('div[class=content] span') as $element) { foreach($html->find('div[class=content] span') as $element) {
$item = new \Item(); $item = array();
$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;
} }
} }

View file

@ -49,10 +49,10 @@ class GiphyBridge extends BridgeAbstract{
$img = $figure->firstChild(); $img = $figure->firstChild();
$caption = $figure->lastChild(); $caption = $figure->lastChild();
$item = new \Item(); $item = array();
$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);
$title = str_replace('animated GIF', '', $title); $title = str_replace('animated GIF', '', $title);
@ -60,11 +60,11 @@ class GiphyBridge extends BridgeAbstract{
$title = preg_replace('/\s+/', ' ',$title); $title = preg_replace('/\s+/', ' ',$title);
$title = trim($title); $title = trim($title);
if (strlen($title) <= 0) { if (strlen($title) <= 0) {
$title = $item->id; $title = $item['id'];
} }
$item->title = trim($title); $item['title'] = trim($title);
$item->content = $item['content'] =
'<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>';

View file

@ -37,15 +37,15 @@ class GithubIssueBridge extends BridgeAbstract{
foreach($html->find('.js-comment-container') as $comment){ foreach($html->find('.js-comment-container') as $comment){
$item = new \Item(); $item = array();
$item->author=$comment->find('img',0)->getAttribute('alt'); $item['author']=$comment->find('img',0)->getAttribute('alt');
$comment=$comment->firstChild()->nextSibling(); $comment=$comment->firstChild()->nextSibling();
$item->uri=$uri.'#'.$comment->getAttribute('id'); $item['uri']=$uri.'#'.$comment->getAttribute('id');
$item->title=trim($comment->firstChild()->plaintext); $item['title']=trim($comment->firstChild()->plaintext);
$item->timestamp=strtotime($comment->find('relative-time',0)->getAttribute('datetime')); $item['timestamp']=strtotime($comment->find('relative-time',0)->getAttribute('datetime'));
$item->content=$comment->find('.comment-body',0)->innertext; $item['content']=$comment->find('.comment-body',0)->innertext;
$this->items[]=$item; $this->items[]=$item;
} }

View file

@ -47,31 +47,31 @@ class GitlabCommitsBridge extends BridgeAbstract{
foreach($html->find('li.commit') as $commit){ foreach($html->find('li.commit') as $commit){
$item = new \Item(); $item = array();
$item->uri=$param['uri']; $item['uri']=$param['uri'];
foreach($commit->getElementsByTagName('a') as $a){ foreach($commit->getElementsByTagName('a') as $a){
$classes=explode(' ',$a->getAttribute("class")); $classes=explode(' ',$a->getAttribute("class"));
if(in_array('commit-short-id',$classes) || if(in_array('commit-short-id',$classes) ||
in_array('commit_short_id',$classes)){ in_array('commit_short_id',$classes)){
$href=$a->getAttribute('href'); $href=$a->getAttribute('href');
$item->uri.=substr($href,strpos($href,'/'.$param['u'].'/'.$param['p'])); $item['uri'].=substr($href,strpos($href,'/'.$param['u'].'/'.$param['p']));
} }
if(in_array('commit-row-message',$classes)){ if(in_array('commit-row-message',$classes)){
$item->title=$a->plaintext; $item['title']=$a->plaintext;
} }
if(in_array('commit-author-link',$classes)){ if(in_array('commit-author-link',$classes)){
$item->author=trim($a->plaintext); $item['author']=trim($a->plaintext);
} }
} }
$pre=$commit->find('pre',0); $pre=$commit->find('pre',0);
if($pre){ if($pre){
$item->content=$pre->outertext; $item['content']=$pre->outertext;
}else{ }else{
$item->content=''; $item['content']='';
} }
$item->timestamp=strtotime($commit->find('time',0)->getAttribute('datetime')); $item['timestamp']=strtotime($commit->find('time',0)->getAttribute('datetime'));
$this->items[]=$item; $this->items[]=$item;
} }

View file

@ -30,11 +30,11 @@ class GizmodoFRBridge extends BridgeAbstract{
foreach($rssFeed->find('item') as $element) { foreach($rssFeed->find('item') as $element) {
if($limit < 15) { if($limit < 15) {
$item = new \Item(); $item = array();
$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('pubDate', 0)->plaintext); $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = GizmodoFRExtractContent($item->uri); $item['content'] = GizmodoFRExtractContent($item['uri']);
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }

View file

@ -42,23 +42,23 @@ class GooglePlusPostBridge extends BridgeAbstract
// foreach ($html->find('meta') as $e) // foreach ($html->find('meta') as $e)
// { // {
// $item = new \Item(); // $item = array();
// $item->content = var_export($e->attr, true); // $item['content'] = var_export($e->attr, true);
// $this->items[] = $item; // $this->items[] = $item;
// } // }
// div[jsmodel=XNmfOc] // div[jsmodel=XNmfOc]
foreach($html->find('div.yt') as $post) foreach($html->find('div.yt') as $post)
{ {
$item = new \Item(); $item = array();
// $item->content = $post->find('div.Al', 0)->innertext; // $item['content'] = $post->find('div.Al', 0)->innertext;
$item->username = $item->fullname = $post->find('header.lea h3 a', 0)->innertext; $item['username'] = $item['fullname'] = $post->find('header.lea h3 a', 0)->innertext;
$item->id = $post->getAttribute('id'); $item['id'] = $post->getAttribute('id');
// $item->title = $item->fullname = $post->find('header.lea', 0)->plaintext; // $item['title'] = $item['fullname'] = $post->find('header.lea', 0)->plaintext;
$item->avatar = $post->find('div.ys img', 0)->src; $item['avatar'] = $post->find('div.ys img', 0)->src;
// var_dump((($post->find('a.o-U-s', 0)->getAllAttributes()))); // var_dump((($post->find('a.o-U-s', 0)->getAllAttributes())));
$item->uri = self::GOOGLE_PLUS_BASE_URL . $post->find('a.o-U-s', 0)->href; $item['uri'] = self::GOOGLE_PLUS_BASE_URL . $post->find('a.o-U-s', 0)->href;
$item->timestamp = strtotime($post->find('a.o-U-s', 0)->plaintext); $item['timestamp'] = strtotime($post->find('a.o-U-s', 0)->plaintext);
$this->items[] = $item; $this->items[] = $item;
// hashtag to treat : https://plus.google.com/explore/tag // hashtag to treat : https://plus.google.com/explore/tag
@ -68,11 +68,11 @@ class GooglePlusPostBridge extends BridgeAbstract
$hashtags[ trim($hashtag->plaintext) ] = self::GOOGLE_PLUS_BASE_URL . $hashtag->href; $hashtags[ trim($hashtag->plaintext) ] = self::GOOGLE_PLUS_BASE_URL . $hashtag->href;
} }
$item->content = ''; $item['content'] = '';
// avatar display // avatar display
$item->content .= '<div style="float:left; margin: 0 0.5em 0.5em 0;"><a href="' . self::GOOGLE_PLUS_BASE_URL . urlencode($this->request); $item['content'] .= '<div style="float:left; margin: 0 0.5em 0.5em 0;"><a href="' . self::GOOGLE_PLUS_BASE_URL . urlencode($this->request);
$item->content .= '"><img align="top" alt="avatar" src="' . $item->avatar.'" />' . $item->username . '</a></div>'; $item['content'] .= '"><img align="top" alt="avatar" src="' . $item['avatar'].'" />' . $item['username'] . '</a></div>';
$content = $post->find('div.Al', 0); $content = $post->find('div.Al', 0);
@ -100,10 +100,10 @@ class GooglePlusPostBridge extends BridgeAbstract
} }
$content = $content->innertext; $content = $content->innertext;
$item->content .= '<div style="margin-top: -1.5em">' . $content . '</div>'; $item['content'] .= '<div style="margin-top: -1.5em">' . $content . '</div>';
// extract plaintext // extract plaintext
$item->content_simple = $post->find('div.Al', 0)->plaintext; $item['content_simple'] = $post->find('div.Al', 0)->plaintext;
} }
// $html->save(__DIR__ . '/../posts2.html'); // $html->save(__DIR__ . '/../posts2.html');

View file

@ -39,15 +39,15 @@ class GoogleSearchBridge extends BridgeAbstract{
$emIsRes = $html->find('div[id=ires]',0); $emIsRes = $html->find('div[id=ires]',0);
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 = array();
// 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;
parse_str(parse_url($t, PHP_URL_QUERY),$parameters); parse_str(parse_url($t, PHP_URL_QUERY),$parameters);
if (isset($parameters['q'])) { $item->uri = $parameters['q']; } if (isset($parameters['q'])) { $item['uri'] = $parameters['q']; }
$item->title = $element->find('h3',0)->plaintext; $item['title'] = $element->find('h3',0)->plaintext;
$item->content = $element->find('span[class=st]',0)->plaintext; $item['content'] = $element->find('span[class=st]',0)->plaintext;
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -20,11 +20,11 @@ class GuruMedBridge extends BridgeAbstract{
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {
if($limit < 5) { if($limit < 5) {
$item = new \Item(); $item = array();
$item->title = $this->GurumedStripCDATA($element->find('title', 0)->innertext); $item['title'] = $this->GurumedStripCDATA($element->find('title', 0)->innertext);
$item->uri = $this->GurumedStripCDATA($element->find('guid', 0)->plaintext); $item['uri'] = $this->GurumedStripCDATA($element->find('guid', 0)->plaintext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = $this->GurumedStripCDATA(strip_tags($element->find('description', 0), '<p><a><br>')); $item['content'] = $this->GurumedStripCDATA(strip_tags($element->find('description', 0), '<p><a><br>'));
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }

View file

@ -49,12 +49,12 @@ class HDWallpapersBridge extends BridgeAbstract {
foreach($html->find('.wallpapers .wall a') as $element) { foreach($html->find('.wallpapers .wall a') as $element) {
$thumbnail = $element->find('img', 0); $thumbnail = $element->find('img', 0);
$item = new \Item(); $item = array();
// http://www.hdwallpapers.in/download/yosemite_reflections-1680x1050.jpg // http://www.hdwallpapers.in/download/yosemite_reflections-1680x1050.jpg
$item->uri = $baseUri.'/download'.str_replace('wallpapers.html', $this->resolution.'.jpg', $element->href); $item['uri'] = $baseUri.'/download'.str_replace('wallpapers.html', $this->resolution.'.jpg', $element->href);
$item->timestamp = time(); $item['timestamp'] = time();
$item->title = $element->find('p', 0)->text(); $item['title'] = $element->find('p', 0)->text();
$item->content = $item->title.'<br><a href="'.$item->uri.'"><img src="'.$baseUri.$thumbnail->src.'" /></a>'; $item['content'] = $item['title'].'<br><a href="'.$item['uri'].'"><img src="'.$baseUri.$thumbnail->src.'" /></a>';
$this->items[] = $item; $this->items[] = $item;
$num++; $num++;

View file

@ -13,12 +13,12 @@ class HentaiHavenBridge extends BridgeAbstract{
public function collectData(array $param){ public function collectData(array $param){
$html = $this->getSimpleHTMLDOM('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 = array();
$item->uri = $element->find('div.brick-content h3 a', 0)->href; $item['uri'] = $element->find('div.brick-content h3 a', 0)->href;
$thumbnailUri = $element->find('a.thumbnail-image img', 0)->getAttribute('data-src'); $thumbnailUri = $element->find('a.thumbnail-image img', 0)->getAttribute('data-src');
$item->title = mb_convert_encoding(trim($element->find('div.brick-content h3 a', 0)->innertext), 'UTF-8', 'HTML-ENTITIES'); $item['title'] = mb_convert_encoding(trim($element->find('div.brick-content h3 a', 0)->innertext), 'UTF-8', 'HTML-ENTITIES');
$item->tags = $element->find('div.oFlyout_bg div.oFlyout div.flyoutContent span.tags', 0)->plaintext; $item['tags'] = $element->find('div.oFlyout_bg div.oFlyout div.flyoutContent span.tags', 0)->plaintext;
$item->content = 'Tags: ' . $item->tags.'<br><br><a href="' . $item->uri . '"><img width="300" height="169" src="' . $thumbnailUri . '" /></a><br>' . $element->find('div.oFlyout_bg div.oFlyout div.flyoutContent p.description', 0)->innertext; $item['content'] = 'Tags: ' . $item['tags'].'<br><br><a href="' . $item['uri'] . '"><img width="300" height="169" src="' . $thumbnailUri . '" /></a><br>' . $element->find('div.oFlyout_bg div.oFlyout div.flyoutContent p.description', 0)->innertext;
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -27,11 +27,11 @@ class IdenticaBridge extends BridgeAbstract{
} }
foreach($html->find('li.major') as $dent) { foreach($html->find('li.major') as $dent) {
$item = new \Item(); $item = array();
$item->uri = html_entity_decode($dent->find('a', 0)->href); // get dent link $item['uri'] = html_entity_decode($dent->find('a', 0)->href); // get dent link
$item->timestamp = strtotime($dent->find('abbr.easydate', 0)->plaintext); // extract dent timestamp $item['timestamp'] = strtotime($dent->find('abbr.easydate', 0)->plaintext); // extract dent timestamp
$item->content = trim($dent->find('div.activity-content', 0)->innertext); // extract dent text $item['content'] = trim($dent->find('div.activity-content', 0)->innertext); // extract dent text
$item->title = $param['u'] . ' | ' . $item->content; $item['title'] = $param['u'] . ' | ' . $item['content'];
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -54,16 +54,16 @@ class InstagramBridge extends BridgeAbstract{
foreach($userMedia as $media) foreach($userMedia as $media)
{ {
$item = new \Item(); $item = array();
$item->uri = "https://instagram.com/p/".$media->code."/"; $item['uri'] = "https://instagram.com/p/".$media->code."/";
$item->content = '<img src="' . htmlentities($media->display_src) . '" />'; $item['content'] = '<img src="' . htmlentities($media->display_src) . '" />';
if (isset($media->caption)) if (isset($media->caption))
{ {
$item->title = $media->caption; $item['title'] = $media->caption;
} else { } else {
$item->title = basename($media->display_src); $item['title'] = basename($media->display_src);
} }
$item->timestamp = $media->date; $item['timestamp'] = $media->date;
$this->items[] = $item; $this->items[] = $item;
} }

View file

@ -246,13 +246,13 @@ class IsoHuntBridge extends BridgeAbstract{
if(!$date) if(!$date)
$this->returnServerError('Unable to find date!'); $this->returnServerError('Unable to find date!');
$item = new \Item(); $item = array();
$item->uri = $this->fix_relative_uri($anchor->href); $item['uri'] = $this->fix_relative_uri($anchor->href);
$item->title = $anchor->title; $item['title'] = $anchor->title;
// $item->author = // $item['author'] =
$item->timestamp = strtotime($date->plaintext); $item['timestamp'] = strtotime($date->plaintext);
$item->content = $this->fix_relative_uri($torrent->innertext); $item['content'] = $this->fix_relative_uri($torrent->innertext);
$this->items[] = $item; $this->items[] = $item;
} }
@ -284,13 +284,13 @@ class IsoHuntBridge extends BridgeAbstract{
if(!$element) if(!$element)
$this->returnServerError('Unable to find element!'); $this->returnServerError('Unable to find element!');
$item = new \Item(); $item = array();
$item->uri = $element->href; $item['uri'] = $element->href;
$item->title = $element->plaintext; $item['title'] = $element->plaintext;
// $item->author = // $item['author'] =
// $item->timestamp = // $item['timestamp'] =
// $item->content = // $item['content'] =
$this->items[] = $item; $this->items[] = $item;
} }
@ -310,13 +310,13 @@ class IsoHuntBridge extends BridgeAbstract{
$this->returnServerError('Unable to find posts!'); $this->returnServerError('Unable to find posts!');
foreach($posts as $post){ foreach($posts as $post){
$item = new \Item(); $item = array();
$item->uri = $this->latest_news_extract_uri($post); $item['uri'] = $this->latest_news_extract_uri($post);
$item->title = $this->latest_news_extract_title($post); $item['title'] = $this->latest_news_extract_title($post);
$item->author = $this->latest_news_extract_author($post); $item['author'] = $this->latest_news_extract_author($post);
$item->timestamp = $this->latest_news_extract_timestamp($post); $item['timestamp'] = $this->latest_news_extract_timestamp($post);
$item->content = $this->latest_news_extract_content($post); $item['content'] = $this->latest_news_extract_content($post);
$this->items[] = $item; $this->items[] = $item;
} }
@ -399,13 +399,13 @@ class IsoHuntBridge extends BridgeAbstract{
$this->returnServerError('Unable to find torrents!'); $this->returnServerError('Unable to find torrents!');
foreach($torrents as $torrent){ foreach($torrents as $torrent){
$item = new \Item(); $item = array();
$item->uri = $this->latest_torrents_extract_uri($torrent); $item['uri'] = $this->latest_torrents_extract_uri($torrent);
$item->title = $this->latest_torrents_extract_title($torrent); $item['title'] = $this->latest_torrents_extract_title($torrent);
$item->author = $this->latest_torrents_extract_author($torrent); $item['author'] = $this->latest_torrents_extract_author($torrent);
$item->timestamp = $this->latest_torrents_extract_timestamp($torrent); $item['timestamp'] = $this->latest_torrents_extract_timestamp($torrent);
$item->content = ''; // There is no valuable content $item['content'] = ''; // There is no valuable content
$this->items[] = $item; $this->items[] = $item;
} }

View file

@ -82,11 +82,11 @@ class JapanExpoBridge extends BridgeAbstract{
$content = '<img src="'.$thumbnail.'"></img><br />'.$date_text.'<br /><a href="'.$url.'">Lire l\'article</a>'; $content = '<img src="'.$thumbnail.'"></img><br />'.$date_text.'<br /><a href="'.$url.'">Lire l\'article</a>';
} }
$item = new \Item(); $item = array();
$item->uri = $url; $item['uri'] = $url;
$item->title = $title; $item['title'] = $title;
$item->timestamp = $timestamp; $item['timestamp'] = $timestamp;
$item->content = $content; $item['content'] = $content;
$this->items[] = $item; $this->items[] = $item;
$count++; $count++;
} }

View file

@ -33,13 +33,13 @@ class KonachanBridge extends BridgeAbstract{
foreach($data as $datai) { foreach($data as $datai) {
$json = json_decode($datai, TRUE); $json = json_decode($datai, TRUE);
$item = new \Item(); $item = array();
$item->uri = 'http://konachan.com/post/show/'.$json['id']; $item['uri'] = 'http://konachan.com/post/show/'.$json['id'];
$item->postid = $json['id']; $item['postid'] = $json['id'];
$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;
} }
} }

View file

@ -27,11 +27,11 @@ class KoreusBridge extends BridgeAbstract{
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {
if($limit < 5) { if($limit < 5) {
$item = new \Item(); $item = array();
$item->title = $this->KoreusStripCDATA($element->find('title', 0)->innertext); $item['title'] = $this->KoreusStripCDATA($element->find('title', 0)->innertext);
$item->uri = $this->KoreusStripCDATA($element->find('guid', 0)->plaintext); $item['uri'] = $this->KoreusStripCDATA($element->find('guid', 0)->plaintext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = $this->KoreusExtractContent($item->uri); $item['content'] = $this->KoreusExtractContent($item['uri']);
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }

View file

@ -93,17 +93,17 @@ class KununuBridge extends BridgeAbstract{
// Go through all articles // Go through all articles
foreach($articles as $article){ foreach($articles as $article){
$item = new \Item(); $item = array();
$item->author = $this->extract_article_author_position($article); $item['author'] = $this->extract_article_author_position($article);
$item->timestamp = $this->extract_article_date($article); $item['timestamp'] = $this->extract_article_date($article);
$item->title = $this->extract_article_rating($article) . ' : ' . $this->extract_article_summary($article); $item['title'] = $this->extract_article_rating($article) . ' : ' . $this->extract_article_summary($article);
$item->uri = $this->extract_article_uri($article); $item['uri'] = $this->extract_article_uri($article);
if($full) if($full)
$item->content = $this->extract_full_description($item->uri); $item['content'] = $this->extract_full_description($item['uri']);
else else
$item->content = $this->extract_article_description($article); $item['content'] = $this->extract_article_description($article);
$this->items[] = $item; $this->items[] = $item;
} }

View file

@ -81,34 +81,34 @@ class LWNprevBridge extends BridgeAbstract{
continue; continue;
} }
$item = new \Item(); $item = array();
$h2NextSibling=$h2->nextSibling; $h2NextSibling=$h2->nextSibling;
$this->jumpToNextTag($h2NextSibling); $this->jumpToNextTag($h2NextSibling);
switch($h2NextSibling->getAttribute('class')){ switch($h2NextSibling->getAttribute('class')){
case 'FeatureByline': case 'FeatureByline':
$item->author=$h2NextSibling->getElementsByTagName('b')->item(0)->textContent; $item['author']=$h2NextSibling->getElementsByTagName('b')->item(0)->textContent;
break; break;
case 'GAByline': case 'GAByline':
$text=$h2NextSibling->textContent; $text=$h2NextSibling->textContent;
$item->author=substr($text,strpos($text,'by ')); $item['author']=substr($text,strpos($text,'by '));
break; break;
default: default:
$item->author='LWN'; $item['author']='LWN';
break; break;
}; };
$h2FirstChild=$h2->firstChild; $h2FirstChild=$h2->firstChild;
$this->jumpToNextTag($h2FirstChild); $this->jumpToNextTag($h2FirstChild);
if($h2FirstChild->nodeName==='a'){ if($h2FirstChild->nodeName==='a'){
$item->uri='https://lwn.net'.$h2FirstChild->getAttribute('href'); $item['uri']='https://lwn.net'.$h2FirstChild->getAttribute('href');
}else{ }else{
$item->uri=$realURI.'#'.$URICounter; $item['uri']=$realURI.'#'.$URICounter;
} }
$URICounter++; $URICounter++;
$item->timestamp=$editionTimeStamp+$URICounter; $item['timestamp']=$editionTimeStamp+$URICounter;
$h2PrevSibling=$h2->previousSibling; $h2PrevSibling=$h2->previousSibling;
$this->jumpToPreviousTag($h2PrevSibling); $this->jumpToPreviousTag($h2PrevSibling);
@ -131,11 +131,11 @@ class LWNprevBridge extends BridgeAbstract{
} }
$h2PrevSibling=null; $h2PrevSibling=null;
$item->title=''; $item['title']='';
if(!empty($cat1)){ if(!empty($cat1)){
$item->title.='['.$cat1.($cat2?'/'.$cat2:'').'] '; $item['title'].='['.$cat1.($cat2?'/'.$cat2:'').'] ';
} }
$item->title.=$h2->textContent; $item['title'].=$h2->textContent;
$node=$h2; $node=$h2;
$content=''; $content='';
@ -156,7 +156,7 @@ class LWNprevBridge extends BridgeAbstract{
$content.=$node->C14N(); $content.=$node->C14N();
} }
} }
$item->content=$content; $item['content']=$content;
$this->items[]=$item; $this->items[]=$item;
} }
} }

View file

@ -160,8 +160,8 @@ class LeBonCoinBridge extends BridgeAbstract{
$element = $element->find('a', 0); $element = $element->find('a', 0);
$item = new \Item(); $item = array();
$item->uri = $element->href; $item['uri'] = $element->href;
$title = html_entity_decode($element->getAttribute('title')); $title = html_entity_decode($element->getAttribute('title'));
$content_image = $element->find('div.item_image', 0)->find('.lazyload', 0); $content_image = $element->find('div.item_image', 0)->find('.lazyload', 0);
@ -178,8 +178,8 @@ class LeBonCoinBridge extends BridgeAbstract{
$price = $detailsList->find('h3.item_price', 0); $price = $detailsList->find('h3.item_price', 0);
$content .= $price === NULL ? '' : $price->plaintext; $content .= $price === NULL ? '' : $price->plaintext;
$item->title = $title; $item['title'] = $title;
$item->content = $content . $date; $item['content'] = $content . $date;
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -42,11 +42,11 @@ class LeJournalDuGeekBridge extends BridgeAbstract{
foreach($rssFeed->find('item') as $element) { foreach($rssFeed->find('item') as $element) {
if($limit < 5) { if($limit < 5) {
$item = new \Item(); $item = array();
$item->title = $this->LeJournalDuGeekStripCDATA($element->find('title', 0)->innertext); $item['title'] = $this->LeJournalDuGeekStripCDATA($element->find('title', 0)->innertext);
$item->uri = $this->LeJournalDuGeekStripCDATA($element->find('guid', 0)->plaintext); $item['uri'] = $this->LeJournalDuGeekStripCDATA($element->find('guid', 0)->plaintext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = $this->LeJournalDuGeekExtractContent($item->uri); $item['content'] = $this->LeJournalDuGeekExtractContent($item['uri']);
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }

View file

@ -48,12 +48,12 @@ class LeMondeInformatiqueBridge extends BridgeAbstract {
$article_title = $article_html->find('h1.cleanprint-title', 0)->plaintext; $article_title = $article_html->find('h1.cleanprint-title', 0)->plaintext;
//Build and add final item //Build and add final item
$item = new \Item(); $item = array();
$item->uri = $article_uri; $item['uri'] = $article_uri;
$item->title = $article_title; $item['title'] = $article_title;
$item->author = StripCDATA($element->find('dc:creator', 0)->innertext); $item['author'] = StripCDATA($element->find('dc:creator', 0)->innertext);
$item->timestamp = strtotime($element->find('dc:date', 0)->plaintext); $item['timestamp'] = strtotime($element->find('dc:date', 0)->plaintext);
$item->content = $article_content; $item['content'] = $article_content;
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }

View file

@ -19,22 +19,22 @@ class Les400Culs extends RssExpander{
} }
protected function parseRSSItem($newsItem) { protected function parseRSSItem($newsItem) {
$item = new Item(); $item = array();
$item->title = trim((string) $newsItem->title); $item['title'] = trim((string) $newsItem->title);
// $this->message("browsing item ".var_export($newsItem, true)); // $this->message("browsing item ".var_export($newsItem, true));
if(empty($newsItem->guid)) { if(empty($newsItem->guid)) {
$item->uri = (string) $newsItem->link; $item['uri'] = (string) $newsItem->link;
} else { } else {
$item->uri = (string) $newsItem->guid; $item['uri'] = (string) $newsItem->guid;
} }
// now load that uri from cache // now load that uri from cache
// $this->message("now loading page ".$item->uri); // $this->message("now loading page ".$item['uri']);
// $articlePage = str_get_html($this->get_cached($item->uri)); // $articlePage = str_get_html($this->get_cached($item['uri']));
// $content = $articlePage->find('.post-container', 0); // $content = $articlePage->find('.post-container', 0);
$item->content = (string) $newsItem->description; $item['content'] = (string) $newsItem->description;
$item->author = (string) $newsItem->author; $item['author'] = (string) $newsItem->author;
$item->timestamp = $this->RSS_2_0_time_to_timestamp($newsItem); $item['timestamp'] = $this->RSS_2_0_time_to_timestamp($newsItem);
return $item; return $item;
} }
public function getCacheDuration(){ public function getCacheDuration(){

View file

@ -14,7 +14,7 @@ class LesJoiesDuCodeBridge extends BridgeAbstract{
$html = $this->getSimpleHTMLDOM('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 = array();
$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;
@ -35,13 +35,13 @@ class LesJoiesDuCodeBridge extends BridgeAbstract{
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;
} }

View file

@ -19,14 +19,14 @@ class LichessBridge extends BridgeAbstract
{ {
if ($posts_loaded < 5) if ($posts_loaded < 5)
{ {
$item = new \Item(); $item = array();
$item->title = html_entity_decode($entry->find('title', 0)->innertext); $item['title'] = html_entity_decode($entry->find('title', 0)->innertext);
$item->author = $entry->find('author', 0)->find('name', 0)->innertext; $item['author'] = $entry->find('author', 0)->find('name', 0)->innertext;
$item->uri = $entry->find('id', 0)->plaintext; $item['uri'] = $entry->find('id', 0)->plaintext;
$item->timestamp = strtotime($entry->find('published', 0)->plaintext); $item['timestamp'] = strtotime($entry->find('published', 0)->plaintext);
$item->content = $this->retrieve_lichess_post($item->uri); $item['content'] = $this->retrieve_lichess_post($item['uri']);
$this->items[] = $item; $this->items[] = $item;
$posts_loaded++; $posts_loaded++;

View file

@ -25,10 +25,10 @@ class LinkedInCompany extends BridgeAbstract{
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;
if ($title) { if ($title) {
$item = new \Item(); $item = array();
$item->uri = $link; $item['uri'] = $link;
$item->title = mb_substr(strip_tags($element->find('span.share-body', 0)->innertext), 0 ,100); $item['title'] = mb_substr(strip_tags($element->find('span.share-body', 0)->innertext), 0 ,100);
$item->content = strip_tags($element->find('span.share-body', 0)->innertext); $item['content'] = strip_tags($element->find('span.share-body', 0)->innertext);
$this->items[] = $item; $this->items[] = $item;
$i++; $i++;
} }

View file

@ -33,13 +33,13 @@ class LolibooruBridge extends BridgeAbstract{
foreach($data as $datai) { foreach($data as $datai) {
$json = json_decode($datai, TRUE); $json = json_decode($datai, TRUE);
$item = new \Item(); $item = array();
$item->uri = 'http://lolibooru.moe/post/show/'.$json['id']; $item['uri'] = 'http://lolibooru.moe/post/show/'.$json['id'];
$item->postid = $json['id']; $item['postid'] = $json['id'];
$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;
} }
} }

View file

@ -128,18 +128,18 @@ class MangareaderBridge extends BridgeAbstract{
$chapters = $xpath->query("a[@class='chaptersrec']", $node); $chapters = $xpath->query("a[@class='chaptersrec']", $node);
if (isset($manga) && $chapters->length >= 1){ if (isset($manga) && $chapters->length >= 1){
$item = new \Item(); $item = array();
$item->uri = 'http://www.mangareader.net' . htmlspecialchars($manga->getAttribute('href')); $item['uri'] = 'http://www.mangareader.net' . htmlspecialchars($manga->getAttribute('href'));
$item->title = htmlspecialchars($manga->nodeValue); $item['title'] = htmlspecialchars($manga->nodeValue);
// Add each chapter to the feed // Add each chapter to the feed
$item->content = ""; $item['content'] = "";
foreach ($chapters as $chapter){ foreach ($chapters as $chapter){
if($item->content <> ""){ if($item['content'] <> ""){
$item->content .= "<br>"; $item['content'] .= "<br>";
} }
$item->content .= "<a href='http://www.mangareader.net" . htmlspecialchars($chapter->getAttribute('href')) . "'>" . htmlspecialchars($chapter->nodeValue) . "</a>"; $item['content'] .= "<a href='http://www.mangareader.net" . htmlspecialchars($chapter->getAttribute('href')) . "'>" . htmlspecialchars($chapter->nodeValue) . "</a>";
} }
$this->items[] = $item; $this->items[] = $item;
@ -162,13 +162,13 @@ class MangareaderBridge extends BridgeAbstract{
$mangaimgelement = $xpath->query(".//*[@class='imgsearchresults']", $manga)->item(0)->getAttribute('style'); $mangaimgelement = $xpath->query(".//*[@class='imgsearchresults']", $manga)->item(0)->getAttribute('style');
$thumbnail = substr($mangaimgelement, 22, strlen($mangaimgelement) - 24); $thumbnail = substr($mangaimgelement, 22, strlen($mangaimgelement) - 24);
$item = new \Item(); $item = array();
$item->title = htmlspecialchars($xpath->query(".//*[@class='manga_name']//a", $manga)->item(0)->nodeValue); $item['title'] = htmlspecialchars($xpath->query(".//*[@class='manga_name']//a", $manga)->item(0)->nodeValue);
$item->uri = 'http://www.mangareader.net' . $xpath->query(".//*[@class='manga_name']//a", $manga)->item(0)->getAttribute('href'); $item['uri'] = 'http://www.mangareader.net' . $xpath->query(".//*[@class='manga_name']//a", $manga)->item(0)->getAttribute('href');
$item->author = htmlspecialchars($xpath->query("//*[@class='author_name']", $manga)->item(0)->nodeValue); $item['author'] = htmlspecialchars($xpath->query("//*[@class='author_name']", $manga)->item(0)->nodeValue);
$item->chaptercount = $xpath->query(".//*[@class='chapter_count']", $manga)->item(0)->nodeValue; $item['chaptercount'] = $xpath->query(".//*[@class='chapter_count']", $manga)->item(0)->nodeValue;
$item->genre = htmlspecialchars($xpath->query(".//*[@class='manga_genre']", $manga)->item(0)->nodeValue); $item['genre'] = htmlspecialchars($xpath->query(".//*[@class='manga_genre']", $manga)->item(0)->nodeValue);
$item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnail . '" alt="' . $item->title . '" /></a><p>' . $item->genre . '</p><p>' . $item->chaptercount . '</p>'; $item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $thumbnail . '" alt="' . $item['title'] . '" /></a><p>' . $item['genre'] . '</p><p>' . $item['chaptercount'] . '</p>';
$this->items[] = $item; $this->items[] = $item;
} }
} }
@ -186,18 +186,18 @@ class MangareaderBridge extends BridgeAbstract{
$chapters = $xpath->query($query); $chapters = $xpath->query($query);
foreach ($chapters as $chapter){ foreach ($chapters as $chapter){
$item = new \Item(); $item = array();
$item->title = htmlspecialchars($xpath->query("td[1]", $chapter)->item(0)->nodeValue); $item['title'] = htmlspecialchars($xpath->query("td[1]", $chapter)->item(0)->nodeValue);
$item->uri = 'http://www.mangareader.net' . $xpath->query("td[1]/a", $chapter)->item(0)->getAttribute('href'); $item['uri'] = 'http://www.mangareader.net' . $xpath->query("td[1]/a", $chapter)->item(0)->getAttribute('href');
$item->timestamp = strtotime($xpath->query("td[2]", $chapter)->item(0)->nodeValue); $item['timestamp'] = strtotime($xpath->query("td[2]", $chapter)->item(0)->nodeValue);
array_unshift($this->items, $item); array_unshift($this->items, $item);
} }
} }
// Return some dummy-data if no content available // Return some dummy-data if no content available
if(count($this->items) == 0){ if(count($this->items) == 0){
$item = new \Item(); $item = array();
$item->content = "<p>No updates available</p>"; $item['content'] = "<p>No updates available</p>";
$this->items[] = $item; $this->items[] = $item;
} }

View file

@ -29,14 +29,14 @@ class MilbooruBridge extends BridgeAbstract{
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 = array();
$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;
} }
} }

View file

@ -13,10 +13,10 @@ class MondeDiploBridge extends BridgeAbstract{
foreach($html->find('div.unarticle') as $article) { foreach($html->find('div.unarticle') as $article) {
$element = $article->parent(); $element = $article->parent();
$item = new Item(); $item = array();
$item->uri = $this->uri . $element->href; $item['uri'] = $this->uri . $element->href;
$item->title = $element->find('h3', 0)->plaintext; $item['title'] = $element->find('h3', 0)->plaintext;
$item->content = $element->find('div.dates_auteurs', 0)->plaintext . '<br>' . strstr($element->find('div', 0)->plaintext, $element->find('div.dates_auteurs', 0)->plaintext, true); $item['content'] = $element->find('div.dates_auteurs', 0)->plaintext . '<br>' . strstr($element->find('div', 0)->plaintext, $element->find('div.dates_auteurs', 0)->plaintext, true);
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -10,8 +10,8 @@ class MsnMondeBridge extends BridgeAbstract{
private function MsnMondeExtractContent($url, &$item) { private function MsnMondeExtractContent($url, &$item) {
$html2 = $this->getSimpleHTMLDOM($url); $html2 = $this->getSimpleHTMLDOM($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){
@ -19,10 +19,10 @@ class MsnMondeBridge extends BridgeAbstract{
$limit = 0; $limit = 0;
foreach($html->find('.smalla') as $article) { foreach($html->find('.smalla') as $article) {
if($limit < 10) { if($limit < 10) {
$item = new \Item(); $item = array();
$item->title = utf8_decode($article->find('h4', 0)->innertext); $item['title'] = utf8_decode($article->find('h4', 0)->innertext);
$item->uri = "http://www.msn.com" . utf8_decode($article->find('a', 0)->href); $item['uri'] = "http://www.msn.com" . utf8_decode($article->find('a', 0)->href);
$this->MsnMondeExtractContent($item->uri, $item); $this->MsnMondeExtractContent($item['uri'], $item);
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }

View file

@ -32,14 +32,14 @@ class MspabooruBridge extends BridgeAbstract{
foreach($html->find('div[class=content] span') as $element) { foreach($html->find('div[class=content] span') as $element) {
$item = new \Item(); $item = array();
$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;
} }
} }

View file

@ -56,12 +56,12 @@ class NakedSecurityBridge extends BridgeAbstract {
$article_content = '<p><img src="'.$article_image.'" /></p><p><b>'.$article_summary.'</b></p>'.$article_content; $article_content = '<p><img src="'.$article_image.'" /></p><p><b>'.$article_summary.'</b></p>'.$article_content;
//Build and add final item //Build and add final item
$item = new \Item(); $item = array();
$item->uri = $article_uri; $item['uri'] = $article_uri;
$item->title = $article_title; $item['title'] = $article_title;
$item->author = $article_html->find('a[rel=author]', 0)->plaintext; $item['author'] = $article_html->find('a[rel=author]', 0)->plaintext;
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = $article_content; $item['content'] = $article_content;
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }

View file

@ -18,11 +18,11 @@ class NasaApodBridge extends BridgeAbstract{
for($i = 0; $i < 3;$i++) for($i = 0; $i < 3;$i++)
{ {
$line = $list[$i]; $line = $list[$i];
$item = new \Item(); $item = array();
$uri_page = $html->find('a',$i + 3)->href; $uri_page = $html->find('a',$i + 3)->href;
$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->getSimpleHTMLDOM($uri); $picture_html = $this->getSimpleHTMLDOM($uri);
$picture_html_string = $picture_html->innertext; $picture_html_string = $picture_html->innertext;
@ -35,11 +35,11 @@ class NasaApodBridge extends BridgeAbstract{
//Extract date from the picture page //Extract date from the picture page
$date = explode(" ", $picture_html->find('p',1)->innertext); $date = explode(" ", $picture_html->find('p',1)->innertext);
$item->timestamp = strtotime($date[4].$date[3].$date[2]); $item['timestamp'] = strtotime($date[4].$date[3].$date[2]);
//Other informations //Other informations
$item->content = $media.'<br />'.$explanation; $item['content'] = $media.'<br />'.$explanation;
$item->title = $picture_html->find('b',0)->innertext; $item['title'] = $picture_html->find('b',0)->innertext;
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -42,12 +42,12 @@ class NeuviemeArtBridge extends BridgeAbstract {
$article_content = StripWithDelimiters($article_content, '<link', '>'); $article_content = StripWithDelimiters($article_content, '<link', '>');
//Build and add final item //Build and add final item
$item = new \Item(); $item = array();
$item->uri = $article_uri; $item['uri'] = $article_uri;
$item->title = $article_title; $item['title'] = $article_title;
$item->author = $article_html->find('a[class=upp transition_fast upp]', 0)->plaintext; $item['author'] = $article_html->find('a[class=upp transition_fast upp]', 0)->plaintext;
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = $article_content; $item['content'] = $article_content;
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }

View file

@ -31,12 +31,12 @@ class NextInpactBridge extends BridgeAbstract {
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {
if($limit < 3) { if($limit < 3) {
$item = new \Item(); $item = array();
$item->title = $this->StripCDATA($element->find('title', 0)->innertext); $item['title'] = $this->StripCDATA($element->find('title', 0)->innertext);
$item->uri = $this->StripCDATA($element->find('guid', 0)->plaintext); $item['uri'] = $this->StripCDATA($element->find('guid', 0)->plaintext);
$item->author = $this->StripCDATA($element->find('creator', 0)->innertext); $item['author'] = $this->StripCDATA($element->find('creator', 0)->innertext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = $this->ExtractContent($item->uri); $item['content'] = $this->ExtractContent($item['uri']);
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }

View file

@ -74,12 +74,12 @@ class NextgovBridge extends BridgeAbstract {
.'<p><b>'.$article_subtitle.'</b></p>' .'<p><b>'.$article_subtitle.'</b></p>'
.trim($contents); .trim($contents);
$item = new \Item(); $item = array();
$item->uri = $article_url; $item['uri'] = $article_url;
$item->title = $article_title; $item['title'] = $article_title;
$item->author = $article_author; $item['author'] = $article_author;
$item->timestamp = $article_timestamp; $item['timestamp'] = $article_timestamp;
$item->content = $contents; $item['content'] = $contents;
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }

View file

@ -34,11 +34,11 @@ class NiceMatinBridge extends BridgeAbstract{
$element_text = str_replace('</link>', '</url>', $element_text); $element_text = str_replace('</link>', '</url>', $element_text);
$element = str_get_html($element_text); $element = str_get_html($element_text);
$item = new \Item(); $item = array();
$item->title = $element->find('title', 0)->innertext; $item['title'] = $element->find('title', 0)->innertext;
$item->uri = $element->find('url', 0)->innertext; $item['uri'] = $element->find('url', 0)->innertext;
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = $this->NiceMatinExtractContent($item->uri); $item['content'] = $this->NiceMatinExtractContent($item['uri']);
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }

View file

@ -33,12 +33,12 @@ class NovelUpdatesBridge extends BridgeAbstract{
$html = stristr($html, '<tr>'); //remove tbody $html = stristr($html, '<tr>'); //remove tbody
$html = str_get_html(stristr($html, '</tbody>', true)); //remove last tbody and get back as an array $html = str_get_html(stristr($html, '</tbody>', true)); //remove last tbody and get back as an array
foreach($html->find('tr') as $element){ foreach($html->find('tr') as $element){
$item = new \Item(); $item = array();
$item->uri = $element->find('td', 2)->find('a', 0)->href; $item['uri'] = $element->find('td', 2)->find('a', 0)->href;
$item->title = $element->find('td', 2)->find('a', 0)->plaintext; $item['title'] = $element->find('td', 2)->find('a', 0)->plaintext;
$item->team = $element->find('td', 1)->innertext; $item['team'] = $element->find('td', 1)->innertext;
$item->timestamp = strtotime($element->find('td', 0)->plaintext); $item['timestamp'] = strtotime($element->find('td', 0)->plaintext);
$item->content = '<a href="'.$item->uri.'">'.$this->request.' - '.$item->title.'</a> by '.$item->team.'<br><a href="'.$item->uri.'">'.$fullhtml->find('div.seriesimg', 0)->innertext.'</a>'; $item['content'] = '<a href="'.$item['uri'].'">'.$this->request.' - '.$item['title'].'</a> by '.$item['team'].'<br><a href="'.$item['uri'].'">'.$fullhtml->find('div.seriesimg', 0)->innertext.'</a>';
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -24,11 +24,11 @@ class NumeramaBridge extends BridgeAbstract{
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {
if($limit < 5) { if($limit < 5) {
$item = new \Item(); $item = array();
$item->title = html_entity_decode(NumeramaStripCDATA($element->find('title', 0)->innertext)); $item['title'] = html_entity_decode(NumeramaStripCDATA($element->find('title', 0)->innertext));
$item->author = NumeramaStripCDATA($element->find('dc:creator', 0)->innertext); $item['author'] = NumeramaStripCDATA($element->find('dc:creator', 0)->innertext);
$item->uri = NumeramaStripCDATA($element->find('guid', 0)->plaintext); $item['uri'] = NumeramaStripCDATA($element->find('guid', 0)->plaintext);
$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->getSimpleHTMLDOM($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);
@ -36,7 +36,7 @@ class NumeramaBridge extends BridgeAbstract{
$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
$item->content = $contents; $item['content'] = $contents;
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }

View file

@ -41,10 +41,10 @@ class OpenClassroomsBridge extends BridgeAbstract{
$html = $this->getSimpleHTMLDOM($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 = array();
$item->uri = 'https://openclassrooms.com'.$element->find('a', 0)->href; $item['uri'] = 'https://openclassrooms.com'.$element->find('a', 0)->href;
$item->title = $element->find('h3', 0)->plaintext; $item['title'] = $element->find('h3', 0)->plaintext;
$item->content = $element->find('slidingItem__descriptionContent', 0)->plaintext; $item['content'] = $element->find('slidingItem__descriptionContent', 0)->plaintext;
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -78,10 +78,10 @@ class ParuVenduImmoBridge extends BridgeAbstract
list($href) = explode('#', $element->href); list($href) = explode('#', $element->href);
$item = new \Item(); $item = array();
$item->uri = $this->uri.$href; $item['uri'] = $this->uri.$href;
$item->title = $element->title; $item['title'] = $element->title;
$item->content = $img.$desc.$price; $item['content'] = $img.$desc.$price;
$this->items[] = $item; $this->items[] = $item;
} }

View file

@ -54,11 +54,11 @@ class PickyWallpapersBridge extends BridgeAbstract {
foreach($html->find('.items li img') as $element) { foreach($html->find('.items li img') as $element) {
$item = new \Item(); $item = array();
$item->uri = str_replace('www', 'wallpaper', $baseUri).'/'.$this->resolution.'/'.basename($element->src); $item['uri'] = str_replace('www', 'wallpaper', $baseUri).'/'.$this->resolution.'/'.basename($element->src);
$item->timestamp = time(); $item['timestamp'] = time();
$item->title = $element->alt; $item['title'] = $element->alt;
$item->content = $item->title.'<br><a href="'.$item->uri.'">'.$element.'</a>'; $item['content'] = $item['title'].'<br><a href="'.$item['uri'].'">'.$element.'</a>';
$this->items[] = $item; $this->items[] = $item;
$num++; $num++;

View file

@ -57,9 +57,9 @@ class PinterestBridge extends BridgeAbstract{
$img = $a->find('img', 0); $img = $a->find('img', 0);
$item = new \Item(); $item = array();
$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))
@ -72,17 +72,17 @@ 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;
} }

View file

@ -19,11 +19,11 @@ class PlanetLibreBridge extends BridgeAbstract{
$limit = 0; $limit = 0;
foreach($html->find('div.post') as $element) { foreach($html->find('div.post') as $element) {
if($limit < 5) { if($limit < 5) {
$item = new \Item(); $item = array();
$item->title = $element->find('h1', 0)->plaintext; $item['title'] = $element->find('h1', 0)->plaintext;
$item->uri = $element->find('a', 0)->href; $item['uri'] = $element->find('a', 0)->href;
$item->timestamp = strtotime(str_replace('/', '-', $element->find('div[class="post-date"]', 0)->plaintext)); $item['timestamp'] = strtotime(str_replace('/', '-', $element->find('div[class="post-date"]', 0)->plaintext));
$item->content = $this->PlanetLibreExtractContent($item->uri); $item['content'] = $this->PlanetLibreExtractContent($item['uri']);
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }

View file

@ -16,18 +16,18 @@ class ProjectMGameBridge extends BridgeAbstract{
$html = $this->getSimpleHTMLDOM('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 = array();
$item->uri = 'http://projectmgame.com/en/'.$article->find('section div.info_block a',0)->href; $item['uri'] = 'http://projectmgame.com/en/'.$article->find('section div.info_block a',0)->href;
$item->title = $article->find('h1 p',0)->innertext; $item['title'] = $article->find('h1 p',0)->innertext;
$p_list = $article->find('section p'); $p_list = $article->find('section p');
$content = ''; $content = '';
foreach($p_list as $p) $content .= $p->innertext; foreach($p_list as $p) $content .= $p->innertext;
$item->content = $content; $item['content'] = $content;
// get publication date // get publication date
$str_date = $article->find('section div.info_block a',0)->innertext; $str_date = $article->find('section div.info_block a',0)->innertext;
$item->timestamp = strtotime($str_date); $item['timestamp'] = strtotime($str_date);
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -25,15 +25,15 @@ class RTBFBridge extends BridgeAbstract {
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) {
$item = new \Item(); $item = array();
$item->id = $element->getAttribute('data-id'); $item['id'] = $element->getAttribute('data-id');
$item->uri = 'http://www.rtbf.be/auvio/detail?id='.$item->id; $item['uri'] = 'http://www.rtbf.be/auvio/detail?id='.$item['id'];
$thumbnailUriSrcSet = explode(',', $element->find('figure .www-img-16by9 img', 0)->getAttribute('data-srcset')); $thumbnailUriSrcSet = explode(',', $element->find('figure .www-img-16by9 img', 0)->getAttribute('data-srcset'));
$thumbnailUriLastSrc = end($thumbnailUriSrcSet); $thumbnailUriLastSrc = end($thumbnailUriSrcSet);
$thumbnailUri = explode(' ', $thumbnailUriLastSrc)[0]; $thumbnailUri = explode(' ', $thumbnailUriLastSrc)[0];
$item->title = trim($element->find('h3',0)->plaintext) . ' - ' . trim($element->find('h4',0)->plaintext); $item['title'] = trim($element->find('h3',0)->plaintext) . ' - ' . trim($element->find('h4',0)->plaintext);
$item->timestamp = strtotime($element->find('time', 0)->getAttribute('datetime')); $item['timestamp'] = strtotime($element->find('time', 0)->getAttribute('datetime'));
$item->content = '<a href="' . $item->uri . '"><img src="' . $thumbnailUri . '" /></a>'; $item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $thumbnailUri . '" /></a>';
$this->items[] = $item; $this->items[] = $item;
$count++; $count++;
} }

View file

@ -103,12 +103,12 @@ class Releases3DSBridge extends BridgeAbstract {
.'</ul>'; .'</ul>';
//Build and add final item with the above three sections //Build and add final item with the above three sections
$item = new \Item(); $item = array();
$item->title = $name; $item['title'] = $name;
$item->author = $publisher; $item['author'] = $publisher;
$item->timestamp = $ignDate; $item['timestamp'] = $ignDate;
$item->uri = empty($ignLink) ? $searchLinkDuckDuckGo : $ignLink; $item['uri'] = empty($ignLink) ? $searchLinkDuckDuckGo : $ignLink;
$item->content = $ignDescription.$releaseDescription.$releaseSearchLinks; $item['content'] = $ignDescription.$releaseDescription.$releaseSearchLinks;
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }

View file

@ -31,11 +31,11 @@ class ReporterreBridge extends BridgeAbstract{
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {
if($limit < 5) { if($limit < 5) {
$item = new \Item(); $item = array();
$item->title = html_entity_decode($element->find('title', 0)->plaintext); $item['title'] = html_entity_decode($element->find('title', 0)->plaintext);
$item->timestamp = strtotime($element->find('dc:date', 0)->plaintext); $item['timestamp'] = strtotime($element->find('dc:date', 0)->plaintext);
$item->uri = $element->find('guid', 0)->innertext; $item['uri'] = $element->find('guid', 0)->innertext;
$item->content = html_entity_decode($this->ExtractContentReporterre($item->uri)); $item['content'] = html_entity_decode($this->ExtractContentReporterre($item['uri']));
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }

View file

@ -30,12 +30,12 @@ class Rue89Bridge extends BridgeAbstract{
$datas = $this->rue89getDatas(str_replace('#commentaires', '', ($element->find('comments', 0)->plaintext))); $datas = $this->rue89getDatas(str_replace('#commentaires', '', ($element->find('comments', 0)->plaintext)));
$item = new \Item(); $item = array();
$item->title = $datas["title"]; $item['title'] = $datas["title"];
$item->author = $datas["author"][0]["name"]; $item['author'] = $datas["author"][0]["name"];
$item->timestamp = $datas["updated"]; $item['timestamp'] = $datas["updated"];
$item->content = $datas["body"]; $item['content'] = $datas["body"];
$item->uri = $datas["url"]; $item['uri'] = $datas["url"];
$this->items[] = $item; $this->items[] = $item;

View file

@ -32,14 +32,14 @@ class Rule34Bridge extends BridgeAbstract{
foreach($html->find('div[class=content] span') as $element) { foreach($html->find('div[class=content] span') as $element) {
$item = new \Item(); $item = array();
$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;
} }
} }

View file

@ -30,14 +30,14 @@ class Rule34pahealBridge extends BridgeAbstract{
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 = array();
$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;
} }
} }

View file

@ -32,14 +32,14 @@ class SafebooruBridge extends BridgeAbstract{
foreach($html->find('div[class=content] span') as $element) { foreach($html->find('div[class=content] span') as $element) {
$item = new \Item(); $item = array();
$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;
} }
} }

View file

@ -34,13 +34,13 @@ class SakugabooruBridge extends BridgeAbstract{
foreach($data as $datai) { foreach($data as $datai) {
$json = json_decode($datai, TRUE); $json = json_decode($datai, TRUE);
$item = new \Item(); $item = array();
$item->uri = 'http://sakuga.yshi.org/post/show/'.$json['id']; $item['uri'] = 'http://sakuga.yshi.org/post/show/'.$json['id'];
$item->postid = $json['id']; $item['postid'] = $json['id'];
$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;
} }
} }

View file

@ -15,9 +15,9 @@ class ScmbBridge extends BridgeAbstract{
$html = $this->getSimpleHTMLDOM('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 = array();
$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;
@ -29,10 +29,10 @@ class ScmbBridge extends BridgeAbstract{
list($y, $m, $d) = explode('-', $date); list($y, $m, $d) = explode('-', $date);
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;
} }
} }

View file

@ -26,10 +26,10 @@ class ScoopItBridge extends BridgeAbstract{
$html = $this->getSimpleHTMLDOM($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 = array();
$item->uri = $element->find('a', 0)->href; $item['uri'] = $element->find('a', 0)->href;
$item->title = preg_replace('~[[:cntrl:]]~', '', $element->find('div.tCustomization_post_title',0)->plaintext); $item['title'] = preg_replace('~[[:cntrl:]]~', '', $element->find('div.tCustomization_post_title',0)->plaintext);
$item->content = preg_replace('~[[:cntrl:]]~', '', $element->find('div.tCustomization_post_description', 0)->plaintext); $item['content'] = preg_replace('~[[:cntrl:]]~', '', $element->find('div.tCustomization_post_description', 0)->plaintext);
$this->items[] = $item; $this->items[] = $item;
} }
} else { } else {

View file

@ -109,16 +109,16 @@ class SensCritiqueBridge extends BridgeAbstract {
} }
foreach ($list->find('li') as $movie) { foreach ($list->find('li') as $movie) {
$item = new \Item(); $item = array();
$item->author = htmlspecialchars_decode($movie->find('.elco-title a', 0)->plaintext, ENT_QUOTES) . ' ' . $movie->find('.elco-date', 0)->plaintext; $item['author'] = htmlspecialchars_decode($movie->find('.elco-title a', 0)->plaintext, ENT_QUOTES) . ' ' . $movie->find('.elco-date', 0)->plaintext;
$item->title = $movie->find('.elco-title a', 0)->plaintext . ' ' . $movie->find('.elco-date', 0)->plaintext; $item['title'] = $movie->find('.elco-title a', 0)->plaintext . ' ' . $movie->find('.elco-date', 0)->plaintext;
$item->content = '<em>' . $movie->find('.elco-original-title', 0)->plaintext . '</em><br><br>' . $item['content'] = '<em>' . $movie->find('.elco-original-title', 0)->plaintext . '</em><br><br>' .
$movie->find('.elco-baseline', 0)->plaintext . '<br>' . $movie->find('.elco-baseline', 0)->plaintext . '<br>' .
$movie->find('.elco-baseline', 1)->plaintext . '<br><br>' . $movie->find('.elco-baseline', 1)->plaintext . '<br><br>' .
$movie->find('.elco-description', 0)->plaintext . '<br><br>' . $movie->find('.elco-description', 0)->plaintext . '<br><br>' .
trim($movie->find('.erra-ratings .erra-global', 0)->plaintext) . ' / 10'; trim($movie->find('.erra-ratings .erra-global', 0)->plaintext) . ' / 10';
$item->id = $this->getURI() . $movie->find('.elco-title a', 0)->href; $item['id'] = $this->getURI() . $movie->find('.elco-title a', 0)->href;
$item->uri = $this->getURI() . $movie->find('.elco-title a', 0)->href; $item['uri'] = $this->getURI() . $movie->find('.elco-title a', 0)->href;
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -23,30 +23,30 @@ $replace = array('January', 'February', 'March', 'April', 'May', 'June', 'July',
// 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
// see stackoverflow for more details : http://stackoverflow.com/a/10828479/15619 // see stackoverflow for more details : http://stackoverflow.com/a/10828479/15619
if(is_object($element)) { if(is_object($element)) {
$item = new Item(); $item = array();
// various metadata // various metadata
$titleBlock = $element->find('.title-holder', 0); $titleBlock = $element->find('.title-holder', 0);
if(is_object($titleBlock)) { if(is_object($titleBlock)) {
$titleDetails = $titleBlock->find('.article-title',0); $titleDetails = $titleBlock->find('.article-title',0);
$titleData = $titleDetails->find('h2', 0)->find('a',0); $titleData = $titleDetails->find('h2', 0)->find('a',0);
$titleTimestamp =$titleDetails->find('h4',0); $titleTimestamp =$titleDetails->find('h4',0);
$item->title = $this->correctCase(trim($titleData->innertext)); $item['title'] = $this->correctCase(trim($titleData->innertext));
$item->uri = $this->uri.$titleData->href; $item['uri'] = $this->uri.$titleData->href;
// Fugly date parsing due to the fact my DNS-323 doesn't support php intl extension // Fugly date parsing due to the fact my DNS-323 doesn't support php intl extension
$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";
$elementText = $element->find('.text-container', 0); $elementText = $element->find('.text-container', 0);
// don't forget to replace images server url with gq one // don't forget to replace images server url with gq one
foreach($elementText->find('img') as $image) { foreach($elementText->find('img') as $image) {
$image->src = $this->uri.$image->src; $image->src = $this->uri.$image->src;
} }
$item->content = $elementText->innertext; $item['content'] = $elementText->innertext;
$this->items[] = $item; $this->items[] = $item;
} }

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