1
0
Fork 0
forked from blallo/rss-bridge

Merge branch 'methods2functions' of https://framagit.org/peetah/rss-bridge

This commit is contained in:
logmanoriginal 2016-10-02 16:05:58 +02:00
commit 970e216c1f
114 changed files with 899 additions and 904 deletions

View file

@ -8,7 +8,7 @@ class ABCTabsBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = ''; $html = '';
$html = $this->getSimpleHTMLDOM(static::URI.'tablatures/nouveautes.html') or $this->returnClientError('No results for this query.'); $html = getSimpleHTMLDOM(static::URI.'tablatures/nouveautes.html') or returnClientError('No results for this query.');
$table = $html->find('table#myTable', 0)->children(1); $table = $html->find('table#myTable', 0)->children(1);
foreach ($table->find('tr') as $tab) foreach ($table->find('tr') as $tab)

View file

@ -14,10 +14,9 @@ class AcrimedBridge extends FeedExpander {
protected function parseItem($newsItem){ protected function parseItem($newsItem){
$item = parent::parseItem($newsItem); $item = parent::parseItem($newsItem);
$hs = new HTMLSanitizer(); $articlePage = getSimpleHTMLDOM($newsItem->link);
$articlePage = $this->getSimpleHTMLDOM($newsItem->link); $article = sanitize($articlePage->find('article.article1', 0)->innertext);
$article = $hs->sanitize($articlePage->find('article.article1', 0)->innertext); $article = defaultImageSrcTo($article, static::URI);
$article = HTMLSanitizer::defaultImageSrcTo($article, static::URI);
$item['content'] = $article; $item['content'] = $article;
return $item; return $item;

View file

@ -48,8 +48,8 @@ class AllocineFRBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->getURI()) $html = getSimpleHTMLDOM($this->getURI())
or $this->returnServerError("Could not request ".$this->getURI()." !"); or returnServerError("Could not request ".$this->getURI()." !");
$category=array_search( $category=array_search(
$this->getInput('category'), $this->getInput('category'),

View file

@ -39,8 +39,8 @@ class AnimeUltimeBridge extends BridgeAbstract {
//Retrive page contents //Retrive page contents
$url = self::URI.'history-0-1/'.$requestFilter; $url = self::URI.'history-0-1/'.$requestFilter;
$html = $this->getSimpleHTMLDOM($url) $html = getSimpleHTMLDOM($url)
or $this->returnServerError('Could not request Anime-Ultime: '.$url); or returnServerError('Could not request Anime-Ultime: '.$url);
//Relases are sorted by day : process each day individually //Relases are sorted by day : process each day individually
foreach ($html->find('div.history', 0)->find('h3') as $daySection) { foreach ($html->find('div.history', 0)->find('h3') as $daySection) {
@ -68,8 +68,8 @@ class AnimeUltimeBridge extends BridgeAbstract {
if (!empty($item_uri)) { if (!empty($item_uri)) {
//Retrieve description from description page and convert relative image src info absolute image src //Retrieve description from description page and convert relative image src info absolute image src
$html_item = $this->getContents($item_uri) $html_item = getContents($item_uri)
or $this->returnServerError('Could not request Anime-Ultime: '.$item_uri); or returnServerError('Could not request Anime-Ultime: '.$item_uri);
$item_description = substr( $item_description = substr(
$html_item, $html_item,
strpos($html_item, 'class="principal_contain" align="center">') strpos($html_item, 'class="principal_contain" align="center">')

View file

@ -58,7 +58,7 @@
} }
$url = self::URI.'guide/'.$lang.'/plus7/'.$category; $url = self::URI.'guide/'.$lang.'/plus7/'.$category;
$input = $this->getContents($url) or die('Could not request ARTE.'); $input = getContents($url) or die('Could not request ARTE.');
if(strpos($input, 'categoryVideoSet') !== FALSE){ if(strpos($input, 'categoryVideoSet') !== FALSE){
$input = explode('categoryVideoSet: ', $input); $input = explode('categoryVideoSet: ', $input);
$input = explode('}},', $input[1]); $input = explode('}},', $input[1]);

View file

@ -16,8 +16,8 @@ class AskfmBridge extends BridgeAbstract{
); );
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->getURI()) $html = getSimpleHTMLDOM($this->getURI())
or $this->returnServerError('Requested username can\'t be found.'); or returnServerError('Requested username can\'t be found.');
foreach($html->find('div.streamItem-answer') as $element) { foreach($html->find('div.streamItem-answer') as $element) {
$item = array(); $item = array();

View file

@ -15,8 +15,8 @@ class BandcampBridge extends BridgeAbstract{
)); ));
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->getURI()) $html = getSimpleHTMLDOM($this->getURI())
or $this->returnServerError('No results for this query.'); or returnServerError('No results for this query.');
foreach($html->find('li.item') as $release) { foreach($html->find('li.item') as $release) {
$script = $release->find('div.art', 0)->getAttribute('onclick'); $script = $release->find('div.art', 0)->getAttribute('onclick');

View file

@ -12,8 +12,8 @@ class BastaBridge extends BridgeAbstract{
return preg_replace('/src=["\']{1}([^"\']+)/ims', 'src=\''.self::URI.'$1\'', $content); return preg_replace('/src=["\']{1}([^"\']+)/ims', 'src=\''.self::URI.'$1\'', $content);
} }
$html = $this->getSimpleHTMLDOM(self::URI.'spip.php?page=backend') $html = getSimpleHTMLDOM(self::URI.'spip.php?page=backend')
or $this->returnServerError('Could not request Bastamag.'); or returnServerError('Could not request Bastamag.');
$limit = 0; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {
@ -22,7 +22,7 @@ class BastaBridge extends BridgeAbstract{
$item['title'] = $element->find('title', 0)->innertext; $item['title'] = $element->find('title', 0)->innertext;
$item['uri'] = $element->find('guid', 0)->plaintext; $item['uri'] = $element->find('guid', 0)->plaintext;
$item['timestamp'] = strtotime($element->find('dc:date', 0)->plaintext); $item['timestamp'] = strtotime($element->find('dc:date', 0)->plaintext);
$item['content'] = ReplaceImageUrl($this->getSimpleHTMLDOM($item['uri'])->find('div.texte', 0)->innertext); $item['content'] = ReplaceImageUrl(getSimpleHTMLDOM($item['uri'])->find('div.texte', 0)->innertext);
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;
} }

View file

@ -9,8 +9,8 @@ class BlaguesDeMerdeBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM(self::URI) $html = getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Could not request BDM.'); or returnServerError('Could not request BDM.');
foreach($html->find('article.joke_contener') as $element) { foreach($html->find('article.joke_contener') as $element) {
$item = array(); $item = array();

View file

@ -17,7 +17,7 @@ class CADBridge extends FeedExpander {
} }
private function CADExtractContent($url) { private function CADExtractContent($url) {
$html3 = $this->getSimpleHTMLDOMCached($url); $html3 = getSimpleHTMLDOMCached($url);
// The request might fail due to missing https support or wrong URL // The request might fail due to missing https support or wrong URL
if($html3 == false) if($html3 == false)

View file

@ -39,7 +39,7 @@ class CNETBridge extends BridgeAbstract {
} }
$pageUrl = self::URI.(empty($this->getInput('topic')) ? '' : 'topics/'.$this->getInput('topic').'/'); $pageUrl = self::URI.(empty($this->getInput('topic')) ? '' : 'topics/'.$this->getInput('topic').'/');
$html = $this->getSimpleHTMLDOM($pageUrl) or $this->returnServerError('Could not request CNET: '.$pageUrl); $html = getSimpleHTMLDOM($pageUrl) or returnServerError('Could not request CNET: '.$pageUrl);
$limit = 0; $limit = 0;
foreach($html->find('div.assetBody') as $element) { foreach($html->find('div.assetBody') as $element) {
@ -52,7 +52,7 @@ class CNETBridge extends BridgeAbstract {
if (!empty($article_title) && !empty($article_uri) && strpos($article_uri, '/news/') !== false) { if (!empty($article_title) && !empty($article_uri) && strpos($article_uri, '/news/') !== false) {
$article_html = $this->getSimpleHTMLDOM($article_uri) or $this->returnServerError('Could not request CNET: '.$article_uri); $article_html = getSimpleHTMLDOM($article_uri) or returnServerError('Could not request CNET: '.$article_uri);
$article_content = trim(CleanArticle(ExtractFromDelimiters($article_html, '<div class="articleContent', '<footer>'))); $article_content = trim(CleanArticle(ExtractFromDelimiters($article_html, '<div class="articleContent', '<footer>')));

View file

@ -33,7 +33,7 @@ class CastorusBridge extends BridgeAbstract {
$title = $activity->find('a', 0); $title = $activity->find('a', 0);
if(!$title) if(!$title)
$this->returnServerError('Cannot find title!'); returnServerError('Cannot find title!');
return htmlspecialchars(trim($title->plaintext)); return htmlspecialchars(trim($title->plaintext));
} }
@ -43,7 +43,7 @@ class CastorusBridge extends BridgeAbstract {
$url = $activity->find('a', 0); $url = $activity->find('a', 0);
if(!$url) if(!$url)
$this->returnServerError('Cannot find url!'); returnServerError('Cannot find url!');
return self::URI . $url->href; return self::URI . $url->href;
} }
@ -55,7 +55,7 @@ class CastorusBridge extends BridgeAbstract {
$nodes = $activity->find('*'); $nodes = $activity->find('*');
if(!$nodes) if(!$nodes)
$this->returnServerError('Cannot find nodes!'); returnServerError('Cannot find nodes!');
foreach($nodes as $node){ foreach($nodes as $node){
$node->outertext = ''; $node->outertext = '';
@ -69,7 +69,7 @@ class CastorusBridge extends BridgeAbstract {
$price = $activity->find('span', 1); $price = $activity->find('span', 1);
if(!$price) if(!$price)
$this->returnServerError('Cannot find price!'); returnServerError('Cannot find price!');
return $price->innertext; return $price->innertext;
} }
@ -78,15 +78,15 @@ class CastorusBridge extends BridgeAbstract {
$zip_filter = trim($this->getInput('zip')); $zip_filter = trim($this->getInput('zip'));
$city_filter = trim($this->getInput('city')); $city_filter = trim($this->getInput('city'));
$html = $this->getSimpleHTMLDOM(self::URI); $html = getSimpleHTMLDOM(self::URI);
if(!$html) if(!$html)
$this->returnServerError('Could not load data from ' . self::URI . '!'); returnServerError('Could not load data from ' . self::URI . '!');
$activities = $html->find('div#activite/li'); $activities = $html->find('div#activite/li');
if(!$activities) if(!$activities)
$this->returnServerError('Failed to find activities!'); returnServerError('Failed to find activities!');
foreach($activities as $activity){ foreach($activities as $activity){
$item = array(); $item = array();

View file

@ -31,8 +31,8 @@ class CollegeDeFranceBridge extends BridgeAbstract{
* </a> * </a>
* </li> * </li>
*/ */
$html = $this->getSimpleHTMLDOM(self::URI.'components/search-audiovideo.jsp?fulltext=&siteid=1156951719600&lang=FR&type=all') $html = getSimpleHTMLDOM(self::URI.'components/search-audiovideo.jsp?fulltext=&siteid=1156951719600&lang=FR&type=all')
or $this->returnServerError('Could not request CollegeDeFrance.'); or returnServerError('Could not request CollegeDeFrance.');
foreach($html->find('a[data-target]') as $element) { foreach($html->find('a[data-target]') as $element) {
$item = array(); $item = array();
$item['title'] = $element->find('.title', 0)->plaintext; $item['title'] = $element->find('.title', 0)->plaintext;

View file

@ -17,7 +17,7 @@ class CommonDreamsBridge extends FeedExpander {
} }
private function CommonDreamsExtractContent($url) { private function CommonDreamsExtractContent($url) {
$html3 = $this->getSimpleHTMLDOMCached($url); $html3 = getSimpleHTMLDOMCached($url);
$text = $html3->find('div[class=field--type-text-with-summary]', 0)->innertext; $text = $html3->find('div[class=field--type-text-with-summary]', 0)->innertext;
$html3->clear(); $html3->clear();
unset ($html3); unset ($html3);

View file

@ -8,8 +8,8 @@ class CopieDoubleBridge extends BridgeAbstract{
const DESCRIPTION = "CopieDouble"; const DESCRIPTION = "CopieDouble";
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM(self::URI) $html = getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Could not request CopieDouble.'); or returnServerError('Could not request CopieDouble.');
$table = $html->find('table table', 2); $table = $html->find('table table', 2);
foreach($table->find('tr') as $element) foreach($table->find('tr') as $element)

View file

@ -9,8 +9,8 @@ class CourrierInternationalBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM(self::URI) $html = getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Error.'); or returnServerError('Error.');
$element = $html->find("article"); $element = $html->find("article");
@ -26,11 +26,9 @@ class CourrierInternationalBridge extends BridgeAbstract{
$item['uri'] = self::URI.$item['uri']; $item['uri'] = self::URI.$item['uri'];
} }
$page = $this->getSimpleHTMLDOM($item['uri']); $page = getSimpleHTMLDOM($item['uri']);
$cleaner = new HTMLSanitizer(); $item['content'] = 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]);

View file

@ -17,14 +17,14 @@ class CpasbienBridge extends BridgeAbstract {
public function collectData(){ public function collectData(){
$request = str_replace(" ","-",trim($this->getInput('q'))); $request = str_replace(" ","-",trim($this->getInput('q')));
$html = $this->getSimpleHTMLDOM(self::URI.'/recherche/'.urlencode($request).'.html') $html = getSimpleHTMLDOM(self::URI.'/recherche/'.urlencode($request).'.html')
or $this->returnServerError('No results for this query.'); or returnServerError('No results for this query.');
foreach ($html->find('#gauche',0)->find('div') as $episode) { foreach ($html->find('#gauche',0)->find('div') as $episode) {
if ($episode->getAttribute('class')=='ligne0' || if ($episode->getAttribute('class')=='ligne0' ||
$episode->getAttribute('class')=='ligne1') $episode->getAttribute('class')=='ligne1')
{ {
$htmlepisode=$this->getSimpleHTMLDOMCached($episode->find('a', 0)->getAttribute('href')); $htmlepisode=getSimpleHTMLDOMCached($episode->find('a', 0)->getAttribute('href'));
$item = array(); $item = array();
$item['author'] = $episode->find('a', 0)->text(); $item['author'] = $episode->find('a', 0)->text();

View file

@ -17,8 +17,8 @@ class CryptomeBridge extends BridgeAbstract{
)); ));
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM(self::URI) $html = getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Could not request Cryptome.'); or returnServerError('Could not request Cryptome.');
$number=$this->getInput('n'); $number=$this->getInput('n');
if (!empty($number)) { /* number of documents */ if (!empty($number)) { /* number of documents */
$num = min($number, 20); $num = min($number, 20);

View file

@ -36,7 +36,7 @@ class DailymotionBridge extends BridgeAbstract{
function getMetadata($id) { function getMetadata($id) {
$metadata=array(); $metadata=array();
$html2 = $this->getSimpleHTMLDOM(self::URI.'video/'.$id); $html2 = getSimpleHTMLDOM(self::URI.'video/'.$id);
if(!$html2){ if(!$html2){
return $metadata; return $metadata;
} }
@ -53,8 +53,8 @@ class DailymotionBridge extends BridgeAbstract{
$limit = 5; $limit = 5;
$count = 0; $count = 0;
$html = $this->getSimpleHTMLDOM($this->getURI()) $html = getSimpleHTMLDOM($this->getURI())
or $this->returnServerError('Could not request Dailymotion.'); or returnServerError('Could not request Dailymotion.');
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) {

View file

@ -41,8 +41,8 @@ class DanbooruBridge extends BridgeAbstract{
} }
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->getFullURI()) $html = getSimpleHTMLDOM($this->getFullURI())
or $this->returnServerError('Could not request '.$this->getName()); or returnServerError('Could not request '.$this->getName());
foreach($html->find(static::PATHTODATA) as $element) { foreach($html->find(static::PATHTODATA) as $element) {
$this->items[] = $this->getItemFromElement($element); $this->items[] = $this->getItemFromElement($element);

View file

@ -9,8 +9,8 @@ class DansTonChatBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM(self::URI.'latest.html') $html = getSimpleHTMLDOM(self::URI.'latest.html')
or $this->returnServerError('Could not request DansTonChat.'); or returnServerError('Could not request DansTonChat.');
foreach($html->find('div.item') as $element) { foreach($html->find('div.item') as $element) {
$item = array(); $item = array();

View file

@ -48,7 +48,7 @@ class DauphineLibereBridge extends FeedExpander {
} }
private function ExtractContent($url) { private function ExtractContent($url) {
$html2 = $this->getSimpleHTMLDOMCached($url); $html2 = getSimpleHTMLDOMCached($url);
$text = $html2->find('div.column', 0)->innertext; $text = $html2->find('div.column', 0)->innertext;
$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text); $text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
return $text; return $text;

View file

@ -43,7 +43,7 @@ class DeveloppezDotComBridge extends FeedExpander {
} }
private function DeveloppezDotComExtractContent($url) { private function DeveloppezDotComExtractContent($url) {
$articleHTMLContent = $this->getSimpleHTMLDOMCached($url); $articleHTMLContent = getSimpleHTMLDOMCached($url);
$text = $this->convert_smart_quotes($articleHTMLContent->find('div.content', 0)->innertext); $text = $this->convert_smart_quotes($articleHTMLContent->find('div.content', 0)->innertext);
$text = utf8_encode($text); $text = utf8_encode($text);
return trim($text); return trim($text);

View file

@ -9,7 +9,7 @@ class DilbertBridge extends BridgeAbstract {
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->getURI()) or $this->returnServerError('Could not request Dilbert: '.$this->getURI()); $html = getSimpleHTMLDOM($this->getURI()) or returnServerError('Could not request Dilbert: '.$this->getURI());
foreach ($html->find('section.comic-item') as $element) { foreach ($html->find('section.comic-item') as $element) {

View file

@ -14,8 +14,8 @@ class DuckDuckGoBridge extends BridgeAbstract{
)); ));
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM(self::URI.'html/?q='.$this->getInput('u').'+sort:date') $html = getSimpleHTMLDOM(self::URI.'html/?q='.$this->getInput('u').'+sort:date')
or $this->returnServerError('Could not request DuckDuckGo.'); or returnServerError('Could not request DuckDuckGo.');
foreach($html->find('div.results_links') as $element) { foreach($html->find('div.results_links') as $element) {
$item = array(); $item = array();

View file

@ -34,8 +34,8 @@ class EZTVBridge extends BridgeAbstract{
foreach($showList as $showID){ foreach($showList as $showID){
// Get show page // Get show page
$html = $this->getSimpleHTMLDOM(self::URI.'shows/'.rawurlencode($showID).'/') $html = getSimpleHTMLDOM(self::URI.'shows/'.rawurlencode($showID).'/')
or $this->returnServerError('Could not request EZTV for id "'.$showID.'"'); or returnServerError('Could not request EZTV for id "'.$showID.'"');
// Loop on each element that look like an episode entry... // Loop on each element that look like an episode entry...
foreach($html->find('.forum_header_border') as $element) { foreach($html->find('.forum_header_border') as $element) {

View file

@ -9,8 +9,8 @@ class EliteDangerousGalnetBridge extends BridgeAbstract
public function collectData() public function collectData()
{ {
$html = $this->getSimpleHTMLDOM(self::URI) $html = getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Error while downloading the website content'); or returnServerError('Error while downloading the website content');
foreach($html->find('div.article') as $element) { foreach($html->find('div.article') as $element) {
$item = array(); $item = array();

View file

@ -58,7 +58,7 @@ class ElsevierBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$uri = self::URI . $this->getInput('j') . '/recent-articles/'; $uri = self::URI . $this->getInput('j') . '/recent-articles/';
$html = $this->getSimpleHTMLDOM($uri) or $this->returnServerError('No results for Elsevier journal '.$this->getInput('j')); $html = getSimpleHTMLDOM($uri) or returnServerError('No results for Elsevier journal '.$this->getInput('j'));
foreach($html->find('.pod-listing') as $article){ foreach($html->find('.pod-listing') as $article){
$item = array(); $item = array();

View file

@ -16,7 +16,7 @@ class EstCeQuonMetEnProdBridge extends BridgeAbstract {
} return false; } return false;
} }
$html = $this->getSimpleHTMLDOM($this->getURI()) or $this->returnServerError('Could not request EstCeQuonMetEnProd: '.$this->getURI()); $html = getSimpleHTMLDOM($this->getURI()) or returnServerError('Could not request EstCeQuonMetEnProd: '.$this->getURI());
$item = array(); $item = array();
$item['uri'] = $this->getURI().'#'.date('Y-m-d'); $item['uri'] = $this->getURI().'#'.date('Y-m-d');

View file

@ -93,8 +93,8 @@ class FacebookBridge extends BridgeAbstract{
), ),
); );
$context = stream_context_create($http_options); $context = stream_context_create($http_options);
$html = $this->getContents($captcha_action, false, $context); $html = getContents($captcha_action, false, $context);
if ($html === FALSE) { $this->returnServerError('Failed to submit captcha response back to Facebook'); } if ($html === FALSE) { returnServerError('Failed to submit captcha response back to Facebook'); }
unset($_SESSION['captcha_fields']); unset($_SESSION['captcha_fields']);
$html = str_get_html($html); $html = str_get_html($html);
} }
@ -105,11 +105,11 @@ class FacebookBridge extends BridgeAbstract{
//Retrieve page contents //Retrieve page contents
if (is_null($html)) { if (is_null($html)) {
if (!strpos($this->getInput('u'), "/")) { if (!strpos($this->getInput('u'), "/")) {
$html = $this->getSimpleHTMLDOM(self::URI.urlencode($this->getInput('u')).'?_fb_noscript=1') $html = getSimpleHTMLDOM(self::URI.urlencode($this->getInput('u')).'?_fb_noscript=1')
or $this->returnServerError('No results for this query.'); or returnServerError('No results for this query.');
} else { } else {
$html = $this->getSimpleHTMLDOM(self::URI.'pages/'.$this->getInput('u').'?_fb_noscript=1') $html = getSimpleHTMLDOM(self::URI.'pages/'.$this->getInput('u').'?_fb_noscript=1')
or $this->returnServerError('No results for this query.'); or returnServerError('No results for this query.');
} }
} }
@ -127,7 +127,7 @@ class FacebookBridge extends BridgeAbstract{
$_SESSION['captcha_action'] = self::URI.$captcha->find('form', 0)->action; $_SESSION['captcha_action'] = self::URI.$captcha->find('form', 0)->action;
//Show captcha filling form to the viewer, proxying the captcha image //Show captcha filling form to the viewer, proxying the captcha image
$img = base64_encode($this->getContents($captcha->find('img', 0)->src)); $img = base64_encode(getContents($captcha->find('img', 0)->src));
header('HTTP/1.1 500 '.Http::getMessageForCode(500)); header('HTTP/1.1 500 '.Http::getMessageForCode(500));
header('Content-Type: text/html'); header('Content-Type: text/html');
die('<form method="post" action="?'.$_SERVER['QUERY_STRING'].'">' die('<form method="post" action="?'.$_SERVER['QUERY_STRING'].'">'

View file

@ -38,7 +38,7 @@ class FeedExpanderExampleBridge extends FeedExpander {
case 'atom_1_0': case 'atom_1_0':
parent::collectExpandableDatas('http://segfault.linuxmint.com/feed/atom/'); parent::collectExpandableDatas('http://segfault.linuxmint.com/feed/atom/');
break; break;
default: $this->returnClientError('Unknown version ' . $this->getInput('version') . '!'); default: returnClientError('Unknown version ' . $this->getInput('version') . '!');
} }
} }
@ -56,7 +56,7 @@ class FeedExpanderExampleBridge extends FeedExpander {
case 'atom_1_0': case 'atom_1_0':
return $this->parseATOMItem($newsItem); return $this->parseATOMItem($newsItem);
break; break;
default: $this->returnClientError('Unknown version ' . $this->getInput('version') . '!'); default: returnClientError('Unknown version ' . $this->getInput('version') . '!');
} }
} }
} }

View file

@ -8,7 +8,7 @@ class FierPandaBridge extends BridgeAbstract {
const DESCRIPTION = "Returns latest articles from Fier Panda."; const DESCRIPTION = "Returns latest articles from Fier Panda.";
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM(self::URI) or $this->returnServerError('Could not request Fier Panda.'); $html = getSimpleHTMLDOM(self::URI) or 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 = array(); $item = array();

View file

@ -8,8 +8,8 @@ class FlickrExploreBridge extends BridgeAbstract{
const DESCRIPTION = "Returns the latest interesting images from Flickr"; const DESCRIPTION = "Returns the latest interesting images from Flickr";
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM(self::URI.'explore') $html = getSimpleHTMLDOM(self::URI.'explore')
or $this->returnServerError('Could not request Flickr.'); or returnServerError('Could not request Flickr.');
foreach($html->find('.photo-list-photo-view') as $element) { foreach($html->find('.photo-list-photo-view') as $element) {
// Get the styles // Get the styles
@ -23,14 +23,14 @@ class FlickrExploreBridge extends BridgeAbstract{
$imageID = reset($imageURIs); $imageID = reset($imageURIs);
// Get the image JSON via Flickr API // Get the image JSON via Flickr API
$imageJSON = json_decode($this->getContents( $imageJSON = json_decode(getContents(
'https://api.flickr.com/services/rest/?' 'https://api.flickr.com/services/rest/?'
.'method=flickr.photos.getInfo&' .'method=flickr.photos.getInfo&'
.'api_key=103b574d49bd51f0e18bfe907da44a0f&' .'api_key=103b574d49bd51f0e18bfe907da44a0f&'
.'photo_id='.$imageID.'&' .'photo_id='.$imageID.'&'
.'format=json&' .'format=json&'
.'nojsoncallback=1' .'nojsoncallback=1'
)) or $this->returnServerError('Could not request Flickr.'); // FIXME: Request time too long... )) or returnServerError('Could not request Flickr.'); // FIXME: Request time too long...
$item = array(); $item = array();
$item['uri'] = self::URI.'photo.gne?id='.$imageID; $item['uri'] = self::URI.'photo.gne?id='.$imageID;

View file

@ -26,12 +26,12 @@ class FlickrTagBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
switch($this->queriedContext){ switch($this->queriedContext){
case 'By keyword': case 'By keyword':
$html = $this->getSimpleHTMLDOM(self::URI.'search/?q='.urlencode($this->getInput('q')).'&s=rec') $html = getSimpleHTMLDOM(self::URI.'search/?q='.urlencode($this->getInput('q')).'&s=rec')
or $this->returnServerError('No results for this query.'); or returnServerError('No results for this query.');
break; break;
case 'by username': case 'by username':
$html = $this->getSimpleHTMLDOM(self::URI.'photos/'.urlencode($this->getInput('u')).'/') $html = getSimpleHTMLDOM(self::URI.'photos/'.urlencode($this->getInput('u')).'/')
or $this->returnServerError('Requested username can\'t be found.'); or returnServerError('Requested username can\'t be found.');
break; break;
} }

View file

@ -7,8 +7,8 @@ class FootitoBridge extends BridgeAbstract{
const DESCRIPTION = "Footito"; const DESCRIPTION = "Footito";
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM(self::URI) $html = getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Could not request Footito.'); or returnServerError('Could not request Footito.');
foreach($html->find('div.post') as $element) { foreach($html->find('div.post') as $element) {
$item = array(); $item = array();

View file

@ -26,8 +26,8 @@ class FourchanBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->getURI()) $html = getSimpleHTMLDOM($this->getURI())
or $this->returnServerError("Could not request 4chan, thread not found"); or returnServerError("Could not request 4chan, thread not found");
foreach($html->find('div.postContainer') as $element) { foreach($html->find('div.postContainer') as $element) {
$item = array(); $item = array();

View file

@ -86,8 +86,8 @@ class FuturaSciencesBridge extends FeedExpander {
protected function parseItem($newsItem){ protected function parseItem($newsItem){
$item = parent::parseItem($newsItem); $item = parent::parseItem($newsItem);
$item['uri'] = str_replace('#xtor=RSS-8', '', $item['uri']); $item['uri'] = str_replace('#xtor=RSS-8', '', $item['uri']);
$article = $this->getSimpleHTMLDOMCached($item['uri']) $article = getSimpleHTMLDOMCached($item['uri'])
or $this->returnServerError('Could not request Futura-Sciences: ' . $item['uri']); or returnServerError('Could not request Futura-Sciences: ' . $item['uri']);
$item['content'] = $this->ExtractArticleContent($article); $item['content'] = $this->ExtractArticleContent($article);
$item['author'] = empty($this->ExtractAuthor($article)) ? $item['author'] : $this->ExtractAuthor($article); $item['author'] = empty($this->ExtractAuthor($article)) ? $item['author'] : $this->ExtractAuthor($article);
return $item; return $item;

View file

@ -54,7 +54,7 @@ class GBAtempBridge extends BridgeAbstract {
} }
private function fetch_post_content($uri, $site_url) { private function fetch_post_content($uri, $site_url) {
$html = $this->getSimpleHTMLDOM($uri); $html = getSimpleHTMLDOM($uri);
if(!$html){ if(!$html){
return 'Could not request GBAtemp '.$uri; return 'Could not request GBAtemp '.$uri;
} }
@ -65,8 +65,8 @@ class GBAtempBridge extends BridgeAbstract {
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM(self::URI) $html = getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Could not request GBAtemp.'); or returnServerError('Could not request GBAtemp.');
switch($this->getInput('type')){ switch($this->getInput('type')){
case 'N': case 'N':
@ -82,7 +82,7 @@ class GBAtempBridge extends BridgeAbstract {
foreach ($html->find('li.portal_review') as $reviewItem) { foreach ($html->find('li.portal_review') as $reviewItem) {
$url = self::URI.$reviewItem->find('a', 0)->href; $url = self::URI.$reviewItem->find('a', 0)->href;
$title = $reviewItem->find('span.review_title', 0)->plaintext; $title = $reviewItem->find('span.review_title', 0)->plaintext;
$content = $this->getSimpleHTMLDOM($url) or $this->returnServerError('Could not request GBAtemp: '.$uri); $content = getSimpleHTMLDOM($url) or returnServerError('Could not request GBAtemp: '.$uri);
$author = $content->find('a.username', 0)->plaintext; $author = $content->find('a.username', 0)->plaintext;
$time = intval($this->ExtractFromDelimiters($content->find('abbr.DateTime', 0)->outertext, 'data-time="', '"')); $time = intval($this->ExtractFromDelimiters($content->find('abbr.DateTime', 0)->outertext, 'data-time="', '"'));
$intro = '<p><b>'.($content->find('div#review_intro', 0)->plaintext).'</b></p>'; $intro = '<p><b>'.($content->find('div#review_intro', 0)->plaintext).'</b></p>';

View file

@ -23,8 +23,8 @@ class GiphyBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = ''; $html = '';
$base_url = 'http://giphy.com'; $base_url = 'http://giphy.com';
$html = $this->getSimpleHTMLDOM(self::URI.'/search/'.urlencode($this->getInput('s').'/')) $html = getSimpleHTMLDOM(self::URI.'/search/'.urlencode($this->getInput('s').'/'))
or $this->returnServerError('No results for this query.'); or returnServerError('No results for this query.');
$max = GIPHY_LIMIT; $max = GIPHY_LIMIT;
if ($this->getInput('n')) { if ($this->getInput('n')) {
@ -38,8 +38,8 @@ class GiphyBridge extends BridgeAbstract{
$node = $entry->first_child(); $node = $entry->first_child();
$href = $node->getAttribute('href'); $href = $node->getAttribute('href');
$html2 = $this->getSimpleHTMLDOM(self::URI . $href) $html2 = getSimpleHTMLDOM(self::URI . $href)
or $this->returnServerError('No results for this query.'); or returnServerError('No results for this query.');
$figure = $html2->getElementByTagName('figure'); $figure = $html2->getElementByTagName('figure');
$img = $figure->firstChild(); $img = $figure->firstChild();
$caption = $figure->lastChild(); $caption = $figure->lastChild();

View file

@ -136,8 +136,8 @@ class GithubIssueBridge extends BridgeAbstract{
} }
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->getURI()) $html = getSimpleHTMLDOM($this->getURI())
or $this->returnServerError('No results for Github Issue '.$this->getURI()); or returnServerError('No results for Github Issue '.$this->getURI());
switch($this->queriedContext){ switch($this->queriedContext){
case 'Issue comments': case 'Issue comments':
@ -153,7 +153,7 @@ class GithubIssueBridge extends BridgeAbstract{
if($this->getInput('c')){ if($this->getInput('c')){
$uri=static::URI.$this->getInput('u').'/'.$this->getInput('p').'/issues/'.$issueNbr; $uri=static::URI.$this->getInput('u').'/'.$this->getInput('p').'/issues/'.$issueNbr;
$issue=$this->getSimpleHTMLDOMCached($uri,static::CACHE_TIMEOUT); $issue=getSimpleHTMLDOMCached($uri,static::CACHE_TIMEOUT);
if($issue){ if($issue){
$this->items=array_merge($this->items,$this->extractIssueComments($issue)); $this->items=array_merge($this->items,$this->extractIssueComments($issue));
continue; continue;

View file

@ -10,7 +10,7 @@ class GizmodoBridge extends FeedExpander {
protected function parseItem($item){ protected function parseItem($item){
$item = parent::parseItem($item); $item = parent::parseItem($item);
$articleHTMLContent = $this->getSimpleHTMLDOMCached($item['uri']); $articleHTMLContent = getSimpleHTMLDOMCached($item['uri']);
if(!$articleHTMLContent){ if(!$articleHTMLContent){
$text = 'Could not load '.$item['uri']; $text = 'Could not load '.$item['uri'];
}else{ }else{

View file

@ -20,13 +20,13 @@ class GooglePlusPostBridge extends BridgeAbstract
public function collectData() public function collectData()
{ {
// get content parsed // get content parsed
// $html = $this->getSimpleHTMLDOM(__DIR__ . '/../posts2.html' // $html = getSimpleHTMLDOM(__DIR__ . '/../posts2.html'
$html = $this->getSimpleHTMLDOM(self::URI . urlencode($this->getInput('username')) . '/posts' $html = getSimpleHTMLDOM(self::URI . urlencode($this->getInput('username')) . '/posts'
// force language // force language
, false, stream_context_create(array('http'=> array( , false, stream_context_create(array('http'=> array(
'header' => 'Accept-Language: fr,fr-be,fr-fr;q=0.8,en;q=0.4,en-us;q=0.2;*' . "\r\n" 'header' => 'Accept-Language: fr,fr-be,fr-fr;q=0.8,en;q=0.4,en-us;q=0.2;*' . "\r\n"
))) )))
) OR $this->returnServerError('No results for this query.'); ) OR returnServerError('No results for this query.');
// get title, url, ... there is a lot of intresting stuff in meta // get title, url, ... there is a lot of intresting stuff in meta
$this->_title = $html->find('meta[property]', 0)->getAttribute('content'); $this->_title = $html->find('meta[property]', 0)->getAttribute('content');

View file

@ -26,10 +26,10 @@ class GoogleSearchBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = ''; $html = '';
$html = $this->getSimpleHTMLDOM(self::URI $html = getSimpleHTMLDOM(self::URI
.'search?q=' . urlencode($this->getInput('q')) .'search?q=' . urlencode($this->getInput('q'))
.'&num=100&complete=0&tbs=qdr:y,sbd:1') .'&num=100&complete=0&tbs=qdr:y,sbd:1')
or $this->returnServerError('No results for this query.'); or returnServerError('No results for this query.');
$emIsRes = $html->find('div[id=ires]',0); $emIsRes = $html->find('div[id=ires]',0);
if( !is_null($emIsRes) ){ if( !is_null($emIsRes) ){

View file

@ -31,7 +31,7 @@ class HDWallpapersBridge extends BridgeAbstract {
for ($page = 1; $page <= $lastpage; $page++) { for ($page = 1; $page <= $lastpage; $page++) {
$link = self::URI.'/'.$category.'/page/'.$page; $link = self::URI.'/'.$category.'/page/'.$page;
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('No results for this query.'); $html = getSimpleHTMLDOM($link) or returnServerError('No results for this query.');
if ($page === 1) { if ($page === 1) {
preg_match('/page\/(\d+)$/', $html->find('.pagination a', -2)->href, $matches); preg_match('/page\/(\d+)$/', $html->find('.pagination a', -2)->href, $matches);

View file

@ -8,8 +8,8 @@ class HentaiHavenBridge extends BridgeAbstract{
const DESCRIPTION = "Returns releases from Hentai Haven"; const DESCRIPTION = "Returns releases from Hentai Haven";
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM(self::URI) $html = getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Could not request Hentai Haven.'); or returnServerError('Could not request Hentai Haven.');
foreach($html->find('div.zoe-grid') as $element) { foreach($html->find('div.zoe-grid') as $element) {
$item = array(); $item = array();
$item['uri'] = $element->find('div.brick-content h3 a', 0)->href; $item['uri'] = $element->find('div.brick-content h3 a', 0)->href;

View file

@ -15,8 +15,8 @@ class IdenticaBridge extends BridgeAbstract{
)); ));
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->getURI()) $html = getSimpleHTMLDOM($this->getURI())
or $this->returnServerError('Requested username can\'t be found.'); or returnServerError('Requested username can\'t be found.');
foreach($html->find('li.major') as $dent) { foreach($html->find('li.major') as $dent) {
$item = array(); $item = array();

View file

@ -14,8 +14,8 @@ class InstagramBridge extends BridgeAbstract{
)); ));
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->getURI()) $html = getSimpleHTMLDOM($this->getURI())
or $this->returnServerError('Could not request Instagram.'); or returnServerError('Could not request Instagram.');
$innertext = null; $innertext = null;

View file

@ -205,21 +205,21 @@ class IsoHuntBridge extends BridgeAbstract{
private function get_movie_torrents($html){ private function get_movie_torrents($html){
$container = $html->find('div#w0', 0); $container = $html->find('div#w0', 0);
if(!$container) if(!$container)
$this->returnServerError('Unable to find torrent container!'); returnServerError('Unable to find torrent container!');
$torrents = $container->find('article'); $torrents = $container->find('article');
if(!$torrents) if(!$torrents)
$this->returnServerError('Unable to find torrents!'); returnServerError('Unable to find torrents!');
foreach($torrents as $torrent){ foreach($torrents as $torrent){
$anchor = $torrent->find('a', 0); $anchor = $torrent->find('a', 0);
if(!$anchor) if(!$anchor)
$this->returnServerError('Unable to find anchor!'); returnServerError('Unable to find anchor!');
$date = $torrent->find('small', 0); $date = $torrent->find('small', 0);
if(!$date) if(!$date)
$this->returnServerError('Unable to find date!'); returnServerError('Unable to find date!');
$item = array(); $item = array();
@ -240,11 +240,11 @@ class IsoHuntBridge extends BridgeAbstract{
private function get_latest_hot_torrents($html){ private function get_latest_hot_torrents($html){
$container = $html->find('div#serps', 0); $container = $html->find('div#serps', 0);
if(!$container) if(!$container)
$this->returnServerError('Unable to find torrent container!'); returnServerError('Unable to find torrent container!');
$torrents = $container->find('tr'); $torrents = $container->find('tr');
if(!$torrents) if(!$torrents)
$this->returnServerError('Unable to find torrents!'); returnServerError('Unable to find torrents!');
// Remove first element (header row) // Remove first element (header row)
$torrents = array_slice($torrents, 1); $torrents = array_slice($torrents, 1);
@ -253,11 +253,11 @@ class IsoHuntBridge extends BridgeAbstract{
$cell = $torrent->find('td', 0); $cell = $torrent->find('td', 0);
if(!$cell) if(!$cell)
$this->returnServerError('Unable to find cell!'); returnServerError('Unable to find cell!');
$element = $cell->find('a', 0); $element = $cell->find('a', 0);
if(!$element) if(!$element)
$this->returnServerError('Unable to find element!'); returnServerError('Unable to find element!');
$item = array(); $item = array();
@ -278,11 +278,11 @@ class IsoHuntBridge extends BridgeAbstract{
private function get_latest_news($html){ private function get_latest_news($html){
$container = $html->find('div#postcontainer', 0); $container = $html->find('div#postcontainer', 0);
if(!$container) if(!$container)
$this->returnServerError('Unable to find post container!'); returnServerError('Unable to find post container!');
$posts = $container->find('div.index-post'); $posts = $container->find('div.index-post');
if(!$posts) if(!$posts)
$this->returnServerError('Unable to find posts!'); returnServerError('Unable to find posts!');
foreach($posts as $post){ foreach($posts as $post){
$item = array(); $item = array();
@ -300,7 +300,7 @@ class IsoHuntBridge extends BridgeAbstract{
private function latest_news_extract_author($post){ private function latest_news_extract_author($post){
$author = $post->find('small', 0); $author = $post->find('small', 0);
if(!$author) if(!$author)
$this->returnServerError('Unable to find author!'); returnServerError('Unable to find author!');
// The author is hidden within a string like: 'Posted by {author} on {date}' // The author is hidden within a string like: 'Posted by {author} on {date}'
preg_match('/Posted\sby\s(.*)\son/i', $author->innertext, $matches); preg_match('/Posted\sby\s(.*)\son/i', $author->innertext, $matches);
@ -311,7 +311,7 @@ class IsoHuntBridge extends BridgeAbstract{
private function latest_news_extract_timestamp($post){ private function latest_news_extract_timestamp($post){
$date = $post->find('small', 0); $date = $post->find('small', 0);
if(!$date) if(!$date)
$this->returnServerError('Unable to find date!'); returnServerError('Unable to find date!');
// The date is hidden within a string like: 'Posted by {author} on {date}' // The date is hidden within a string like: 'Posted by {author} on {date}'
preg_match('/Posted\sby\s.*\son\s(.*)/i', $date->innertext, $matches); preg_match('/Posted\sby\s.*\son\s(.*)/i', $date->innertext, $matches);
@ -329,7 +329,7 @@ class IsoHuntBridge extends BridgeAbstract{
private function latest_news_extract_title($post){ private function latest_news_extract_title($post){
$title = $post->find('a', 0); $title = $post->find('a', 0);
if(!$title) if(!$title)
$this->returnServerError('Unable to find title!'); returnServerError('Unable to find title!');
return $title->plaintext; return $title->plaintext;
} }
@ -337,7 +337,7 @@ class IsoHuntBridge extends BridgeAbstract{
private function latest_news_extract_uri($post){ private function latest_news_extract_uri($post){
$uri = $post->find('a', 0); $uri = $post->find('a', 0);
if(!$uri) if(!$uri)
$this->returnServerError('Unable to find uri!'); returnServerError('Unable to find uri!');
return $uri->href; return $uri->href;
} }
@ -345,7 +345,7 @@ class IsoHuntBridge extends BridgeAbstract{
private function latest_news_extract_content($post){ private function latest_news_extract_content($post){
$content = $post->find('div', 0); $content = $post->find('div', 0);
if(!$content) if(!$content)
$this->returnServerError('Unable to find content!'); returnServerError('Unable to find content!');
// Remove <h2>...</h2> (title) // Remove <h2>...</h2> (title)
foreach($content->find('h2') as $element){ foreach($content->find('h2') as $element){
@ -367,11 +367,11 @@ class IsoHuntBridge extends BridgeAbstract{
private function get_latest_torrents($html){ private function get_latest_torrents($html){
$container = $html->find('div#serps', 0); $container = $html->find('div#serps', 0);
if(!$container) if(!$container)
$this->returnServerError('Unable to find torrent container!'); returnServerError('Unable to find torrent container!');
$torrents = $container->find('tr[data-key]'); $torrents = $container->find('tr[data-key]');
if(!$torrents) if(!$torrents)
$this->returnServerError('Unable to find torrents!'); returnServerError('Unable to find torrents!');
foreach($torrents as $torrent){ foreach($torrents as $torrent){
$item = array(); $item = array();
@ -389,11 +389,11 @@ class IsoHuntBridge extends BridgeAbstract{
private function latest_torrents_extract_title($torrent){ private function latest_torrents_extract_title($torrent){
$cell = $torrent->find('td.title-row', 0); $cell = $torrent->find('td.title-row', 0);
if(!$cell) if(!$cell)
$this->returnServerError('Unable to find title cell!'); returnServerError('Unable to find title cell!');
$title = $cell->find('span', 0); $title = $cell->find('span', 0);
if(!$title) if(!$title)
$this->returnServerError('Unable to find title!'); returnServerError('Unable to find title!');
return $title->plaintext; return $title->plaintext;
} }
@ -401,11 +401,11 @@ class IsoHuntBridge extends BridgeAbstract{
private function latest_torrents_extract_uri($torrent){ private function latest_torrents_extract_uri($torrent){
$cell = $torrent->find('td.title-row', 0); $cell = $torrent->find('td.title-row', 0);
if(!$cell) if(!$cell)
$this->returnServerError('Unable to find title cell!'); returnServerError('Unable to find title cell!');
$uri = $cell->find('a', 0); $uri = $cell->find('a', 0);
if(!$uri) if(!$uri)
$this->returnServerError('Unable to find uri!'); returnServerError('Unable to find uri!');
return $this->fix_relative_uri($uri->href); return $this->fix_relative_uri($uri->href);
} }
@ -417,7 +417,7 @@ class IsoHuntBridge extends BridgeAbstract{
$user = $cell->find('a', 0); $user = $cell->find('a', 0);
if(!$user) if(!$user)
$this->returnServerError('Unable to find user!'); returnServerError('Unable to find user!');
return $user->plaintext; return $user->plaintext;
} }
@ -425,7 +425,7 @@ class IsoHuntBridge extends BridgeAbstract{
private function latest_torrents_extract_timestamp($torrent){ private function latest_torrents_extract_timestamp($torrent){
$cell = $torrent->find('td.date-row', 0); $cell = $torrent->find('td.date-row', 0);
if(!$cell) if(!$cell)
$this->returnServerError('Unable to find date cell!'); returnServerError('Unable to find date cell!');
return strtotime('-' . $cell->plaintext, time()); return strtotime('-' . $cell->plaintext, time());
} }
@ -435,9 +435,9 @@ class IsoHuntBridge extends BridgeAbstract{
#region Generic helper functions #region Generic helper functions
private function load_html($uri){ private function load_html($uri){
$html = $this->getSimpleHTMLDOM($uri); $html = getSimpleHTMLDOM($uri);
if(!$html) if(!$html)
$this->returnServerError('Unable to load ' . $uri . '!'); returnServerError('Unable to load ' . $uri . '!');
return $html; return $html;
} }

View file

@ -43,8 +43,8 @@ class JapanExpoBridge extends BridgeAbstract {
} }
}; };
$html = $this->getSimpleHTMLDOM(self::URI) $html = getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Could not request JapanExpo: '.self::URI); or returnServerError('Could not request JapanExpo: '.self::URI);
$fullcontent = $this->getInput('mode'); $fullcontent = $this->getInput('mode');
$count = 0; $count = 0;
@ -61,7 +61,7 @@ class JapanExpoBridge extends BridgeAbstract {
break; break;
} }
$article_html = $this->getSimpleHTMLDOMCached('Could not request JapanExpo: '.$url); $article_html = getSimpleHTMLDOMCached('Could not request JapanExpo: '.$url);
$header = $article_html->find('header.pageHeadBox', 0); $header = $article_html->find('header.pageHeadBox', 0);
$timestamp = strtotime($header->find('time', 0)->datetime); $timestamp = strtotime($header->find('time', 0)->datetime);
$title_html = $header->find('div.section', 0)->next_sibling(); $title_html = $header->find('div.section', 0)->next_sibling();

View file

@ -9,7 +9,7 @@ class KoreusBridge extends FeedExpander {
protected function parseItem($item) { protected function parseItem($item) {
$item = parent::parseItem($item); $item = parent::parseItem($item);
$html = $this->getSimpleHTMLDOMCached($item['uri']); $html = getSimpleHTMLDOMCached($item['uri']);
$text = $html->find('p.itemText', 0)->innertext; $text = $html->find('p.itemText', 0)->innertext;
$item['content'] = utf8_encode($text); $item['content'] = utf8_encode($text);

View file

@ -68,21 +68,21 @@ class KununuBridge extends BridgeAbstract {
$full = $this->getInput('full'); $full = $this->getInput('full');
// Load page // Load page
$html = $this->getSimpleHTMLDOM($this->getURI()); $html = getSimpleHTMLDOM($this->getURI());
if(!$html) if(!$html)
$this->returnServerError('Unable to receive data from ' . $this->getURI() . '!'); returnServerError('Unable to receive data from ' . $this->getURI() . '!');
// Update name for this request // Update name for this request
$this->companyName = $this->extract_company_name($html); $this->companyName = $this->extract_company_name($html);
// Find the section with all the panels (reviews) // Find the section with all the panels (reviews)
$section = $html->find('section.kununu-scroll-element', 0); $section = $html->find('section.kununu-scroll-element', 0);
if($section === false) if($section === false)
$this->returnServerError('Unable to find panel section!'); returnServerError('Unable to find panel section!');
// Find all articles (within the panels) // Find all articles (within the panels)
$articles = $section->find('article'); $articles = $section->find('article');
if($articles === false || empty($articles)) if($articles === false || empty($articles))
$this->returnServerError('Unable to find articles!'); returnServerError('Unable to find articles!');
// Go through all articles // Go through all articles
foreach($articles as $article){ foreach($articles as $article){
@ -125,11 +125,11 @@ class KununuBridge extends BridgeAbstract {
private function extract_company_name($html){ private function extract_company_name($html){
$panel = $html->find('div.panel', 0); $panel = $html->find('div.panel', 0);
if($panel === false) if($panel === false)
$this->returnServerError('Cannot find panel for company name!'); returnServerError('Cannot find panel for company name!');
$company_name = $panel->find('h1', 0); $company_name = $panel->find('h1', 0);
if($company_name === false) if($company_name === false)
$this->returnServerError('Cannot find company name!'); returnServerError('Cannot find company name!');
return $company_name->plaintext; return $company_name->plaintext;
} }
@ -141,7 +141,7 @@ class KununuBridge extends BridgeAbstract {
// They conviniently provide a time attribute for us :) // They conviniently provide a time attribute for us :)
$date = $article->find('time[itemprop=dtreviewed]', 0); $date = $article->find('time[itemprop=dtreviewed]', 0);
if($date === false) if($date === false)
$this->returnServerError('Cannot find article date!'); returnServerError('Cannot find article date!');
return strtotime($date->datetime); return strtotime($date->datetime);
} }
@ -152,7 +152,7 @@ class KununuBridge extends BridgeAbstract {
private function extract_article_rating($article){ private function extract_article_rating($article){
$rating = $article->find('span.rating', 0); $rating = $article->find('span.rating', 0);
if($rating === false) if($rating === false)
$this->returnServerError('Cannot find article rating!'); returnServerError('Cannot find article rating!');
return $rating->getAttribute('aria-label'); return $rating->getAttribute('aria-label');
} }
@ -163,7 +163,7 @@ class KununuBridge extends BridgeAbstract {
private function extract_article_summary($article){ private function extract_article_summary($article){
$summary = $article->find('[itemprop=summary]', 0); $summary = $article->find('[itemprop=summary]', 0);
if($summary === false) if($summary === false)
$this->returnServerError('Cannot find article summary!'); returnServerError('Cannot find article summary!');
return strip_tags($summary->innertext); return strip_tags($summary->innertext);
} }
@ -175,11 +175,11 @@ class KununuBridge extends BridgeAbstract {
// Notice: This first part is the same as in extract_article_summary! // Notice: This first part is the same as in extract_article_summary!
$summary = $article->find('[itemprop=summary]', 0); $summary = $article->find('[itemprop=summary]', 0);
if($summary === false) if($summary === false)
$this->returnServerError('Cannot find article summary!'); returnServerError('Cannot find article summary!');
$anchor = $summary->find('a', 0); $anchor = $summary->find('a', 0);
if($anchor === false) if($anchor === false)
$this->returnServerError('Cannot find article URI!'); returnServerError('Cannot find article URI!');
return self::URI . $anchor->href; return self::URI . $anchor->href;
} }
@ -191,7 +191,7 @@ class KununuBridge extends BridgeAbstract {
// We need to parse the aside manually // We need to parse the aside manually
$aside = $article->find('aside', 0); $aside = $article->find('aside', 0);
if($aside === false) if($aside === false)
$this->returnServerError('Cannot find article author information!'); returnServerError('Cannot find article author information!');
// Go through all h2 elements to find index of required span (I know... it's stupid) // Go through all h2 elements to find index of required span (I know... it's stupid)
$author_position = 'Unknown'; $author_position = 'Unknown';
@ -211,7 +211,7 @@ class KununuBridge extends BridgeAbstract {
private function extract_article_description($article){ private function extract_article_description($article){
$description = $article->find('div[itemprop=description]', 0); $description = $article->find('div[itemprop=description]', 0);
if($description === false) if($description === false)
$this->returnServerError('Cannot find article description!'); returnServerError('Cannot find article description!');
return $this->fix_url($description->innertext); return $this->fix_url($description->innertext);
} }
@ -221,14 +221,14 @@ class KununuBridge extends BridgeAbstract {
*/ */
private function extract_full_description($uri){ private function extract_full_description($uri){
// Load full article // Load full article
$html = $this->getSimpleHTMLDOMCached($uri); $html = getSimpleHTMLDOMCached($uri);
if($html === false) if($html === false)
$this->returnServerError('Could not load full description!'); returnServerError('Could not load full description!');
// Find the article // Find the article
$article = $html->find('article', 0); $article = $html->find('article', 0);
if($article === false) if($article === false)
$this->returnServerError('Cannot find article!'); returnServerError('Cannot find article!');
// Luckily they use the same layout for the review overview and full article pages :) // Luckily they use the same layout for the review overview and full article pages :)
return $this->extract_article_description($article); return $this->extract_article_description($article);

View file

@ -33,8 +33,8 @@ class LWNprevBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
// Because the LWN page is written in loose HTML and not XHTML, // Because the LWN page is written in loose HTML and not XHTML,
// Simple HTML Dom is not accurate enough for the job // Simple HTML Dom is not accurate enough for the job
$content=$this->getContents($this->getURI()) $content=getContents($this->getURI())
or $this->returnServerError('No results for LWNprev'); or returnServerError('No results for LWNprev');
libxml_use_internal_errors(true); libxml_use_internal_errors(true);
$html=new DOMDocument(); $html=new DOMDocument();

View file

@ -143,11 +143,11 @@ class LeBonCoinBridge extends BridgeAbstract{
$category='annonces'; $category='annonces';
} }
$html = $this->getSimpleHTMLDOM( $html = getSimpleHTMLDOM(
self::URI.$category.'/offres/' . $this->getInput('r') . '/?' self::URI.$category.'/offres/' . $this->getInput('r') . '/?'
.'f=a&th=1&' .'f=a&th=1&'
.'q=' . urlencode($this->getInput('k')) .'q=' . urlencode($this->getInput('k'))
) or $this->returnServerError('Could not request LeBonCoin.'); ) or returnServerError('Could not request LeBonCoin.');
$list = $html->find('.tabsContent', 0); $list = $html->find('.tabsContent', 0);
if($list === NULL) { if($list === NULL) {

View file

@ -13,8 +13,8 @@ class LeMondeInformatiqueBridge extends FeedExpander {
protected function parseItem($newsItem){ protected function parseItem($newsItem){
$item = parent::parseItem($newsItem); $item = parent::parseItem($newsItem);
$article_html = $this->getSimpleHTMLDOMCached($item['uri']) $article_html = getSimpleHTMLDOMCached($item['uri'])
or $this->returnServerError('Could not request LeMondeInformatique: ' . $item['uri']); or returnServerError('Could not request LeMondeInformatique: ' . $item['uri']);
$item['content'] = $this->CleanArticle($article_html->find('div#article', 0)->innertext); $item['content'] = $this->CleanArticle($article_html->find('div#article', 0)->innertext);
$item['title'] = $article_html->find('h1.cleanprint-title', 0)->plaintext; $item['title'] = $article_html->find('h1.cleanprint-title', 0)->plaintext;
return $item; return $item;

View file

@ -39,7 +39,7 @@ class LegifranceJOBridge extends BridgeAbstract{
} }
public function collectData(){ public function collectData(){
$html=$this->getSimpleHTMLDOM(self::URI) $html=getSimpleHTMLDOM(self::URI)
or $this->returnServer('Unable to download '.self::URI); or $this->returnServer('Unable to download '.self::URI);
$this->author=trim($html->find('h2.title',0)->plaintext); $this->author=trim($html->find('h2.title',0)->plaintext);

View file

@ -8,8 +8,8 @@ class LesJoiesDuCodeBridge extends BridgeAbstract{
const DESCRIPTION = "LesJoiesDuCode"; const DESCRIPTION = "LesJoiesDuCode";
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM(self::URI) $html = getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Could not request LesJoiesDuCode.'); or returnServerError('Could not request LesJoiesDuCode.');
foreach($html->find('div.blog-post') as $element) { foreach($html->find('div.blog-post') as $element) {
$item = array(); $item = array();

View file

@ -17,7 +17,7 @@ class LichessBridge extends FeedExpander {
} }
private function retrieve_lichess_post($blog_post_uri){ private function retrieve_lichess_post($blog_post_uri){
$blog_post_html = $this->getSimpleHTMLDOMCached($blog_post_uri); $blog_post_html = getSimpleHTMLDOMCached($blog_post_uri);
$blog_post_div = $blog_post_html->find('#lichess_blog', 0); $blog_post_div = $blog_post_html->find('#lichess_blog', 0);
$post_chapo = $blog_post_div->find('.shortlede', 0)->innertext; $post_chapo = $blog_post_div->find('.shortlede', 0)->innertext;

View file

@ -18,8 +18,8 @@ class LinkedInCompanyBridge extends BridgeAbstract{
$html = ''; $html = '';
$link = self::URI.'company/'.$this->getInput('c'); $link = self::URI.'company/'.$this->getInput('c');
$html = $this->getSimpleHTMLDOM($link) $html = getSimpleHTMLDOM($link)
or $this->returnServerError('Could not request LinkedIn.'); or returnServerError('Could not request LinkedIn.');
foreach($html->find('//*[@id="my-feed-post"]/li') as $element) { foreach($html->find('//*[@id="my-feed-post"]/li') as $element) {
$title = $element->find('span.share-body', 0)->innertext; $title = $element->find('span.share-body', 0)->innertext;

View file

@ -79,9 +79,9 @@ class MangareaderBridge extends BridgeAbstract {
public function collectData(){ public function collectData(){
// We'll use the DOM parser for this as it makes navigation easier // We'll use the DOM parser for this as it makes navigation easier
$html = $this->getContents($this->getURI()); $html = getContents($this->getURI());
if(!$html){ if(!$html){
$this->returnClientError('Could not receive data for ' . $path . '!'); returnClientError('Could not receive data for ' . $path . '!');
} }
libxml_use_internal_errors(true); libxml_use_internal_errors(true);
$doc = new DomDocument; $doc = new DomDocument;

View file

@ -22,8 +22,8 @@ class MoebooruBridge extends BridgeAbstract{
} }
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->getFullURI()) $html = getSimpleHTMLDOM($this->getFullURI())
or $this->returnServerError('Could not request '.$this->getName()); or returnServerError('Could not request '.$this->getName());
$input_json = explode('Post.register(', $html); $input_json = explode('Post.register(', $html);

View file

@ -8,8 +8,8 @@ class MondeDiploBridge extends BridgeAbstract{
const DESCRIPTION = "Returns most recent results from MondeDiplo."; const DESCRIPTION = "Returns most recent results from MondeDiplo.";
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM(self::URI) $html = getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Could not request MondeDiplo. for : ' . self::URI); or returnServerError('Could not request MondeDiplo. for : ' . self::URI);
foreach($html->find('div.unarticle') as $article) { foreach($html->find('div.unarticle') as $article) {
$element = $article->parent(); $element = $article->parent();

View file

@ -11,13 +11,13 @@ class MsnMondeBridge extends BridgeAbstract{
} }
private function MsnMondeExtractContent($url, &$item) { private function MsnMondeExtractContent($url, &$item) {
$html2 = $this->getSimpleHTMLDOM($url); $html2 = 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(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->getURI()) or $this->returnServerError('Could not request MsnMonde.'); $html = getSimpleHTMLDOM($this->getURI()) or returnServerError('Could not request MsnMonde.');
$limit = 0; $limit = 0;
foreach($html->find('.smalla') as $article) { foreach($html->find('.smalla') as $article) {
if($limit < 10) { if($limit < 10) {

View file

@ -9,7 +9,7 @@ class NasaApodBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM(self::URI.'archivepix.html') or $this->returnServerError('Error while downloading the website content'); $html = getSimpleHTMLDOM(self::URI.'archivepix.html') or returnServerError('Error while downloading the website content');
$list = explode("<br>", $html->find('b', 0)->innertext); $list = explode("<br>", $html->find('b', 0)->innertext);
for($i = 0; $i < 3;$i++) for($i = 0; $i < 3;$i++)
@ -21,7 +21,7 @@ class NasaApodBridge extends BridgeAbstract{
$uri = self::URI.$uri_page; $uri = self::URI.$uri_page;
$item['uri'] = $uri; $item['uri'] = $uri;
$picture_html = $this->getSimpleHTMLDOM($uri); $picture_html = getSimpleHTMLDOM($uri);
$picture_html_string = $picture_html->innertext; $picture_html_string = $picture_html->innertext;
//Extract image and explanation //Extract image and explanation

View file

@ -17,7 +17,7 @@ class NeuviemeArtBridge extends FeedExpander {
protected function parseItem($item){ protected function parseItem($item){
$item = parent::parseItem($item); $item = parent::parseItem($item);
$article_html = $this->getSimpleHTMLDOMCached($item['uri']); $article_html = getSimpleHTMLDOMCached($item['uri']);
if(!$article_html){ if(!$article_html){
$item['content'] = 'Could not request 9eme Art: '.$item['uri']; $item['content'] = 'Could not request 9eme Art: '.$item['uri'];
return $item; return $item;

View file

@ -17,7 +17,7 @@ class NextInpactBridge extends FeedExpander {
} }
private function ExtractContent($url) { private function ExtractContent($url) {
$html2 = $this->getSimpleHTMLDOMCached($url); $html2 = getSimpleHTMLDOMCached($url);
$text = '<p><em>'.$html2->find('span.sub_title', 0)->innertext.'</em></p>' $text = '<p><em>'.$html2->find('span.sub_title', 0)->innertext.'</em></p>'
.'<p><img src="'.$html2->find('div.container_main_image_article', 0)->find('img.dedicated',0)->src.'" alt="-" /></p>' .'<p><img src="'.$html2->find('div.container_main_image_article', 0)->find('img.dedicated',0)->src.'" alt="-" /></p>'
.'<div>'.$html2->find('div[itemprop=articleBody]', 0)->innertext.'</div>'; .'<div>'.$html2->find('div[itemprop=articleBody]', 0)->innertext.'</div>';

View file

@ -56,8 +56,8 @@ class NextgovBridge extends FeedExpander {
} }
private function ExtractContent($url){ private function ExtractContent($url){
$article = $this->getSimpleHTMLDOMCached($url) $article = getSimpleHTMLDOMCached($url)
or $this->returnServerError('Could not request Nextgov: ' . $url); or returnServerError('Could not request Nextgov: ' . $url);
$contents = $article->find('div.wysiwyg', 0)->innertext; $contents = $article->find('div.wysiwyg', 0)->innertext;
$contents = $this->StripWithDelimiters($contents, '<div class="ad-container">', '</div>'); $contents = $this->StripWithDelimiters($contents, '<div class="ad-container">', '</div>');

View file

@ -17,7 +17,7 @@ class NiceMatinBridge extends FeedExpander {
} }
private function NiceMatinExtractContent($url) { private function NiceMatinExtractContent($url) {
$html = $this->getSimpleHTMLDOMCached($url); $html = getSimpleHTMLDOMCached($url);
if(!$html) if(!$html)
return 'Could not acquire content from url: ' . $url . '!'; return 'Could not acquire content from url: ' . $url . '!';

View file

@ -21,8 +21,8 @@ class NovelUpdatesBridge extends BridgeAbstract{
} }
public function collectData(){ public function collectData(){
$fullhtml = $this->getSimpleHTMLDOM($this->getURI()) $fullhtml = getSimpleHTMLDOM($this->getURI())
or $this->returnServerError('Could not request NovelUpdates, novel "'.$this->getInput('n').'" not found'); or returnServerError('Could not request NovelUpdates, novel "'.$this->getInput('n').'" not found');
$this->seriesTitle = $fullhtml->find('h4.seriestitle', 0)->plaintext; $this->seriesTitle = $fullhtml->find('h4.seriestitle', 0)->plaintext;
// dirty fix for nasty simpledom bug: https://github.com/sebsauvage/rss-bridge/issues/259 // dirty fix for nasty simpledom bug: https://github.com/sebsauvage/rss-bridge/issues/259

View file

@ -32,8 +32,8 @@ class OpenClassroomsBridge extends BridgeAbstract{
} }
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->getURI()) $html = getSimpleHTMLDOM($this->getURI())
or $this->returnServerError('Could not request OpenClassrooms.'); or returnServerError('Could not request OpenClassrooms.');
foreach($html->find('.courseListItem') as $element) { foreach($html->find('.courseListItem') as $element) {
$item = array(); $item = array();

View file

@ -26,8 +26,8 @@ class ParuVenduImmoBridge extends BridgeAbstract
public function collectData() public function collectData()
{ {
$html = $this->getSimpleHTMLDOM($this->getURI()) $html = getSimpleHTMLDOM($this->getURI())
or $this->returnServerError('Could not request paruvendu.'); or returnServerError('Could not request paruvendu.');
foreach($html->find('div.annonce a') as $element) { foreach($html->find('div.annonce a') as $element) {

View file

@ -34,8 +34,8 @@ class PickyWallpapersBridge extends BridgeAbstract {
$resolution = $this->getInput('r'); // Wide wallpaper default $resolution = $this->getInput('r'); // Wide wallpaper default
for ($page = 1; $page <= $lastpage; $page++) { for ($page = 1; $page <= $lastpage; $page++) {
$html = $this->getSimpleHTMLDOM($this->getURI().'/page-'.$page.'/') $html = getSimpleHTMLDOM($this->getURI().'/page-'.$page.'/')
or $this->returnServerError('No results for this query.'); or returnServerError('No results for this query.');
if ($page === 1) { if ($page === 1) {
preg_match('/page-(\d+)\/$/', $html->find('.pages li a', -2)->href, $matches); preg_match('/page-(\d+)\/$/', $html->find('.pages li a', -2)->href, $matches);

View file

@ -26,13 +26,13 @@ class PinterestBridge extends BridgeAbstract {
); );
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->getURI()); $html = getSimpleHTMLDOM($this->getURI());
if(!$html){ if(!$html){
switch($this->queriedContext){ switch($this->queriedContext){
case 'By username and board': case 'By username and board':
$this->returnServerError('Username and/or board not found'); returnServerError('Username and/or board not found');
case 'From search': case 'From search':
$this->returnServerError('Could not request Pinterest.'); returnServerError('Could not request Pinterest.');
} }
} }
@ -72,7 +72,7 @@ class PinterestBridge extends BridgeAbstract {
} }
} elseif($this->queriedContext === 'By username and board'){ } elseif($this->queriedContext === 'By username and board'){
$container = $html->find('SCRIPT[type="application/ld+json"]', 0) $container = $html->find('SCRIPT[type="application/ld+json"]', 0)
or $this->returnServerError('Unable to find data container!'); or returnServerError('Unable to find data container!');
$json = json_decode($container->innertext, true); $json = json_decode($container->innertext, true);

View file

@ -7,14 +7,14 @@ class PlanetLibreBridge extends BridgeAbstract{
const DESCRIPTION = "Returns the 5 newest posts from PlanetLibre (full text)"; const DESCRIPTION = "Returns the 5 newest posts from PlanetLibre (full text)";
private function PlanetLibreExtractContent($url){ private function PlanetLibreExtractContent($url){
$html2 = $this->getSimpleHTMLDOM($url); $html2 = getSimpleHTMLDOM($url);
$text = $html2->find('div[class="post-text"]', 0)->innertext; $text = $html2->find('div[class="post-text"]', 0)->innertext;
return $text; return $text;
} }
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM(self::URI) $html = getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Could not request PlanetLibre.'); or returnServerError('Could not request PlanetLibre.');
$limit = 0; $limit = 0;
foreach($html->find('div.post') as $element) { foreach($html->find('div.post') as $element) {
if($limit < 5) { if($limit < 5) {

View file

@ -19,8 +19,8 @@ class RTBFBridge extends BridgeAbstract {
$limit = 10; $limit = 10;
$count = 0; $count = 0;
$html = $this->getSimpleHTMLDOM($this->getURI()) $html = getSimpleHTMLDOM($this->getURI())
or $this->returnServerError('Could not request RTBF.'); or returnServerError('Could not request RTBF.');
foreach($html->find('section[id!=widget-ml-avoiraussi-] .rtbf-media-grid article') as $element) { foreach($html->find('section[id!=widget-ml-avoiraussi-] .rtbf-media-grid article') as $element) {
if($count >= $limit) { if($count >= $limit) {

View file

@ -34,7 +34,7 @@ class Releases3DSBridge extends BridgeAbstract {
} }
$dataUrl = self::URI.'xml.php'; $dataUrl = self::URI.'xml.php';
$xml = $this->getContents($dataUrl) or $this->returnServerError('Could not request 3dsdb: '.$dataUrl); $xml = getContents($dataUrl) or returnServerError('Could not request 3dsdb: '.$dataUrl);
$limit = 0; $limit = 0;
foreach (array_reverse(explode('<release>', $xml)) as $element) { foreach (array_reverse(explode('<release>', $xml)) as $element) {
@ -69,7 +69,7 @@ class Releases3DSBridge extends BridgeAbstract {
//Retrieve cover art and short desc from IGN? //Retrieve cover art and short desc from IGN?
$ignResult = false; $ignDescription = ''; $ignLink = ''; $ignDate = time(); $ignCoverArt = ''; $ignResult = false; $ignDescription = ''; $ignLink = ''; $ignDate = time(); $ignCoverArt = '';
$ignSearchUrl = 'http://www.ign.com/search?q='.urlencode($name); $ignSearchUrl = 'http://www.ign.com/search?q='.urlencode($name);
if ($ignResult = $this->getSimpleHTMLDOM($ignSearchUrl)) { if ($ignResult = getSimpleHTMLDOM($ignSearchUrl)) {
$ignCoverArt = $ignResult->find('div.search-item-media', 0)->find('img', 0)->src; $ignCoverArt = $ignResult->find('div.search-item-media', 0)->find('img', 0)->src;
$ignDesc = $ignResult->find('div.search-item-description', 0)->plaintext; $ignDesc = $ignResult->find('div.search-item-description', 0)->plaintext;
$ignLink = $ignResult->find('div.search-item-sub-title', 0)->find('a', 1)->href; $ignLink = $ignResult->find('div.search-item-sub-title', 0)->find('a', 1)->href;

View file

@ -7,7 +7,7 @@ class ReporterreBridge extends BridgeAbstract{
const DESCRIPTION = "Returns the newest articles."; const DESCRIPTION = "Returns the newest articles.";
private function ExtractContentReporterre($url) { private function ExtractContentReporterre($url) {
$html2 = $this->getSimpleHTMLDOM($url); $html2 = getSimpleHTMLDOM($url);
foreach($html2->find('div[style=text-align:justify]') as $e) { foreach($html2->find('div[style=text-align:justify]') as $e) {
$text = $e->outertext; $text = $e->outertext;
@ -24,7 +24,7 @@ class ReporterreBridge extends BridgeAbstract{
} }
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM(self::URI.'spip.php?page=backend') or $this->returnServerError('Could not request Reporterre.'); $html = getSimpleHTMLDOM(self::URI.'spip.php?page=backend') or returnServerError('Could not request Reporterre.');
$limit = 0; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {

View file

@ -10,7 +10,7 @@ class Rue89Bridge extends FeedExpander {
$item = parent::parseItem($item); $item = parent::parseItem($item);
$url = "http://api.rue89.nouvelobs.com/export/mobile2/node/" . str_replace(" ", "", substr($item['uri'], -8)) . "/full"; $url = "http://api.rue89.nouvelobs.com/export/mobile2/node/" . str_replace(" ", "", substr($item['uri'], -8)) . "/full";
$datas = json_decode($this->getContents($url), true); $datas = json_decode(getContents($url), true);
$item['content'] = $datas['node']['body']; $item['content'] = $datas['node']['body'];
return $item; return $item;

View file

@ -9,8 +9,8 @@ class ScmbBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = ''; $html = '';
$html = $this->getSimpleHTMLDOM(self::URI) $html = getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Could not request Se Coucher Moins Bete.'); or returnServerError('Could not request Se Coucher Moins Bete.');
foreach($html->find('article') as $article) { foreach($html->find('article') as $article) {
$item = array(); $item = array();

View file

@ -18,8 +18,8 @@ class ScoopItBridge extends BridgeAbstract{
$this->request = $this->getInput('u'); $this->request = $this->getInput('u');
$link = self::URI.'search?q=' .urlencode($this->getInput('u')); $link = self::URI.'search?q=' .urlencode($this->getInput('u'));
$html = $this->getSimpleHTMLDOM($link) $html = getSimpleHTMLDOM($link)
or $this->returnServerError('Could not request ScoopIt. for : ' . $link); or returnServerError('Could not request ScoopIt. for : ' . $link);
foreach($html->find('div.post-view') as $element) { foreach($html->find('div.post-view') as $element) {
$item = array(); $item = array();

View file

@ -47,8 +47,8 @@ class SensCritiqueBridge extends BridgeAbstract {
case 'bd': $uri.='bd/actualite'; break; case 'bd': $uri.='bd/actualite'; break;
case 'mu': $uri.='musique/actualite'; break; case 'mu': $uri.='musique/actualite'; break;
} }
$html = $this->getSimpleHTMLDOM($uri) $html = getSimpleHTMLDOM($uri)
or $this->returnServerError('No results for this query.'); or returnServerError('No results for this query.');
$list = $html->find('ul.elpr-list', 0); $list = $html->find('ul.elpr-list', 0);
$this->extractDataFromList($list); $this->extractDataFromList($list);
@ -58,7 +58,7 @@ class SensCritiqueBridge extends BridgeAbstract {
private function extractDataFromList($list) { private function extractDataFromList($list) {
if ($list === null) { if ($list === null) {
$this->returnClientError('Cannot extract data from list'); returnClientError('Cannot extract data from list');
} }
foreach ($list->find('li') as $movie) { foreach ($list->find('li') as $movie) {

View file

@ -11,7 +11,7 @@ class SexactuBridge extends BridgeAbstract{
$find = array('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'novembre', 'décembre'); $find = array('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'novembre', 'décembre');
$replace = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); $replace = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
$html = $this->getSimpleHTMLDOM($this->getURI()) or $this->returnServerError('Could not request '.$this->getURI()); $html = getSimpleHTMLDOM($this->getURI()) or returnServerError('Could not request '.$this->getURI());
foreach($html->find('.content-holder') as $contentHolder) { foreach($html->find('.content-holder') as $contentHolder) {
// only use first list as second one only contains pages numbers // only use first list as second one only contains pages numbers

View file

@ -8,17 +8,17 @@ class ShanaprojectBridge extends BridgeAbstract {
// Returns an html object for the Season Anime List (latest season) // Returns an html object for the Season Anime List (latest season)
private function LoadSeasonAnimeList(){ private function LoadSeasonAnimeList(){
// First we need to find the URI to the latest season from the 'seasons' page searching for 'Season Anime List' // First we need to find the URI to the latest season from the 'seasons' page searching for 'Season Anime List'
$html = $this->getSimpleHTMLDOM($this->getURI() . '/seasons'); $html = getSimpleHTMLDOM($this->getURI() . '/seasons');
if(!$html) if(!$html)
$this->returnServerError('Could not load \'seasons\' page!'); returnServerError('Could not load \'seasons\' page!');
$season = $html->find('div.follows_menu/a', 1); $season = $html->find('div.follows_menu/a', 1);
if(!$season) if(!$season)
$this->returnServerError('Could not find \'Season Anime List\'!'); returnServerError('Could not find \'Season Anime List\'!');
$html = $this->getSimpleHTMLDOM($this->getURI() . $season->href); $html = getSimpleHTMLDOM($this->getURI() . $season->href);
if(!$html) if(!$html)
$this->returnServerError('Could not load \'Season Anime List\' from \'' . $season->innertext . '\'!'); returnServerError('Could not load \'Season Anime List\' from \'' . $season->innertext . '\'!');
return $html; return $html;
} }
@ -27,7 +27,7 @@ class ShanaprojectBridge extends BridgeAbstract {
private function ExtractAnimeTitle($anime){ private function ExtractAnimeTitle($anime){
$title = $anime->find('a', 0); $title = $anime->find('a', 0);
if(!$title) if(!$title)
$this->returnServerError('Could not find anime title!'); returnServerError('Could not find anime title!');
return trim($title->innertext); return trim($title->innertext);
} }
@ -35,7 +35,7 @@ class ShanaprojectBridge extends BridgeAbstract {
private function ExtractAnimeURI($anime){ private function ExtractAnimeURI($anime){
$uri = $anime->find('a', 0); $uri = $anime->find('a', 0);
if(!$uri) if(!$uri)
$this->returnServerError('Could not find anime URI!'); returnServerError('Could not find anime URI!');
return $this->getURI() . $uri->href; return $this->getURI() . $uri->href;
} }
@ -43,7 +43,7 @@ class ShanaprojectBridge extends BridgeAbstract {
private function ExtractAnimeTimestamp($anime){ private function ExtractAnimeTimestamp($anime){
$timestamp = $anime->find('span.header_info_block', 1); $timestamp = $anime->find('span.header_info_block', 1);
if(!$timestamp) if(!$timestamp)
$this->returnServerError('Could not find anime timestamp!'); returnServerError('Could not find anime timestamp!');
return strtotime($timestamp->innertext); return strtotime($timestamp->innertext);
} }
@ -59,7 +59,7 @@ class ShanaprojectBridge extends BridgeAbstract {
private function ExtractAnimeEpisodeInformation($anime){ private function ExtractAnimeEpisodeInformation($anime){
$episode = $anime->find('div.header_info_episode', 0); $episode = $anime->find('div.header_info_episode', 0);
if(!$episode) if(!$episode)
$this->returnServerError('Could not find anime episode information!'); returnServerError('Could not find anime episode information!');
return preg_replace('/\r|\n/', ' ', $episode->plaintext); return preg_replace('/\r|\n/', ' ', $episode->plaintext);
} }
@ -71,7 +71,7 @@ class ShanaprojectBridge extends BridgeAbstract {
if(preg_match("/url\(\/\/([^\)]+)\)/i", $anime->parent->style, $matches)) if(preg_match("/url\(\/\/([^\)]+)\)/i", $anime->parent->style, $matches))
return $matches[1]; return $matches[1];
$this->returnServerError('Could not extract background image!'); returnServerError('Could not extract background image!');
} }
// Builds an URI to search for a specific anime (subber is left empty) // Builds an URI to search for a specific anime (subber is left empty)
@ -94,7 +94,7 @@ class ShanaprojectBridge extends BridgeAbstract {
$animes = $html->find('div.header_display_box_info'); $animes = $html->find('div.header_display_box_info');
if(!$animes) if(!$animes)
$this->returnServerError('Could not find anime headers!'); returnServerError('Could not find anime headers!');
foreach($animes as $anime){ foreach($animes as $anime){
$item = array(); $item = array();

View file

@ -18,16 +18,16 @@ class SoundCloudBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$res = json_decode($this->getContents( $res = json_decode(getContents(
'https://api.soundcloud.com/resolve?url=http://www.soundcloud.com/' 'https://api.soundcloud.com/resolve?url=http://www.soundcloud.com/'
. urlencode($this->getInput('u')) . urlencode($this->getInput('u'))
.'&client_id=' . self::CLIENT_ID .'&client_id=' . self::CLIENT_ID
)) or $this->returnServerError('No results for this query'); )) or returnServerError('No results for this query');
$tracks = json_decode($this->getContents( $tracks = json_decode(getContents(
'https://api.soundcloud.com/users/' 'https://api.soundcloud.com/users/'
. urlencode($res->id) . urlencode($res->id)
.'/tracks?client_id=' . self::CLIENT_ID .'/tracks?client_id=' . self::CLIENT_ID
)) or $this->returnServerError('No results for this user'); )) or returnServerError('No results for this user');
for ($i=0; $i < 10; $i++) { for ($i=0; $i < 10; $i++) {
$item = array(); $item = array();

View file

@ -7,8 +7,8 @@ class StripeAPIChangeLogBridge extends BridgeAbstract{
const DESCRIPTION = 'Returns the changes made to the stripe.com API'; const DESCRIPTION = 'Returns the changes made to the stripe.com API';
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM(self::URI) $html = getSimpleHTMLDOM(self::URI)
or $this->returnServerError('No results for Stripe API Changelog'); or returnServerError('No results for Stripe API Changelog');
foreach($html->find('h3') as $change){ foreach($html->find('h3') as $change){

View file

@ -33,15 +33,15 @@ class SuperbWallpapersBridge extends BridgeAbstract {
// Get last page number // Get last page number
$link = self::URI.'/'.$category.'/9999.html'; $link = self::URI.'/'.$category.'/9999.html';
$html = $this->getSimpleHTMLDOM($link) $html = getSimpleHTMLDOM($link)
or $this->returnServerError('Could not load '.$link); or returnServerError('Could not load '.$link);
$lastpage = min($html->find('.paging .cpage', 0)->innertext(), ceil($max/36)); $lastpage = min($html->find('.paging .cpage', 0)->innertext(), ceil($max/36));
for ($page = 1; $page <= $lastpage; $page++) { for ($page = 1; $page <= $lastpage; $page++) {
$link = self::URI.'/'.$category.'/'.$page.'.html'; $link = self::URI.'/'.$category.'/'.$page.'.html';
$html = $this->getSimpleHTMLDOM($link) $html = getSimpleHTMLDOM($link)
or $this->returnServerError('No results for this query.'); or returnServerError('No results for this query.');
foreach($html->find('.wpl .i a') as $element) { foreach($html->find('.wpl .i a') as $element) {
$thumbnail = $element->find('img', 0); $thumbnail = $element->find('img', 0);

View file

@ -26,12 +26,12 @@ class T411Bridge extends BridgeAbstract {
//Retrieve torrent listing from search results, which does not contain torrent description //Retrieve torrent listing from search results, which does not contain torrent description
$url = self::URI.'torrents/search/?'.$this->getInput('search').'&order=added&type=desc'; $url = self::URI.'torrents/search/?'.$this->getInput('search').'&order=added&type=desc';
$html = $this->getSimpleHTMLDOM($url) $html = getSimpleHTMLDOM($url)
or $this->returnServerError('Could not request t411: '.$url); or returnServerError('Could not request t411: '.$url);
$results = $html->find('table.results', 0); $results = $html->find('table.results', 0);
if (is_null($results)) if (is_null($results))
$this->returnServerError('No results from t411: '.$url); returnServerError('No results from t411: '.$url);
$limit = 0; $limit = 0;
//Process each item individually //Process each item individually
@ -54,7 +54,7 @@ class T411Bridge extends BridgeAbstract {
$item_date = strtotime($element->find('dd', 0)->plaintext); $item_date = strtotime($element->find('dd', 0)->plaintext);
//Retrieve full description from torrent page //Retrieve full description from torrent page
$item_html = $this->getSimpleHTMLDOM($item_uri); $item_html = getSimpleHTMLDOM($item_uri);
if (!$item_html) { if (!$item_html) {
continue; continue;
} }

View file

@ -17,8 +17,8 @@ class TagBoardBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$link = 'https://post-cache.tagboard.com/search/' .$this->getInput('u'); $link = 'https://post-cache.tagboard.com/search/' .$this->getInput('u');
$html = $this->getSimpleHTMLDOM($link) $html = getSimpleHTMLDOM($link)
or $this->returnServerError('Could not request TagBoard for : ' . $link); or returnServerError('Could not request TagBoard for : ' . $link);
$parsed_json = json_decode($html); $parsed_json = json_decode($html);
foreach($parsed_json->{'posts'} as $element) { foreach($parsed_json->{'posts'} as $element) {

View file

@ -8,8 +8,8 @@ class TheCodingLoveBridge extends BridgeAbstract{
const DESCRIPTION = "The Coding Love"; const DESCRIPTION = "The Coding Love";
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM(self::URI) $html = getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Could not request The Coding Love.'); or returnServerError('Could not request The Coding Love.');
foreach($html->find('div.post') as $element) { foreach($html->find('div.post') as $element) {
$item = array(); $item = array();

View file

@ -40,7 +40,7 @@ class TheHackerNewsBridge extends BridgeAbstract {
return $string; return $string;
} }
$html = $this->getSimpleHTMLDOM($this->getURI()) or $this->returnServerError('Could not request TheHackerNews: '.$this->getURI()); $html = getSimpleHTMLDOM($this->getURI()) or returnServerError('Could not request TheHackerNews: '.$this->getURI());
$limit = 0; $limit = 0;
foreach ($html->find('article') as $element) { foreach ($html->find('article') as $element) {
@ -50,7 +50,7 @@ class TheHackerNewsBridge extends BridgeAbstract {
$article_author = trim($element->find('span.vcard', 0)->plaintext); $article_author = trim($element->find('span.vcard', 0)->plaintext);
$article_title = $element->find('a.entry-title', 0)->plaintext; $article_title = $element->find('a.entry-title', 0)->plaintext;
$article_timestamp = strtotime($element->find('span.updated', 0)->plaintext); $article_timestamp = strtotime($element->find('span.updated', 0)->plaintext);
$article = $this->getSimpleHTMLDOM($article_url) or $this->returnServerError('Could not request TheHackerNews: '.$article_url); $article = getSimpleHTMLDOM($article_url) or returnServerError('Could not request TheHackerNews: '.$article_url);
$contents = $article->find('div.articlebodyonly', 0)->innertext; $contents = $article->find('div.articlebodyonly', 0)->innertext;
$contents = StripRecursiveHTMLSection($contents, 'div', '<div class=\'clear\''); $contents = StripRecursiveHTMLSection($contents, 'div', '<div class=\'clear\'');

View file

@ -14,7 +14,7 @@ class TheOatmealBridge extends FeedExpander{
protected function parseItem($newsItem) { protected function parseItem($newsItem) {
$item = parent::parseItem($newsItem); $item = parent::parseItem($newsItem);
$articlePage = $this->getSimpleHTMLDOMCached($item['uri']); $articlePage = getSimpleHTMLDOMCached($item['uri']);
$content = $articlePage->find('#comic', 0); $content = $articlePage->find('#comic', 0);
if(is_null($content)) // load alternative if(is_null($content)) // load alternative
$content = $articlePage->find('#blog', 0); $content = $articlePage->find('#blog', 0);

View file

@ -18,7 +18,7 @@ class ThePirateBayBridge extends BridgeAbstract{
'values'=>array( 'values'=>array(
'search'=>'search', 'search'=>'search',
'category'=>'cat', 'category'=>'cat',
'user'=>'usr' 'user'=>'usr'
) )
), ),
'cat_check'=>array( 'cat_check'=>array(
@ -70,7 +70,7 @@ class ThePirateBayBridge extends BridgeAbstract{
if ($catBool) if ($catBool)
{ {
$catNum = $this->getInput('cat'); $catNum = $this->getInput('cat');
} }
$critList = $this->getInput('crit'); $critList = $this->getInput('crit');
$keywordsList = explode(";",$this->getInput('q')); $keywordsList = explode(";",$this->getInput('q'));
foreach($keywordsList as $keywords){ foreach($keywordsList as $keywords){
@ -78,33 +78,32 @@ class ThePirateBayBridge extends BridgeAbstract{
case "search": case "search":
if ($catBool == FALSE) if ($catBool == FALSE)
{ {
$html = $this->getSimpleHTMLDOM(self::URI.'search/'.rawurlencode($keywords).'/0/3/0') $html = getSimpleHTMLDOM(self::URI.'search/'.rawurlencode($keywords).'/0/3/0')
or $this->returnServerError('Could not request TPB.'); or returnServerError('Could not request TPB.');
} }
else else
{ {
$html = $this->getSimpleHTMLDOM(self::URI.'search/'.rawurlencode($keywords).'/0/3/'.rawurlencode($catNum)) $html = getSimpleHTMLDOM(self::URI.'search/'.rawurlencode($keywords).'/0/3/'.rawurlencode($catNum))
or $this->returnServerError('Could not request TPB.'); or returnServerError('Could not request TPB.');
} }
break; break;
case "cat": case "cat":
$html = $this->getSimpleHTMLDOM(self::URI.'browse/'.rawurlencode($keywords).'/0/3/0') $html = getSimpleHTMLDOM(self::URI.'browse/'.rawurlencode($keywords).'/0/3/0')
or $this->returnServerError('Could not request TPB.'); or returnServerError('Could not request TPB.');
break; break;
case "usr": case "usr":
$html = $this->getSimpleHTMLDOM(self::URI.'user/'.rawurlencode($keywords).'/0/3/0') $html = getSimpleHTMLDOM(self::URI.'user/'.rawurlencode($keywords).'/0/3/0')
or $this->returnServerError('Could not request TPB.'); or returnServerError('Could not request TPB.');
break; break;
} }
if ($html->find('table#searchResult', 0) == FALSE) if ($html->find('table#searchResult', 0) == FALSE)
$this->returnServerError('No result for query '.$keywords); returnServerError('No result for query '.$keywords);
foreach($html->find('tr') as $element) { foreach($html->find('tr') as $element) {
$item = array(); $item = array();
$item['uri'] = $element->find('a',3)->href; $item['uri'] = $element->find('a',3)->href;
$item['id'] = self::URI.$element->find('a.detLink',0)->href; $item['id'] = self::URI.$element->find('a.detLink',0)->href;
$item['timestamp'] = parseDateTimestamp($element); $item['timestamp'] = parseDateTimestamp($element);
$item['author'] = $element->find('a.detDesc',0)->plaintext; $item['author'] = $element->find('a.detDesc',0)->plaintext;

View file

@ -71,10 +71,10 @@ class TwitchApiBridge extends BridgeAbstract{
/* Finally we're ready to request data from the API. Each response provides information for the next request. */ /* Finally we're ready to request data from the API. Each response provides information for the next request. */
for($i = 0; $i < $requests; $i++) { for($i = 0; $i < $requests; $i++) {
$response = $this->getSimpleHTMLDOM($request, false, $context); $response = getSimpleHTMLDOM($request, false, $context);
if($response == false) { if($response == false) {
$this->returnServerError('Request failed! Check if the channel name is valid!'); returnServerError('Request failed! Check if the channel name is valid!');
} }
$data = json_decode($response); $data = json_decode($response);

View file

@ -62,13 +62,13 @@ class TwitterBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = ''; $html = '';
$html = $this->getSimpleHTMLDOM($this->getURI()); $html = getSimpleHTMLDOM($this->getURI());
if(!$html){ if(!$html){
switch($this->queriedContext){ switch($this->queriedContext){
case 'By keyword or hashtag': case 'By keyword or hashtag':
$this->returnServerError('No results for this query.'); returnServerError('No results for this query.');
case 'By username': case 'By username':
$this->returnServerError('Requested username can\'t be found.'); returnServerError('Requested username can\'t be found.');
} }
} }

View file

@ -34,8 +34,8 @@ class UnsplashBridge extends BridgeAbstract {
for ($page = 1; $page <= $lastpage; $page++) { for ($page = 1; $page <= $lastpage; $page++) {
$link = self::URI.'/grid?page='.$page; $link = self::URI.'/grid?page='.$page;
$html = $this->getSimpleHTMLDOM($link) $html = getSimpleHTMLDOM($link)
or $this->returnServerError('No results for this query.'); or returnServerError('No results for this query.');
if ($page === 1) { if ($page === 1) {
preg_match('/=(\d+)$/', $html->find('.pagination > a[!class]', -1)->href, $matches); preg_match('/=(\d+)$/', $html->find('.pagination > a[!class]', -1)->href, $matches);

View file

@ -18,8 +18,8 @@ class ViadeoCompanyBridge extends BridgeAbstract{
$html = ''; $html = '';
$link = self::URI.'fr/company/'.$this->getInput('c'); $link = self::URI.'fr/company/'.$this->getInput('c');
$html = $this->getSimpleHTMLDOM($link) $html = getSimpleHTMLDOM($link)
or $this->returnServerError('Could not request Viadeo.'); or returnServerError('Could not request Viadeo.');
foreach($html->find('//*[@id="company-newsfeed"]/ul/li') as $element) { foreach($html->find('//*[@id="company-newsfeed"]/ul/li') as $element) {
$title = $element->find('p', 0)->innertext; $title = $element->find('p', 0)->innertext;

View file

@ -17,8 +17,8 @@ class VineBridge extends BridgeAbstract {
$html = ''; $html = '';
$uri = self::URI.'/u/'.$this->getInput('u').'?mode=list'; $uri = self::URI.'/u/'.$this->getInput('u').'?mode=list';
$html = $this->getSimpleHTMLDOM($uri) $html = getSimpleHTMLDOM($uri)
or $this->returnServerError('No results for this query.'); or returnServerError('No results for this query.');
foreach($html->find('.post') as $element) { foreach($html->find('.post') as $element) {
$a = $element->find('a', 0); $a = $element->find('a', 0);

View file

@ -19,8 +19,8 @@ class VkBridge extends BridgeAbstract {
return static::URI.urlencode($this->getInput('u')); return static::URI.urlencode($this->getInput('u'));
} }
public function collectData(){ public function collectData(){
$text_html = $this->getContents($this->getURI()) $text_html = getContents($this->getURI())
or $this->returnServerError('No results for group or user name "'.$this->getInput('u').'".'); or returnServerError('No results for group or user name "'.$this->getInput('u').'".');
$text_html = iconv('windows-1251', 'utf-8', $text_html); $text_html = iconv('windows-1251', 'utf-8', $text_html);
$html = str_get_html($text_html); $html = str_get_html($text_html);

View file

@ -34,8 +34,8 @@ class WallpaperStopBridge extends BridgeAbstract {
for ($page = 1; $page <= $lastpage; $page++) { for ($page = 1; $page <= $lastpage; $page++) {
$link = self::URI.'/'.$category.'-wallpaper/'.(!empty($subcategory)?$subcategory.'-wallpaper/':'').'desktop-wallpaper-'.$page.'.html'; $link = self::URI.'/'.$category.'-wallpaper/'.(!empty($subcategory)?$subcategory.'-wallpaper/':'').'desktop-wallpaper-'.$page.'.html';
$html = $this->getSimpleHTMLDOM($link) $html = getSimpleHTMLDOM($link)
or $this->returnServerError('No results for this query.'); or returnServerError('No results for this query.');
if ($page === 1) { if ($page === 1) {
preg_match('/-(\d+)\.html$/', $html->find('.pagination > .last', 0)->href, $matches); preg_match('/-(\d+)\.html$/', $html->find('.pagination > .last', 0)->href, $matches);

View file

@ -18,7 +18,7 @@ class WeLiveSecurityBridge extends FeedExpander {
protected function parseItem($item){ protected function parseItem($item){
$item = parent::parseItem($item); $item = parent::parseItem($item);
$article_html = $this->getSimpleHTMLDOMCached($item['uri']); $article_html = getSimpleHTMLDOMCached($item['uri']);
if(!$article_html){ if(!$article_html){
$item['content'] .= '<p>Could not request '.$this->getName().': '.$item['uri'].'</p>'; $item['content'] .= '<p>Could not request '.$this->getName().': '.$item['uri'].'</p>';
return $item; return $item;

View file

@ -20,19 +20,19 @@ class WhydBridge extends BridgeAbstract{
$html = ''; $html = '';
if (strlen(preg_replace("/[^0-9a-f]/",'', $this->getInput('u'))) == 24){ if (strlen(preg_replace("/[^0-9a-f]/",'', $this->getInput('u'))) == 24){
// is input the userid ? // is input the userid ?
$html = $this->getSimpleHTMLDOM( $html = getSimpleHTMLDOM(
self::URI.'u/'.preg_replace("/[^0-9a-f]/",'', $this->getInput('u')) self::URI.'u/'.preg_replace("/[^0-9a-f]/",'', $this->getInput('u'))
) or $this->returnServerError('No results for this query.'); ) or returnServerError('No results for this query.');
} else { // input may be the username } else { // input may be the username
$html = $this->getSimpleHTMLDOM( $html = getSimpleHTMLDOM(
self::URI.'search?q='.urlencode($this->getInput('u')) self::URI.'search?q='.urlencode($this->getInput('u'))
) or $this->returnServerError('No results for this query.'); ) or returnServerError('No results for this query.');
for ($j = 0; $j < 5; $j++) { for ($j = 0; $j < 5; $j++) {
if (strtolower($html->find('div.user', $j)->find('a',0)->plaintext) == strtolower($this->getInput('u'))) { if (strtolower($html->find('div.user', $j)->find('a',0)->plaintext) == strtolower($this->getInput('u'))) {
$html = $this->getSimpleHTMLDOM( $html = getSimpleHTMLDOM(
self::URI . $html->find('div.user', $j)->find('a', 0)->getAttribute('href') self::URI . $html->find('div.user', $j)->find('a', 0)->getAttribute('href')
) or $this->returnServerError('No results for this query'); ) or returnServerError('No results for this query');
break; break;
} }
} }

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