bridges: Fix coding styles

This commit is a squash of all commits that fix coding styles
for the new coding style policy.

[ABCTabsBridge] Fix coding style
[AcrimedBridge] Fix coding style
[AllocineFRBridge] Fix coding style
[AnimeUltimeBridge] Fix coding style
[Arte7Bridge] Fix coding style
[AskfmBridge] Fix coding style
[BandcampBridge] Fix coding style
[BastaBridge] Fix coding style
[BlaguesDeMerdeBridge] Fix coding style
[BooruprojectBridge] Fix coding style
[CADBridge] Fix coding style
[CNETBridge] Fix coding style
[CastorusBridge] Fix coding style
[CollegeDeFranceBridge] Fix coding style
[CommonDreamsBridge] Fix coding style
[CopieDoubleBridge] Fix coding style
[CourrierInternationalBridge] Fix coding style
[CpasbienBridge] Fix coding style
[CryptomeBridge] Fix coding style
[DailymotionBridge] Fix coding style
[DanbooruBridge] Fix coding style
[DansTonChatBridge] Fix coding style
[DauphineLibereBridge] Fix coding style
[DeveloppezDotComBridge] Fix coding style
[DemoBridge] Fix coding style
[DilbertBridge] Fix coding style
[DuckDuckGoBridge] Fix coding style
[DollbooruBridge] Fix coding style
[EliteDangerousGalnetBridge] Fix coding style
[ElsevierBridge] Fix coding style
[EstCeQuonMetEnProdBridge] Fix coding style
[EZTVBridge] Fix coding style
[FacebookBridge] Fix coding style
[FeedExpanderExampleBridge] Fix coding style
[FB2Bridge] Fix coding style
[FierPandaBridge] Fix coding style
[FlickrBridge] Fix coding style
[FootitoBridge] Fix coding style
[FourchanBridge] Fix coding style
[FuturaSciencesBridge] Fix coding style
[GBAtempBridge] Fix coding style
[GelbooruBridge] Fix coding style
[GiphyBridge] Fix coding style
[GithubIssueBridge] Fix coding style
[GizmodoBridge] Fix coding style
[GoComicsBridge] Fix coding style
[GooglePlusPostBridge] Fix coding style
[GoogleSearchBridge] Fix coding style
[HDWallpapersBridge] Fix coding style
[HentaiHavenBridge] Fix coding style
[IdenticaBridge] Fix coding style
[InstagramBridge] Fix coding style
[IsoHuntBridge] Fix coding style
[JapanExpoBridge] Fix coding style
[KonachanBridge] Fix coding style
[KoreusBridge] Fix coding style
[KununuBridge] Fix coding style
[LeBonCoinBridge] Fix coding style
[LegifranceJOBBridge] Fix coding style
[LeMondeInformatiqueBridge] Fix coding style
[LesJoiesDuCodeBridge] Fix coding style
[LichessBridge] Fix coding style
[LinkedInCompanyBridge] Fix coding style
[LolibooruBridge] Fix coding style
[LWNprevBridge] Fix coding style
[MangareaderBridge] Fix coding style
[MilbooruBridge] Fix coding style
[MixCloudBridge] Fix coding style
[MoebooruBridge] Fix coding style
[MondeDiploBridge] Fix coding style
[MsnMondeBridge] Fix coding style
[MspabooruBridge] Fix coding style
[NasaApodBridge] Fix coding style
[NeuviemeArtBridge] Fix coding style
[NextgovBridge] Fix coding style
[NextInpactBridge] Fix coding style
[NiceMatinBridge] Fix coding style
[NovelUpdatesBridge] Fix coding style
[OpenClassroomsBridge] Fix coding style
[ParuVenduImmoBridge] Fix coding style
[PickyWallpapersBridge] Fix coding style
[PinterestBridge] Fix coding style
[PlanetLibreBridge] Fix coding style
[ReadComicsBridge] Fix coding style
[Releases3DSBridge] Fix coding style
[ReporterreBridge] Fix coding style
[RTBFBridge] Fix coding style
[Rue89Bridge] Fix coding style
[Rule34Bridge] Fix coding style
[Rule34pahealBridge] Fix coding style
[SafebooruBridge] Fix coding style
[SakugabooruBridge] Fix coding style
[ScmbBridge] Fix coding style
[ScoopItBridge] Fix coding style
[SensCritiqueBridge] Fix coding style
[SexactuBridge] Fix coding style
[ShanaprojectBridge] Fix coding style
[Shimmie2Bridge] Fix coding style
[SoundcloudBridge] Fix coding style
[StripeAPIChangeLogBridge] Fix coding style
[SuperbWallpapersBridge] Fix coding style
[T411Bridge] Fix coding style
[TagBoardBridge] Fix coding style
[TbibBridge] Fix coding style
[TheCodingLoveBridge] Fix coding style
[TheHackerNewsBridge] Fix coding style
[ThePirateBayBridge] Fix coding style
[TheTVDBBridge] Fix coding style
[Torrent9Bridge] Fix coding style
[TwitterBridge] Fix coding style
[UnsplashBridge] Fix coding style
[ViadeoCompanyBridge] Fix coding style
[VineBridge] Fix coding style
[VkBridge] Fix coding style
[WallpaperStopBridge] Fix coding style
[WebfailBridge] Fix coding style
[WeLiveSecurityBridge] Fix coding style
[WhydBridge] Fix coding style
[WikipediaBridge] Fix coding style
[WordPressBridge] Fix coding style
[WorldOfTanksBridge] Fix coding style
[XbooruBridge] Fix coding style
[YandereBridge] Fix coding style
[YoutubeBridge] Fix coding style
[ZDNetBridge] Fix coding style
This commit is contained in:
logmanoriginal 2017-02-11 16:16:56 +01:00
parent 22a7666d2b
commit 6f24858124
125 changed files with 6689 additions and 5961 deletions

View file

@ -1,24 +1,42 @@
<?php
class ABCTabsBridge extends BridgeAbstract {
const MAINTAINER = "kranack";
const NAME = "ABC Tabs Bridge";
const URI = "http://www.abc-tabs.com/";
const DESCRIPTION = "Returns 22 newest tabs";
const MAINTAINER = 'kranack';
const NAME = 'ABC Tabs Bridge';
const URI = 'http://www.abc-tabs.com/';
const DESCRIPTION = 'Returns 22 newest tabs';
public function collectData(){
$html = '';
$html = getSimpleHTMLDOM(static::URI.'tablatures/nouveautes.html') or 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);
foreach ($table->find('tr') as $tab)
{
$item = array();
$item['author'] = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext;
$item['title'] = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext;
$item['content'] = 'Le ' . $tab->find('td', 0)->plaintext . '<br> Par: ' . $tab->find('td', 5)->plaintext . '<br> Type: ' . $tab->find('td', 3)->plaintext;
$item['id'] = static::URI . $tab->find('td', 2)->find('a', 0)->getAttribute('href');
$item['uri'] = static::URI . $tab->find('td', 2)->find('a', 0)->getAttribute('href');
$item['author'] = $tab->find('td', 1)->plaintext
. ' - '
. $tab->find('td', 2)->plaintext;
$item['title'] = $tab->find('td', 1)->plaintext
. ' - '
. $tab->find('td', 2)->plaintext;
$item['content'] = 'Le '
. $tab->find('td', 0)->plaintext
. '<br> Par: '
. $tab->find('td', 5)->plaintext
. '<br> Type: '
. $tab->find('td', 3)->plaintext;
$item['id'] = static::URI
. $tab->find('td', 2)->find('a', 0)->getAttribute('href');
$item['uri'] = static::URI
. $tab->find('td', 2)->find('a', 0)->getAttribute('href');
$this->items[] = $item;
}
}

View file

@ -1,11 +1,11 @@
<?php
class AcrimedBridge extends FeedExpander {
const MAINTAINER = "qwertygc";
const NAME = "Acrimed Bridge";
const URI = "http://www.acrimed.org/";
const MAINTAINER = 'qwertygc';
const NAME = 'Acrimed Bridge';
const URI = 'http://www.acrimed.org/';
const CACHE_TIMEOUT = 4800; //2hours
const DESCRIPTION = "Returns the newest articles.";
const DESCRIPTION = 'Returns the newest articles';
public function collectData(){
$this->collectExpandableDatas(static::URI . 'spip.php?page=backend');

View file

@ -1,12 +1,11 @@
<?php
class AllocineFRBridge extends BridgeAbstract {
const MAINTAINER = "superbaillot.net";
const NAME = "Allo Cine Bridge";
const MAINTAINER = 'superbaillot.net';
const NAME = 'Allo Cine Bridge';
const CACHE_TIMEOUT = 25200; // 7h
const URI = "http://www.allocine.fr/";
const DESCRIPTION = "Bridge for allocine.fr";
const URI = 'http://www.allocine.fr/';
const DESCRIPTION = 'Bridge for allocine.fr';
const PARAMETERS = array( array(
'category' => array(
'name' => 'category',
@ -58,16 +57,14 @@ class AllocineFRBridge extends BridgeAbstract{
public function collectData(){
$html = getSimpleHTMLDOM($this->getURI())
or returnServerError("Could not request ".$this->getURI()." !");
or returnServerError('Could not request ' . $this->getURI() . ' !');
$category = array_search(
$this->getInput('category'),
self::PARAMETERS[$this->queriedContext]['category']['values']
);
foreach($html->find('figure.media-meta-fig') as $element)
{
foreach($html->find('figure.media-meta-fig') as $element){
$item = array();
$title = $element->find('div.titlebar h3.title a', 0);

View file

@ -48,10 +48,14 @@ class AnimeUltimeBridge extends BridgeAbstract {
//Retrieve day and build date information
$dateString = $daySection->plaintext;
$day = intval(substr($dateString, strpos($dateString, ' ') + 1, 2));
$item_date = strtotime(str_pad($day, 2, '0', STR_PAD_LEFT).'-'
.substr($requestFilter, 0, 2).'-'
$item_date = strtotime(str_pad($day, 2, '0', STR_PAD_LEFT)
. '-'
. substr($requestFilter, 0, 2)
. '-'
. substr($requestFilter, 2, 4));
$release = $daySection->next_sibling()->next_sibling()->first_child(); //<h3>day</h3><br /><table><tr> <-- useful data in table rows
//<h3>day</h3><br /><table><tr> <-- useful data in table rows
$release = $daySection->next_sibling()->next_sibling()->first_child();
//Process each release of that day, ignoring first table row: contains table headers
while(!is_null($release = $release->next_sibling())) {
@ -61,19 +65,27 @@ class AnimeUltimeBridge extends BridgeAbstract {
$item_link_element = $release->find('td', 0)->find('a', 0);
$item_uri = self::URI . $item_link_element->href;
$item_name = html_entity_decode($item_link_element->plaintext);
$item_episode = html_entity_decode(str_pad($release->find('td', 1)->plaintext, 2, '0', STR_PAD_LEFT));
$item_episode = html_entity_decode(
str_pad(
$release->find('td', 1)->plaintext,
2,
'0',
STR_PAD_LEFT
)
);
$item_fansub = $release->find('td', 2)->plaintext;
$item_type = $release->find('td', 4)->plaintext;
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 = getContents($item_uri)
or returnServerError('Could not request Anime-Ultime: ' . $item_uri);
$item_description = substr(
$html_item,
strpos($html_item, 'class="principal_contain" align="center">')
+ 41
strpos($html_item, 'class="principal_contain" align="center">') + 41
);
$item_description = substr($item_description,
0,

View file

@ -1,11 +1,11 @@
<?php
class Arte7Bridge extends BridgeAbstract {
const MAINTAINER = "mitsukarenai";
const NAME = "Arte +7";
const URI = "http://www.arte.tv/";
const MAINTAINER = 'mitsukarenai';
const NAME = 'Arte +7';
const URI = 'http://www.arte.tv/';
const CACHE_TIMEOUT = 1800; // 30min
const DESCRIPTION = "Returns newest videos from ARTE +7";
const DESCRIPTION = 'Returns newest videos from ARTE +7';
const PARAMETERS = array(
'Catégorie (Français)' => array(
'catfr' => array(
@ -21,7 +21,6 @@
'Découverte' => 'découverte',
'Histoire' => 'histoire',
'Junior' => 'junior'
)
)
),
@ -45,7 +44,6 @@
);
public function collectData(){
switch($this->queriedContext){
case 'Catégorie (Français)':
$category = $this->getInput('catfr');
@ -59,7 +57,8 @@
$url = self::URI . 'guide/' . $lang . '/plus7/' . $category;
$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('}}', $input[1]);
$input = $input[0] . '}}';
@ -69,21 +68,33 @@
$input = $input[0] . '}]}';
}
$input_json = json_decode(html_entity_decode($input, ENT_QUOTES), TRUE);
$input_json = json_decode(html_entity_decode($input, ENT_QUOTES), true);
foreach($input_json['videos'] as $element) {
$item = array();
$item['uri'] = str_replace("autoplay=1", "", $element['url']);
$item['id'] = $element['id'];
$hack_broadcast_time = $element['rights_end'];
$hack_broadcast_time = strtok($hack_broadcast_time, 'T');
$hack_broadcast_time = strtok('T');
$item['timestamp'] = strtotime($element['scheduled_on'] . 'T' . $hack_broadcast_time);
$item['title'] = $element['title'];
if(!empty($element['subtitle']))
$item['title'] = $element['title'] . ' | ' . $element['subtitle'];
$item['duration'] = round((int)$element['duration'] / 60);
$item['content'] = $element['teaser'].'<br><br>'.$item['duration'].'min<br><a href="'.$item['uri'].'"><img src="' . $element['thumbnail_url'] . '" /></a>';
$item['content'] = $element['teaser']
. '<br><br>'
. $item['duration']
. 'min<br><a href="'
. $item['uri']
. '"><img src="'
. $element['thumbnail_url']
. '" /></a>';
$this->items[] = $item;
}
}

View file

@ -1,11 +1,11 @@
<?php
class AskfmBridge extends BridgeAbstract {
const MAINTAINER = "az5he6ch";
const NAME = "Ask.fm Answers";
const URI = "http://ask.fm/";
const MAINTAINER = 'az5he6ch';
const NAME = 'Ask.fm Answers';
const URI = 'http://ask.fm/';
const CACHE_TIMEOUT = 300; //5 min
const DESCRIPTION = "Returns answers from an Ask.fm user";
const DESCRIPTION = 'Returns answers from an Ask.fm user';
const PARAMETERS = array(
'Ask.fm username' => array(
'u' => array(
@ -23,17 +23,31 @@ class AskfmBridge extends BridgeAbstract{
$item = array();
$item['uri'] = self::URI . $element->find('a.streamItemsAge', 0)->href;
$question = trim($element->find('h1.streamItemContent-question', 0)->innertext);
$item['title'] = trim(htmlspecialchars_decode($element->find('h1.streamItemContent-question',0)->plaintext, ENT_QUOTES));
$item['title'] = trim(
htmlspecialchars_decode($element->find('h1.streamItemContent-question', 0)->plaintext,
ENT_QUOTES
)
);
$answer = trim($element->find('p.streamItemContent-answer', 0)->innertext);
#$item['update'] = $element->find('a.streamitemsage',0)->data-hint; // Doesn't work, DOM parser doesn't seem to like data-hint, dunno why
$visual = $element->find('div.streamItemContent-visual',0)->innertext; // This probably should be cleaned up, especially for YouTube embeds
// Doesn't work, DOM parser doesn't seem to like data-hint, dunno why
#$item['update'] = $element->find('a.streamitemsage',0)->data-hint;
// This probably should be cleaned up, especially for YouTube embeds
$visual = $element->find('div.streamItemContent-visual', 0)->innertext;
//Fix tracking links, also doesn't work
foreach($element->find('a') as $link){
if(strpos($link->href, 'l.ask.fm') !== false) {
#$link->href = str_replace('#_=_', '', get_headers($link->href, 1)['Location']); // Too slow
// Too slow
#$link->href = str_replace('#_=_', '', get_headers($link->href, 1)['Location']);
$link->href = $link->plaintext;
}
}
$content = '<p>' . $question . '</p><p>' . $answer . '</p><p>' . $visual . '</p>';
// Fix relative links without breaking // scheme used by YouTube stuff
$content = preg_replace('#href="\/(?!\/)#', 'href="' . self::URI, $content);

View file

@ -1,11 +1,11 @@
<?php
class BandcampBridge extends BridgeAbstract {
const MAINTAINER = "sebsauvage";
const NAME = "Bandcamp Tag";
const URI = "http://bandcamp.com/";
const MAINTAINER = 'sebsauvage';
const NAME = 'Bandcamp Tag';
const URI = 'http://bandcamp.com/';
const CACHE_TIMEOUT = 600; // 10min
const DESCRIPTION = "New bandcamp release by tag";
const DESCRIPTION = 'New bandcamp release by tag';
const PARAMETERS = array( array(
'tag' => array(
'name' => 'tag',
@ -24,9 +24,21 @@ class BandcampBridge extends BridgeAbstract{
$uri = rtrim($uri, "')");
$item = array();
$item['author'] = $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext;
$item['title'] = $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext;
$item['content'] = '<img src="' . $uri . '"/><br/>' . $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext;
$item['author'] = $release->find('div.itemsubtext', 0)->plaintext
. ' - '
. $release->find('div.itemtext', 0)->plaintext;
$item['title'] = $release->find('div.itemsubtext', 0)->plaintext
. ' - '
. $release->find('div.itemtext', 0)->plaintext;
$item['content'] = '<img src="'
. $uri
. '"/><br/>'
. $release->find('div.itemsubtext', 0)->plaintext
. ' - '
. $release->find('div.itemtext', 0)->plaintext;
$item['id'] = $release->find('a', 0)->getAttribute('href');
$item['uri'] = $release->find('a', 0)->getAttribute('href');
$this->items[] = $item;
@ -38,6 +50,6 @@ class BandcampBridge extends BridgeAbstract{
}
public function getName(){
return $this->getInput('tag') .' - '.'Bandcamp Tag';
return $this->getInput('tag') . ' - Bandcamp Tag';
}
}

View file

@ -1,19 +1,22 @@
<?php
class BastaBridge extends BridgeAbstract {
const MAINTAINER = "qwertygc";
const NAME = "Bastamag Bridge";
const URI = "http://www.bastamag.net/";
const MAINTAINER = 'qwertygc';
const NAME = 'Bastamag Bridge';
const URI = 'http://www.bastamag.net/';
const CACHE_TIMEOUT = 7200; // 2h
const DESCRIPTION = "Returns the newest articles.";
const DESCRIPTION = 'Returns the newest articles.';
public function collectData(){
// Replaces all relative image URLs by absolute URLs. Relative URLs always start with 'local/'!
function ReplaceImageUrl($content){
// Replaces all relative image URLs by absolute URLs.
// Relative URLs always start with 'local/'!
function replaceImageUrl($content){
return preg_replace('/src=["\']{1}([^"\']+)/ims', 'src=\'' . self::URI . '$1\'', $content);
}
$html = getSimpleHTMLDOM(self::URI . 'spip.php?page=backend')
or returnServerError('Could not request Bastamag.');
$limit = 0;
foreach($html->find('item') as $element){
@ -22,11 +25,10 @@ class BastaBridge extends BridgeAbstract{
$item['title'] = $element->find('title', 0)->innertext;
$item['uri'] = $element->find('guid', 0)->plaintext;
$item['timestamp'] = strtotime($element->find('dc:date', 0)->plaintext);
$item['content'] = ReplaceImageUrl(getSimpleHTMLDOM($item['uri'])->find('div.texte', 0)->innertext);
$item['content'] = replaceImageUrl(getSimpleHTMLDOM($item['uri'])->find('div.texte', 0)->innertext);
$this->items[] = $item;
$limit++;
}
}
}
}
?>

View file

@ -1,12 +1,11 @@
<?php
class BlaguesDeMerdeBridge extends BridgeAbstract {
const MAINTAINER = "superbaillot.net";
const NAME = "Blagues De Merde";
const URI = "http://www.blaguesdemerde.fr/";
const MAINTAINER = 'superbaillot.net';
const NAME = 'Blagues De Merde';
const URI = 'http://www.blaguesdemerde.fr/';
const CACHE_TIMEOUT = 7200; // 2h
const DESCRIPTION = "Blagues De Merde";
const DESCRIPTION = 'Blagues De Merde';
public function collectData(){
$html = getSimpleHTMLDOM(self::URI)
@ -15,19 +14,18 @@ class BlaguesDeMerdeBridge extends BridgeAbstract{
foreach($html->find('article.joke_contener') as $element){
$item = array();
$temp = $element->find('a');
if(isset($temp[2]))
{
if(isset($temp[2])){
$item['content'] = trim($element->find('div.joke_text_contener', 0)->innertext);
$uri = $temp[2]->href;
$item['uri'] = $uri;
$item['title'] = substr($uri, (strrpos($uri, "/") + 1));
$date = $element->find("li.bdm_date",0)->innertext;
$date = $element->find('li.bdm_date', 0)->innertext;
$time = mktime(0, 0, 0, substr($date, 3, 2), substr($date, 0, 2), substr($date, 6, 4));
$item['timestamp'] = $time;
$item['author'] = $element->find("li.bdm_pseudo",0)->innertext;;
$item['author'] = $element->find('li.bdm_pseudo', 0)->innertext;
$this->items[] = $item;
}
}
}
}
?>

View file

@ -3,18 +3,19 @@ require_once('GelbooruBridge.php');
class BooruprojectBridge extends GelbooruBridge {
const MAINTAINER = "mitsukarenai";
const NAME = "Booruproject";
const URI = "http://booru.org/";
const DESCRIPTION = "Returns images from given page of booruproject";
const MAINTAINER = 'mitsukarenai';
const NAME = 'Booruproject';
const URI = 'http://booru.org/';
const DESCRIPTION = 'Returns images from given page of booruproject';
const PARAMETERS = array(
'global' => array(
'p' => array(
'name' => 'page',
'type' => 'number'
),
't'=>array('name'=>'tags')
't' => array(
'name' => 'tags'
)
),
'Booru subdomain (subdomain.booru.org)' => array(
'i' => array(

View file

@ -1,10 +1,10 @@
<?php
class CADBridge extends FeedExpander {
const MAINTAINER = "nyutag";
const NAME = "CAD Bridge";
const URI = "http://www.cad-comic.com/";
const MAINTAINER = 'nyutag';
const NAME = 'CAD Bridge';
const URI = 'http://www.cad-comic.com/';
const CACHE_TIMEOUT = 7200; //2h
const DESCRIPTION = "Returns the newest articles.";
const DESCRIPTION = 'Returns the newest articles.';
public function collectData(){
$this->collectExpandableDatas('http://cdn2.cad-comic.com/rss.xml', 10);
@ -12,11 +12,11 @@ class CADBridge extends FeedExpander {
protected function parseItem($newsItem){
$item = parent::parseItem($newsItem);
$item['content'] = $this->CADExtractContent($item['uri']);
$item['content'] = $this->extractCADContent($item['uri']);
return $item;
}
private function CADExtractContent($url) {
private function extractCADContent($url) {
$html3 = getSimpleHTMLDOMCached($url);
// The request might fail due to missing https support or wrong URL
@ -43,4 +43,3 @@ class CADBridge extends FeedExpander {
return '<img src="' . $img . '"/>';
}
}
?>

View file

@ -5,36 +5,43 @@ class CNETBridge extends BridgeAbstract {
const NAME = 'CNET News';
const URI = 'http://www.cnet.com/';
const CACHE_TIMEOUT = 1800; // 30min
const DESCRIPTION = 'Returns the newest articles. <br /> You may specify a topic found in some section URLs, else all topics are selected.';
const DESCRIPTION = 'Returns the newest articles. <br /> You may specify a
topic found in some section URLs, else all topics are selected.';
const PARAMETERS = array( array(
'topic'=>array('name'=>'Topic name')
'topic' => array(
'name' => 'Topic name'
)
));
public function collectData(){
function ExtractFromDelimiters($string, $start, $end) {
function extractFromDelimiters($string, $start, $end){
if(strpos($string, $start) !== false){
$section_retrieved = substr($string, strpos($string, $start) + strlen($start));
$section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end));
return $section_retrieved;
} return false;
}
function StripWithDelimiters($string, $start, $end) {
return false;
}
function stripWithDelimiters($string, $start, $end){
while(strpos($string, $start) !== false){
$section_to_remove = substr($string, strpos($string, $start));
$section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end));
$string = str_replace($section_to_remove, '', $string);
} return $string;
}
function CleanArticle($article_html) {
return $string;
}
function cleanArticle($article_html){
$article_html = '<p>' . substr($article_html, strpos($article_html, '<p>') + 3);
$article_html = StripWithDelimiters($article_html, '<span class="credit">', '</span>');
$article_html = StripWithDelimiters($article_html, '<script', '</script>');
$article_html = StripWithDelimiters($article_html, '<div class="shortcode related-links', '</div>');
$article_html = StripWithDelimiters($article_html, '<a class="clickToEnlarge">', '</a>');
$article_html = stripWithDelimiters($article_html, '<span class="credit">', '</span>');
$article_html = stripWithDelimiters($article_html, '<script', '</script>');
$article_html = stripWithDelimiters($article_html, '<div class="shortcode related-links', '</div>');
$article_html = stripWithDelimiters($article_html, '<a class="clickToEnlarge">', '</a>');
return $article_html;
}
@ -44,17 +51,23 @@ class CNETBridge extends BridgeAbstract {
foreach($html->find('div.assetBody') as $element){
if($limit < 8){
$article_title = trim($element->find('h2', 0)->plaintext);
$article_uri = self::URI . ($element->find('a', 0)->href);
$article_timestamp = strtotime($element->find('time.assetTime', 0)->plaintext);
$article_author = trim($element->find('a[rel=author]', 0)->plaintext);
if(!empty($article_title) && !empty($article_uri) && strpos($article_uri, '/news/') !== false){
$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_html = getSimpleHTMLDOM($article_uri)
or returnServerError('Could not request CNET: ' . $article_uri);
$article_content = trim(
cleanArticle(
extractFromDelimiters(
$article_html,
'<div class="articleContent',
'<footer>'
)
)
);
$item = array();
$item['uri'] = $article_uri;

View file

@ -1,10 +1,10 @@
<?php
class CastorusBridge extends BridgeAbstract {
const MAINTAINER = "logmanoriginal";
const NAME = "Castorus Bridge";
const MAINTAINER = 'logmanoriginal';
const NAME = 'Castorus Bridge';
const URI = 'http://www.castorus.com';
const CACHE_TIMEOUT = 600; // 10min
const DESCRIPTION = "Returns the latest changes";
const DESCRIPTION = 'Returns the latest changes';
const PARAMETERS = array(
'Get latest changes' => array(),
@ -28,8 +28,8 @@ class CastorusBridge extends BridgeAbstract {
)
);
// Extracts the tile from an actitiy
private function ExtractActivityTitle($activity){
// Extracts the title from an actitiy
private function extractActivityTitle($activity){
$title = $activity->find('a', 0);
if(!$title)
@ -39,7 +39,7 @@ class CastorusBridge extends BridgeAbstract {
}
// Extracts the url from an actitiy
private function ExtractActivityUrl($activity){
private function extractActivityUrl($activity){
$url = $activity->find('a', 0);
if(!$url)
@ -49,7 +49,7 @@ class CastorusBridge extends BridgeAbstract {
}
// Extracts the time from an activity
private function ExtractActivityTime($activity){
private function extractActivityTime($activity){
// Unfortunately the time is part of the parent node,
// so we have to clear all child nodes first
$nodes = $activity->find('*');
@ -65,7 +65,7 @@ class CastorusBridge extends BridgeAbstract {
}
// Extracts the price change
private function ExtractActivityPrice($activity){
private function extractActivityPrice($activity){
$price = $activity->find('span', 1);
if(!$price)
@ -91,17 +91,24 @@ class CastorusBridge extends BridgeAbstract {
foreach($activities as $activity){
$item = array();
$item['title'] = $this->ExtractActivityTitle($activity);
$item['uri'] = $this->ExtractActivityUrl($activity);
$item['timestamp'] = $this->ExtractActivityTime($activity);
$item['content'] = '<a href="' . $item['uri'] . '">' . $item['title'] . '</a><br><p>'
. $this->ExtractActivityPrice($activity) . '</p>';
$item['title'] = $this->extractActivityTitle($activity);
$item['uri'] = $this->extractActivityUrl($activity);
$item['timestamp'] = $this->extractActivityTime($activity);
$item['content'] = '<a href="'
. $item['uri']
. '">'
. $item['title']
. '</a><br><p>'
. $this->extractActivityPrice($activity)
. '</p>';
if(isset($zip_filter) && !(substr($item['title'], 0, strlen($zip_filter)) === $zip_filter)){
if(isset($zip_filter)
&& !(substr($item['title'], 0, strlen($zip_filter)) === $zip_filter)){
continue; // Skip this item
}
if(isset($city_filter) && !(substr($item['title'], strpos($item['title'], ' ') + 1, strlen($city_filter)) === $city_filter)){
if(isset($city_filter)
&& !(substr($item['title'], strpos($item['title'], ' ') + 1, strlen($city_filter)) === $city_filter)){
continue; // Skip this item
}

View file

@ -1,11 +1,11 @@
<?php
class CollegeDeFranceBridge extends BridgeAbstract {
const MAINTAINER = "pit-fgfjiudghdf";
const NAME = "CollegeDeFrance";
const URI = "http://www.college-de-france.fr/";
const MAINTAINER = 'pit-fgfjiudghdf';
const NAME = 'CollegeDeFrance';
const URI = 'http://www.college-de-france.fr/';
const CACHE_TIMEOUT = 10800; // 3h
const DESCRIPTION = "Returns the latest audio and video from CollegeDeFrance";
const DESCRIPTION = 'Returns the latest audio and video from CollegeDeFrance';
public function collectData(){
$months = array(
@ -22,34 +22,44 @@ class CollegeDeFranceBridge extends BridgeAbstract{
'11' => 'nov.',
'12' => 'déc.'
);
// The "API" used by the site returns a list of partial HTML in this form
/* <li>
* <a href="/site/thomas-romer/guestlecturer-2016-04-15-14h30.htm" data-target="after">
* <span class="date"><span class="list-icon list-icon-video"></span><span class="list-icon list-icon-audio"></span>15 avr. 2016</span>
* <span class="date"><span class="list-icon list-icon-video"></span>
* <span class="list-icon list-icon-audio"></span>15 avr. 2016</span>
* <span class="lecturer">Christopher Hays</span>
* <span class='title'>Imagery of Divine Suckling in the Hebrew Bible and the Ancient Near East</span>
* </a>
* </li>
*/
$html = 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 returnServerError('Could not request CollegeDeFrance.');
foreach($html->find('a[data-target]') as $element){
$item = array();
$item['title'] = $element->find('.title', 0)->plaintext;
// Most relative URLs contains an hour in addition to the date, so let's use it
// <a href="/site/yann-lecun/course-2016-04-08-11h00.htm" data-target="after">
//
// Sometimes there's an __1, perhaps it signifies an update "/site/patrick-boucheron/seminar-2016-05-03-18h00__1.htm"
// Sometimes there's an __1, perhaps it signifies an update
// "/site/patrick-boucheron/seminar-2016-05-03-18h00__1.htm"
//
// But unfortunately some don't have any hours info
// <a href="/site/institut-physique/The-Mysteries-of-Decoherence-Sebastien-Gleyzes-[Video-3-35].htm" data-target="after">
// <a href="/site/institut-physique/
// The-Mysteries-of-Decoherence-Sebastien-Gleyzes-[Video-3-35].htm" data-target="after">
$timezone = new DateTimeZone('Europe/Paris');
// strpos($element->href, '201') will break in 2020 but it'll probably break prior to then due to site changes anyway
// strpos($element->href, '201') will break in 2020 but it'll
// probably break prior to then due to site changes anyway
$d = DateTime::createFromFormat(
'!Y-m-d-H\hi',
substr($element->href, strpos($element->href, '201'), 16),
$timezone
);
if(!$d){
$d = DateTime::createFromFormat(
'!d m Y',
@ -61,8 +71,12 @@ class CollegeDeFranceBridge extends BridgeAbstract{
$timezone
);
}
$item['timestamp'] = $d->format('U');
$item['content'] = $element->find('.lecturer', 0)->innertext . ' - ' . $element->find('.title', 0)->innertext;
$item['content'] = $element->find('.lecturer', 0)->innertext
. ' - '
. $element->find('.title', 0)->innertext;
$item['uri'] = self::URI . $element->href;
$this->items[] = $item;
}

View file

@ -1,10 +1,10 @@
<?php
class CommonDreamsBridge extends FeedExpander {
const MAINTAINER = "nyutag";
const NAME = "CommonDreams Bridge";
const URI = "http://www.commondreams.org/";
const DESCRIPTION = "Returns the newest articles.";
const MAINTAINER = 'nyutag';
const NAME = 'CommonDreams Bridge';
const URI = 'http://www.commondreams.org/';
const DESCRIPTION = 'Returns the newest articles.';
public function collectData(){
$this->collectExpandableDatas('http://www.commondreams.org/rss.xml', 10);
@ -12,11 +12,11 @@ class CommonDreamsBridge extends FeedExpander {
protected function parseItem($newsItem){
$item = parent::parseItem($newsItem);
$item['content'] = $this->CommonDreamsExtractContent($item['uri']);
$item['content'] = $this->extractContent($item['uri']);
return $item;
}
private function CommonDreamsExtractContent($url) {
private function extractContent($url){
$html3 = getSimpleHTMLDOMCached($url);
$text = $html3->find('div[class=field--type-text-with-summary]', 0)->innertext;
$html3->clear();

View file

@ -1,34 +1,30 @@
<?php
class CopieDoubleBridge extends BridgeAbstract {
const MAINTAINER = "superbaillot.net";
const NAME = "CopieDouble";
const URI = "http://www.copie-double.com/";
const MAINTAINER = 'superbaillot.net';
const NAME = 'CopieDouble';
const URI = 'http://www.copie-double.com/';
const CACHE_TIMEOUT = 14400; // 4h
const DESCRIPTION = "CopieDouble";
const DESCRIPTION = 'CopieDouble';
public function collectData(){
$html = getSimpleHTMLDOM(self::URI)
or returnServerError('Could not request CopieDouble.');
$table = $html->find('table table', 2);
foreach($table->find('tr') as $element)
{
foreach($table->find('tr') as $element){
$td = $element->find('td', 0);
if($td->class == "couleur_1")
{
$item = array();
if($td->class === 'couleur_1'){
$item = array();
$title = $td->innertext;
$pos = strpos($title, "<a");
$pos = strpos($title, '<a');
$title = substr($title, 0, $pos);
$item['title'] = $title;
}
elseif(strpos($element->innertext, "/images/suivant.gif") === false)
{
$a=$element->find("a", 0);
} elseif(strpos($element->innertext, "/images/suivant.gif") === false){
$a = $element->find('a', 0);
$item['uri'] = self::URI . $a->href;
$content = str_replace('src="/', 'src="/' . self::URI,$element->find("td", 0)->innertext);
$content = str_replace('href="/', 'href="' . self::URI,$content);
$item['content'] = $content;

View file

@ -1,42 +1,40 @@
<?php
class CourrierInternationalBridge extends BridgeAbstract {
const MAINTAINER = "teromene";
const NAME = "Courrier International Bridge";
const URI = "http://CourrierInternational.com/";
const MAINTAINER = 'teromene';
const NAME = 'Courrier International Bridge';
const URI = 'http://CourrierInternational.com/';
const CACHE_TIMEOUT = 300; // 5 min
const DESCRIPTION = "Courrier International bridge";
const DESCRIPTION = 'Courrier International bridge';
public function collectData(){
$html = getSimpleHTMLDOM(self::URI)
or returnServerError('Error.');
$element = $html->find("article");
$article_count = 1;
foreach($element as $article){
$item = array();
$item['uri'] = $article->parent->getAttribute("href");
$item['uri'] = $article->parent->getAttribute('href');
if(strpos($item['uri'], "http") === FALSE) {
if(strpos($item['uri'], 'http') === false){
$item['uri'] = self::URI . $item['uri'];
}
$page = getSimpleHTMLDOMCached($item['uri']);
$content = $page->find('.article-text', 0);
if(!$content){
$content = $page->find('.depeche-text', 0);
}
$item['content'] = sanitize($content);
$item['title'] = strip_tags($article->find(".title",0));
$item['title'] = strip_tags($article->find('.title', 0));
$dateTime = date_parse($page->find("time",0));
$dateTime = date_parse($page->find('time', 0));
$item['timestamp'] = mktime(
$dateTime['hour'],
@ -49,13 +47,9 @@ class CourrierInternationalBridge extends BridgeAbstract{
$this->items[] = $item;
$article_count ++;
if($article_count > 5) break;
}
if($article_count > 5)
break;
}
}
}
?>

View file

@ -1,11 +1,11 @@
<?php
class CpasbienBridge extends BridgeAbstract {
const MAINTAINER = "lagaisse";
const NAME = "Cpasbien Bridge";
const URI = "http://www.cpasbien.cm";
const MAINTAINER = 'lagaisse';
const NAME = 'Cpasbien Bridge';
const URI = 'http://www.cpasbien.cm';
const CACHE_TIMEOUT = 86400; // 24h
const DESCRIPTION = "Returns latest torrents from a request query";
const DESCRIPTION = 'Returns latest torrents from a request query';
const PARAMETERS = array( array(
'q' => array(
@ -21,9 +21,8 @@ class CpasbienBridge extends BridgeAbstract {
or returnServerError('No results for this query.');
foreach($html->find('#gauche',0)->find('div') as $episode){
if ($episode->getAttribute('class')=='ligne0' ||
$episode->getAttribute('class')=='ligne1')
{
if($episode->getAttribute('class') == 'ligne0'
|| $episode->getAttribute('class') == 'ligne1'){
$urlepisode = $episode->find('a', 0)->getAttribute('href');
$htmlepisode = getSimpleHTMLDOMCached($urlepisode, 86400 * 366 * 30);
@ -33,6 +32,7 @@ class CpasbienBridge extends BridgeAbstract {
$item['title'] = $episode->find('a', 0)->text();
$item['pubdate'] = $this->getCachedDate($urlepisode);
$textefiche = $htmlepisode->find('#textefiche', 0)->find('p', 1);
if(isset($textefiche)){
$item['content'] = $textefiche->text();
} else {
@ -49,7 +49,6 @@ class CpasbienBridge extends BridgeAbstract {
}
}
public function getName(){
return $this->getInput('q') . ' : ' . self::NAME;
}

View file

@ -1,11 +1,11 @@
<?php
class CryptomeBridge extends BridgeAbstract {
const MAINTAINER = "BoboTiG";
const NAME = "Cryptome";
const URI = "https://cryptome.org/";
const MAINTAINER = 'BoboTiG';
const NAME = 'Cryptome';
const URI = 'https://cryptome.org/';
const CACHE_TIMEOUT = 21600; //6h
const DESCRIPTION = "Returns the N most recent documents.";
const DESCRIPTION = 'Returns the N most recent documents.';
const PARAMETERS = array( array(
'n' => array(
@ -19,18 +19,24 @@ class CryptomeBridge extends BridgeAbstract{
public function collectData(){
$html = getSimpleHTMLDOM(self::URI)
or returnServerError('Could not request Cryptome.');
$number = $this->getInput('n');
if (!empty($number)) { /* number of documents */
/* number of documents */
if(!empty($number)){
$num = min($number, 20);
}
foreach($html->find('pre') as $element){
for($i = 0; $i < $num; ++$i){
$item = array();
$item['uri'] = self::URI . substr($element->find('a', $i)->href, 20);
$item['title'] = substr($element->find('b', $i)->plaintext, 22);
$item['content'] = preg_replace('#http://cryptome.org/#', self::URI, $element->find('b', $i)->innertext);
$item['content'] = preg_replace(
'#http://cryptome.org/#',
self::URI,
$element->find('b', $i)->innertext
);
$this->items[] = $item;
}
break;

View file

@ -1,11 +1,11 @@
<?php
class DailymotionBridge extends BridgeAbstract {
const MAINTAINER = "mitsukarenai";
const NAME = "Dailymotion Bridge";
const URI = "https://www.dailymotion.com/";
const MAINTAINER = 'mitsukarenai';
const NAME = 'Dailymotion Bridge';
const URI = 'https://www.dailymotion.com/';
const CACHE_TIMEOUT = 10800; // 3h
const DESCRIPTION = "Returns the 5 newest videos by username/playlist or search";
const DESCRIPTION = 'Returns the 5 newest videos by username/playlist or search';
const PARAMETERS = array (
'By username' => array(
@ -14,14 +14,12 @@ class DailymotionBridge extends BridgeAbstract{
'required' => true
)
),
'By playlist id' => array(
'p' => array(
'name' => 'playlist id',
'required' => true
)
),
'From search results' => array(
's' => array(
'name' => 'Search keyword',
@ -42,7 +40,9 @@ class DailymotionBridge extends BridgeAbstract{
}
$metadata['title'] = $html2->find('meta[property=og:title]', 0)->getAttribute('content');
$metadata['timestamp'] = strtotime($html2->find('meta[property=video:release_date]', 0)->getAttribute('content') );
$metadata['timestamp'] = strtotime(
$html2->find('meta[property=video:release_date]', 0)->getAttribute('content')
);
$metadata['thumbnailUri'] = $html2->find('meta[property=og:image]', 0)->getAttribute('content');
$metadata['uri'] = $html2->find('meta[property=og:url]', 0)->getAttribute('content');
return $metadata;
@ -67,7 +67,17 @@ class DailymotionBridge extends BridgeAbstract{
$item['uri'] = $metadata['uri'];
$item['title'] = $metadata['title'];
$item['timestamp'] = $metadata['timestamp'];
$item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $metadata['thumbnailUri'] . '" /></a><br><a href="' . $item['uri'] . '">' . $item['title'] . '</a>';
$item['content'] = '<a href="'
. $item['uri']
. '"><img src="'
. $metadata['thumbnailUri']
. '" /></a><br><a href="'
. $item['uri']
. '">'
. $item['title']
. '</a>';
$this->items[] = $item;
$count++;
}
@ -95,16 +105,13 @@ class DailymotionBridge extends BridgeAbstract{
$uri = self::URI;
switch($this->queriedContext){
case 'By username':
$uri.='user/'
.urlencode($this->getInput('u')).'/1';
$uri .= 'user/' . urlencode($this->getInput('u')) . '/1';
break;
case 'By playlist id':
$uri.='playlist/'
.urlencode(strtok($this->getInput('p'), '_'));
$uri .= 'playlist/' . urlencode(strtok($this->getInput('p'), '_'));
break;
case 'From search results':
$uri.='search/'
.urlencode($this->getInput('s'));
$uri .= 'search/' . urlencode($this->getInput('s'));
if($this->getInput('pa')){
$uri .= '/' . $this->getInput('pa');
}

View file

@ -1,11 +1,11 @@
<?php
class DanbooruBridge extends BridgeAbstract {
const MAINTAINER = "mitsukarenai";
const NAME = "Danbooru";
const URI = "http://donmai.us/";
const MAINTAINER = 'mitsukarenai';
const NAME = 'Danbooru';
const URI = 'http://donmai.us/';
const CACHE_TIMEOUT = 1800; // 30min
const DESCRIPTION = "Returns images from given page";
const DESCRIPTION = 'Returns images from given page';
const PARAMETERS = array(
'global' => array(
@ -14,7 +14,9 @@ class DanbooruBridge extends BridgeAbstract{
'defaultValue' => 1,
'type' => 'number'
),
't'=>array('name'=>'tags')
't' => array(
'name' => 'tags'
)
),
0 => array()
);
@ -23,8 +25,8 @@ class DanbooruBridge extends BridgeAbstract{
const IDATTRIBUTE = 'data-id';
protected function getFullURI(){
return $this->getURI().'posts?'
.'&page='.$this->getInput('p')
return $this->getURI()
. 'posts?&page=' . $this->getInput('p')
. '&tags=' . urlencode($this->getInput('t'));
}
@ -36,7 +38,13 @@ class DanbooruBridge extends BridgeAbstract{
$thumbnailUri = $this->getURI() . $element->find('img', 0)->src;
$item['tags'] = $element->find('img', 0)->getAttribute('alt');
$item['title'] = $this->getName() . ' | ' . $item['postid'];
$item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item['tags'];
$item['content'] = '<a href="'
. $item['uri']
. '"><img src="'
. $thumbnailUri
. '" /></a><br>Tags: '
. $item['tags'];
return $item;
}

View file

@ -1,11 +1,11 @@
<?php
class DansTonChatBridge extends BridgeAbstract {
const MAINTAINER = "Astalaseven";
const NAME = "DansTonChat Bridge";
const URI = "http://danstonchat.com/";
const MAINTAINER = 'Astalaseven';
const NAME = 'DansTonChat Bridge';
const URI = 'http://danstonchat.com/';
const CACHE_TIMEOUT = 21600; //6h
const DESCRIPTION = "Returns latest quotes from DansTonChat.";
const DESCRIPTION = 'Returns latest quotes from DansTonChat.';
public function collectData(){

View file

@ -1,11 +1,11 @@
<?php
class DauphineLibereBridge extends FeedExpander {
const MAINTAINER = "qwertygc";
const NAME = "Dauphine Bridge";
const URI = "http://www.ledauphine.com/";
const MAINTAINER = 'qwertygc';
const NAME = 'Dauphine Bridge';
const URI = 'http://www.ledauphine.com/';
const CACHE_TIMEOUT = 7200; // 2h
const DESCRIPTION = "Returns the newest articles.";
const DESCRIPTION = 'Returns the newest articles.';
const PARAMETERS = array( array(
'u' => array(
@ -43,15 +43,14 @@ class DauphineLibereBridge extends FeedExpander {
protected function parseItem($newsItem){
$item = parent::parseItem($newsItem);
$item['content'] = $this->ExtractContent($item['uri']);
$item['content'] = $this->extractContent($item['uri']);
return $item;
}
private function ExtractContent($url) {
private function extractContent($url){
$html2 = getSimpleHTMLDOMCached($url);
$text = $html2->find('div.column', 0)->innertext;
$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
return $text;
}
}
?>

View file

@ -1,10 +1,10 @@
<?php
class DemoBridge extends BridgeAbstract {
const MAINTAINER = "teromene";
const NAME = "DemoBridge";
const URI = "http://github.com/rss-bridge/rss-bridge";
const DESCRIPTION = "Bridge used for demos";
const MAINTAINER = 'teromene';
const NAME = 'DemoBridge';
const URI = 'http://github.com/rss-bridge/rss-bridge';
const DESCRIPTION = 'Bridge used for demos';
const PARAMETERS = array(
'testCheckbox' => array(
@ -13,7 +13,6 @@ class DemoBridge extends BridgeAbstract{
'name' => 'test des checkbox'
)
),
'testList' => array(
'testList' => array(
'type' => 'list',
@ -24,7 +23,6 @@ class DemoBridge extends BridgeAbstract{
)
)
),
'testNumber' => array(
'testNumber' => array(
'type' => 'number',
@ -44,6 +42,5 @@ class DemoBridge extends BridgeAbstract{
$item['uri'] = "http://example.com/test";
$this->items[] = $item;
}
}

View file

@ -1,11 +1,11 @@
<?php
class DeveloppezDotComBridge extends FeedExpander {
const MAINTAINER = "polopollo";
const NAME = "Developpez.com Actus (FR)";
const URI = "http://www.developpez.com/";
const MAINTAINER = 'polopollo';
const NAME = 'Developpez.com Actus (FR)';
const URI = 'https://www.developpez.com/';
const CACHE_TIMEOUT = 1800; // 30min
const DESCRIPTION = "Returns the 15 newest posts from DeveloppezDotCom (full text).";
const DESCRIPTION = 'Returns the 15 newest posts from DeveloppezDotCom (full text).';
public function collectData(){
$this->collectExpandableDatas(self::URI . 'index/rss', 15);
@ -13,19 +13,13 @@ class DeveloppezDotComBridge extends FeedExpander {
protected function parseItem($newsItem){
$item = parent::parseItem($newsItem);
$item['content'] = $this->DeveloppezDotComExtractContent($item['uri']);
$item['content'] = $this->extractContent($item['uri']);
return $item;
}
private function DeveloppezDotComStripCDATA($string) {
$string = str_replace('<![CDATA[', '', $string);
$string = str_replace(']]>', '', $string);
return $string;
}
// F***ing quotes from Microsoft Word badly encoded, here was the trick:
// http://stackoverflow.com/questions/1262038/how-to-replace-microsoft-encoded-quotes-in-php
private function convert_smart_quotes($string)
private function convertSmartQuotes($string)
{
$search = array(chr(145),
chr(146),
@ -33,18 +27,20 @@ class DeveloppezDotComBridge extends FeedExpander {
chr(148),
chr(151));
$replace = array("'",
$replace = array(
"'",
"'",
'"',
'"',
'-');
'-'
);
return str_replace($search, $replace, $string);
}
private function DeveloppezDotComExtractContent($url) {
private function extractContent($url){
$articleHTMLContent = getSimpleHTMLDOMCached($url);
$text = $this->convert_smart_quotes($articleHTMLContent->find('div.content', 0)->innertext);
$text = $this->convertSmartQuotes($articleHTMLContent->find('div.content', 0)->innertext);
$text = utf8_encode($text);
return trim($text);
}

View file

@ -9,7 +9,8 @@ class DilbertBridge extends BridgeAbstract {
public function collectData(){
$html = getSimpleHTMLDOM($this->getURI()) or 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){
@ -33,4 +34,3 @@ class DilbertBridge extends BridgeAbstract {
}
}
}
?>

View file

@ -2,10 +2,8 @@
require_once('Shimmie2Bridge.php');
class DollbooruBridge extends Shimmie2Bridge {
const MAINTAINER = "mitsukarenai";
const NAME = "Dollbooru";
const URI = "http://dollbooru.org/";
const DESCRIPTION = "Returns images from given page";
const MAINTAINER = 'mitsukarenai';
const NAME = 'Dollbooru';
const URI = 'http://dollbooru.org/';
const DESCRIPTION = 'Returns images from given page';
}

View file

@ -1,11 +1,11 @@
<?php
class DuckDuckGoBridge extends BridgeAbstract {
const MAINTAINER = "Astalaseven";
const NAME = "DuckDuckGo";
const URI = "https://duckduckgo.com/";
const MAINTAINER = 'Astalaseven';
const NAME = 'DuckDuckGo';
const URI = 'https://duckduckgo.com/';
const CACHE_TIMEOUT = 21600; // 6h
const DESCRIPTION = "Returns results from DuckDuckGo.";
const DESCRIPTION = 'Returns results from DuckDuckGo.';
const SORT_DATE = '+sort:date';
const SORT_RELEVANCE = '';
@ -13,7 +13,8 @@ class DuckDuckGoBridge extends BridgeAbstract{
const PARAMETERS = array( array(
'u' => array(
'name' => 'keyword',
'required'=>true),
'required' => true
),
'sort' => array(
'name' => 'sort by',
'type' => 'list',

View file

@ -2,9 +2,10 @@
class EZTVBridge extends BridgeAbstract {
const MAINTAINER = "alexAubin";
const NAME = "EZTV";
const URI = "https://eztv.ch/";
const DESCRIPTION = "Returns list of *recent* torrents for a specific show on EZTV. Get showID from URLs in https://eztv.ch/shows/showID/show-full-name.";
const NAME = 'EZTV';
const URI = 'https://eztv.ch/';
const DESCRIPTION = 'Returns list of *recent* torrents for a specific show
on EZTV. Get showID from URLs in https://eztv.ch/shows/showID/show-full-name.';
const PARAMETERS = array( array(
'i' => array(

View file

@ -1,16 +1,16 @@
<?php
class EliteDangerousGalnetBridge extends BridgeAbstract
{
const MAINTAINER = "corenting";
const NAME = "Elite: Dangerous Galnet";
const URI = "https://community.elitedangerous.com/galnet/";
const CACHE_TIMEOUT = 7200; // 2h
const DESCRIPTION = "Returns the latest page of news from Galnet";
class EliteDangerousGalnetBridge extends BridgeAbstract {
public function collectData()
{
const MAINTAINER = 'corenting';
const NAME = 'Elite: Dangerous Galnet';
const URI = 'https://community.elitedangerous.com/galnet/';
const CACHE_TIMEOUT = 7200; // 2h
const DESCRIPTION = 'Returns the latest page of news from Galnet';
public function collectData(){
$html = getSimpleHTMLDOM(self::URI)
or returnServerError('Error while downloading the website content');
foreach($html->find('div.article') as $element){
$item = array();

View file

@ -1,5 +1,6 @@
<?php
class ElsevierBridge extends BridgeAbstract {
const MAINTAINER = 'Pierre Mazière';
const NAME = 'Elsevier journals recent articles';
const URI = 'http://www.journals.elsevier.com/';
@ -16,7 +17,7 @@ class ElsevierBridge extends BridgeAbstract{
));
// Extracts the list of names from an article as string
private function ExtractArticleName ($article){
private function extractArticleName($article){
$names = $article->find('small', 0);
if($names)
return trim($names->plaintext);
@ -24,7 +25,7 @@ class ElsevierBridge extends BridgeAbstract{
}
// Extracts the timestamp from an article
private function ExtractArticleTimestamp ($article){
private function extractArticleTimestamp($article){
$time = $article->find('.article-info', 0);
if($time){
$timestring = trim($time->plaintext);
@ -48,7 +49,7 @@ class ElsevierBridge extends BridgeAbstract{
}
// Extracts the content from an article
private function ExtractArticleContent ($article){
private function extractArticleContent($article){
$content = $article->find('.article-content', 0);
if($content){
return trim($content->plaintext);
@ -58,17 +59,17 @@ class ElsevierBridge extends BridgeAbstract{
public function collectData(){
$uri = self::URI . $this->getInput('j') . '/recent-articles/';
$html = getSimpleHTMLDOM($uri) or 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){
$item = array();
$item['uri'] = $article->find('.pod-listing-header>a', 0)->getAttribute('href') . '?np=y';
$item['title'] = $article->find('.pod-listing-header>a', 0)->plaintext;
$item['author'] = $this->ExtractArticleName($article);
$item['timestamp'] = $this->ExtractArticleTimestamp($article);
$item['content'] = $this->ExtractArticleContent($article);
$item['author'] = $this->extractArticleName($article);
$item['timestamp'] = $this->extractArticleTimestamp($article);
$item['content'] = $this->extractArticleContent($article);
$this->items[] = $item;
}
}
}
?>

View file

@ -8,23 +8,30 @@ class EstCeQuonMetEnProdBridge extends BridgeAbstract {
const DESCRIPTION = 'Should we put a website in production today? (French)';
public function collectData(){
function ExtractFromDelimiters($string, $start, $end) {
function extractFromDelimiters($string, $start, $end){
if(strpos($string, $start) !== false){
$section_retrieved = substr($string, strpos($string, $start) + strlen($start));
$section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end));
return $section_retrieved;
} return false;
}
$html = getSimpleHTMLDOM($this->getURI()) or returnServerError('Could not request EstCeQuonMetEnProd: '.$this->getURI());
return false;
}
$html = getSimpleHTMLDOM($this->getURI())
or returnServerError('Could not request EstCeQuonMetEnProd: ' . $this->getURI());
$item = array();
$item['uri'] = $this->getURI() . '#' . date('Y-m-d');
$item['title'] = $this->getName();
$item['author'] = 'Nicolas Hoffmann';
$item['timestamp'] = strtotime('today midnight');
$item['content'] = str_replace('src="/', 'src="'.$this->getURI(), trim(ExtractFromDelimiters($html->outertext, '<body role="document">', '<br /><br />')));
$item['content'] = str_replace(
'src="/',
'src="' . $this->getURI(),
trim(extractFromDelimiters($html->outertext, '<body role="document">', '<br /><br />'))
);
$this->items[] = $item;
}
}
?>

View file

@ -1,11 +1,12 @@
<?php
class FB2Bridge extends BridgeAbstract {
const MAINTAINER = "teromene";
const NAME = "Facebook Alternate";
const URI = "https://www.facebook.com/";
const MAINTAINER = 'teromene';
const NAME = 'Facebook Alternate';
const URI = 'https://www.facebook.com/';
const CACHE_TIMEOUT = 1000;
const DESCRIPTION = "Input a page title or a profile log. For a profile log, please insert the parameter as follow : myExamplePage/132621766841117";
const DESCRIPTION = 'Input a page title or a profile log. For a profile log,
please insert the parameter as follow : myExamplePage/132621766841117';
const PARAMETERS = array( array(
'u' => array(
@ -14,15 +15,16 @@ class FB2Bridge extends BridgeAbstract{
)
));
public function collectData(){
function ExtractFromDelimiters($string, $start, $end) {
function extractFromDelimiters($string, $start, $end){
if(strpos($string, $start) !== false){
$section_retrieved = substr($string, strpos($string, $start) + strlen($start));
$section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end));
return $section_retrieved;
} return false;
}
return false;
}
//Utility function for cleaning a Facebook link
@ -32,7 +34,7 @@ class FB2Bridge extends BridgeAbstract{
if(strpos($link, '/') === 0)
$link = self::URI . $link . '"';
if(strpos($link, 'facebook.com/l.php?u=') !== false)
$link = urldecode(ExtractFromDelimiters($link, 'facebook.com/l.php?u=', '&'));
$link = urldecode(extractFromDelimiters($link, 'facebook.com/l.php?u=', '&'));
return ' href="' . $link . '"';
}
};
@ -70,21 +72,23 @@ class FB2Bridge extends BridgeAbstract{
return $matches[0];
};
if($this->getInput('u') !== NULL) {
$page = "https://touch.facebook.com/" . $this->getInput('u');
if($this->getInput('u') !== null){
$page = 'https://touch.facebook.com/' . $this->getInput('u');
$cookies = $this->getCookies($page);
$pageID = $this->getPageID($page, $cookies);
if($pageID === null){
echo "Unable to get the page id. You should consider getting the ID by hand, then importing it into FB2Bridge";
echo <<<EOD
Unable to get the page id. You should consider getting the ID by hand, then importing it into FB2Bridge
EOD;
die();
}
}
//Build the string for the first request
$requestString = "https://touch.facebook.com/pages_reaction_units/more/?page_id=" . $pageID . "&cursor={\"card_id\"%3A\"videos\"%2C\"has_next_page\"%3Atrue}&surface=mobile_page_home&unit_count=8";
$requestString = 'https://touch.facebook.com/pages_reaction_units/more/?page_id='
. $pageID
. '&cursor={"card_id"%3A"videos"%2C"has_next_page"%3Atrue}&surface=mobile_page_home&unit_count=8';
$fileContent = file_get_contents($requestString);
@ -92,15 +96,13 @@ class FB2Bridge extends BridgeAbstract{
$maxArticle = 3;
$html = $this->buildContent($fileContent);
$author = $this->getInput('u');
foreach($html->find("article") as $content){
$item = array();
$item['uri'] = "http://touch.facebook.com" . $content->find("div._52jc", 0)->find("a", 0)->getAttribute("href");
$item['uri'] = "http://touch.facebook.com"
. $content->find("div._52jc", 0)->find("a", 0)->getAttribute("href");
$content->find("header", 0)->innertext = "";
$content->find("footer", 0)->innertext = "";
@ -112,16 +114,26 @@ class FB2Bridge extends BridgeAbstract{
$content = preg_replace_callback('/ href=\"([^"]+)\"/i', $unescape_fb_link, $content);
//Clean useless html tag properties and fix link closing tags
foreach (array('onmouseover', 'onclick', 'target', 'ajaxify', 'tabindex',
'class', 'style', 'data-[^=]*', 'aria-[^=]*', 'role', 'rel', 'id') as $property_name)
foreach (array(
'onmouseover',
'onclick',
'target',
'ajaxify',
'tabindex',
'class',
'style',
'data-[^=]*',
'aria-[^=]*',
'role',
'rel',
'id') as $property_name)
$content = preg_replace('/ ' . $property_name . '=\"[^"]*\"/i', '', $content);
$content = preg_replace('/<\/a [^>]+>/i', '</a>', $content);
//Convert textual representation of emoticons eg "<i><u>smile emoticon</u></i>" back to ASCII emoticons eg ":)"
//Convert textual representation of emoticons eg
// "<i><u>smile emoticon</u></i>" back to ASCII emoticons eg ":)"
$content = preg_replace_callback('/<i><u>([^ <>]+) ([^<>]+)<\/u><\/i>/i', $unescape_fb_emote, $content);
$item['content'] = $content;
$title = $author;
@ -135,9 +147,7 @@ class FB2Bridge extends BridgeAbstract{
$item['author'] = $author;
array_push($this->items, $item);
}
}
@ -147,9 +157,17 @@ class FB2Bridge extends BridgeAbstract{
$regex = "/timeline_unit\\\\\\\\u00253A1\\\\\\\\u00253A([0-9]*)\\\\\\\\u00253A([0-9]*)\\\\\\\\u00253A([0-9]*)\\\\\\\\u00253A([0-9]*)/";
preg_match($regex, $string, $result);
return "https://touch.facebook.com/pages_reaction_units/more/?page_id=".$pageID."&cursor=%7B%22timeline_cursor%22%3A%22timeline_unit%3A1%3A".$result[1]."%3A".$result[2]."%3A".$result[3]."%3A".$result[4]."%22%2C%22timeline_section_cursor%22%3A%7B%7D%2C%22has_next_page%22%3Atrue%7D&surface=mobile_page_home&unit_count=3";
return "https://touch.facebook.com/pages_reaction_units/more/?page_id="
. $pageID
. "&cursor=%7B%22timeline_cursor%22%3A%22timeline_unit%3A1%3A"
. $result[1]
. "%3A"
. $result[2]
. "%3A"
. $result[3]
. "%3A"
. $result[4]
. "%22%2C%22timeline_section_cursor%22%3A%7B%7D%2C%22has_next_page%22%3Atrue%7D&surface=mobile_page_home&unit_count=3";
}
//Builds the HTML from the encoded JS that Facebook provides.
@ -159,11 +177,11 @@ class FB2Bridge extends BridgeAbstract{
preg_match($regex, $pageContent, $result);
return str_get_html(html_entity_decode(json_decode('"' . $result[1] . '"')));
}
//Builds the cookie from the page, as Facebook sometimes refuses to give the page if no cookie is provided.
//Builds the cookie from the page, as Facebook sometimes refuses to give
//the page if no cookie is provided.
private function getCookies($pageURL){
$ctx = stream_context_create(array(
@ -186,7 +204,6 @@ class FB2Bridge extends BridgeAbstract{
}
return substr($cookies, 1);
}
//Get the page ID from the Facebook page.
@ -207,9 +224,7 @@ class FB2Bridge extends BridgeAbstract{
preg_match($regex, $pageContent, $matches);
if(count($matches) > 0){
return $matches[1];
}
//Get the page ID if we do have a captcha

View file

@ -1,11 +1,12 @@
<?php
class FacebookBridge extends BridgeAbstract {
const MAINTAINER = "teromene";
const NAME = "Facebook";
const URI = "https://www.facebook.com/";
const MAINTAINER = 'teromene';
const NAME = 'Facebook';
const URI = 'https://www.facebook.com/';
const CACHE_TIMEOUT = 300; // 5min
const DESCRIPTION = "Input a page title or a profile log. For a profile log, please insert the parameter as follow : myExamplePage/132621766841117";
const DESCRIPTION = 'Input a page title or a profile log. For a profile log,
please insert the parameter as follow : myExamplePage/132621766841117';
const PARAMETERS = array( array(
'u' => array(
@ -19,12 +20,14 @@ class FacebookBridge extends BridgeAbstract{
public function collectData(){
//Extract a string using start and end delimiters
function ExtractFromDelimiters($string, $start, $end) {
function extractFromDelimiters($string, $start, $end){
if(strpos($string, $start) !== false){
$section_retrieved = substr($string, strpos($string, $start) + strlen($start));
$section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end));
return $section_retrieved;
} return false;
}
return false;
}
//Utility function for cleaning a Facebook link
@ -34,7 +37,7 @@ class FacebookBridge extends BridgeAbstract{
if(strpos($link, '/') === 0)
$link = self::URI . $link . '"';
if(strpos($link, 'facebook.com/l.php?u=') !== false)
$link = urldecode(ExtractFromDelimiters($link, 'facebook.com/l.php?u=', '&'));
$link = urldecode(extractFromDelimiters($link, 'facebook.com/l.php?u=', '&'));
return ' href="' . $link . '"';
}
};
@ -88,13 +91,17 @@ class FacebookBridge extends BridgeAbstract{
'http' => array(
'method' => 'POST',
'user_agent' => ini_get('user_agent'),
'header'=>array("Content-type: application/x-www-form-urlencoded\r\nReferer: $captcha_action\r\nCookie: noscript=1\r\n"),
'content' => http_build_query($captcha_fields),
'header' => array("Content-type:
application/x-www-form-urlencoded\r\nReferer: $captcha_action\r\nCookie: noscript=1\r\n"),
'content' => http_build_query($captcha_fields)
),
);
$context = stream_context_create($http_options);
$html = getContents($captcha_action, false, $context);
if ($html === FALSE) { 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']);
$html = str_get_html($html);
}
@ -130,23 +137,35 @@ class FacebookBridge extends BridgeAbstract{
$img = base64_encode(getContents($captcha->find('img', 0)->src));
header('HTTP/1.1 500 ' . Http::getMessageForCode(500));
header('Content-Type: text/html');
die('<form method="post" action="?'.$_SERVER['QUERY_STRING'].'">'
.'<h2>Facebook captcha challenge</h2>'
.'<p>Unfortunately, rss-bridge cannot fetch the requested page.<br />'
.'Facebook wants rss-bridge to resolve the following captcha:</p>'
.'<p><img src="data:image/png;base64,'.$img.'" /></p>'
.'<p><b>Response:</b> <input name="captcha_response" placeholder="please fill in" />'
.'<input type="submit" value="Submit!" /></p>'
.'</form>');
$message = <<<EOD
<form method="post" action="?{$_SERVER['QUERY_STRING']}">
<h2>Facebook captcha challenge</h2>
<p>Unfortunately, rss-bridge cannot fetch the requested page.<br />
Facebook wants rss-bridge to resolve the following captcha:</p>
<p><img src="data:image/png;base64,{$img}" /></p>
<p><b>Response:</b> <input name="captcha_response" placeholder="please fill in" />
<input type="submit" value="Submit!" /></p>
</form>
EOD;
die($message);
}
//No captcha? We can carry on retrieving page contents :)
$element = $html->find('#pagelet_timeline_main_column')[0]->children(0)->children(0)->children(0)->next_sibling()->children(0);
$element = $html
->find('#pagelet_timeline_main_column')[0]
->children(0)
->children(0)
->children(0)
->next_sibling()
->children(0);
if(isset($element)){
$author = str_replace(' | Facebook', '', $html->find('title#pageTitle', 0)->innertext);
$profilePic = 'https://graph.facebook.com/'.$this->getInput('u').'/picture?width=200&amp;height=200';
$profilePic = 'https://graph.facebook.com/'
. $this->getInput('u')
. '/picture?width=200&amp;height=200';
$this->authorName = $author;
foreach($element->children() as $post){
@ -158,10 +177,25 @@ class FacebookBridge extends BridgeAbstract{
if(count($post->find('abbr')) > 0){
//Retrieve post contents
$content = preg_replace('/(?i)><div class=\"clearfix([^>]+)>(.+?)div\ class=\"userContent\"/i', '', $post);
$content = preg_replace('/(?i)><div class=\"_59tj([^>]+)>(.+?)<\/div><\/div><a/i', '', $content);
$content = preg_replace('/(?i)><div class=\"_3dp([^>]+)>(.+?)div\ class=\"[^u]+userContent\"/i', '', $content);
$content = preg_replace('/(?i)><div class=\"_4l5([^>]+)>(.+?)<\/div>/i', '', $content);
$content = preg_replace(
'/(?i)><div class=\"clearfix([^>]+)>(.+?)div\ class=\"userContent\"/i',
'',
$post);
$content = preg_replace(
'/(?i)><div class=\"_59tj([^>]+)>(.+?)<\/div><\/div><a/i',
'',
$content);
$content = preg_replace(
'/(?i)><div class=\"_3dp([^>]+)>(.+?)div\ class=\"[^u]+userContent\"/i',
'',
$content);
$content = preg_replace(
'/(?i)><div class=\"_4l5([^>]+)>(.+?)<\/div>/i',
'',
$content);
//Remove html nodes, keep only img, links, basic formatting
$content = strip_tags($content, '<a><img><i><u><br><p>');
@ -170,13 +204,29 @@ class FacebookBridge extends BridgeAbstract{
$content = preg_replace_callback('/ href=\"([^"]+)\"/i', $unescape_fb_link, $content);
//Clean useless html tag properties and fix link closing tags
foreach (array('onmouseover', 'onclick', 'target', 'ajaxify', 'tabindex',
'class', 'style', 'data-[^=]*', 'aria-[^=]*', 'role', 'rel', 'id') as $property_name)
foreach (array(
'onmouseover',
'onclick',
'target',
'ajaxify',
'tabindex',
'class',
'style',
'data-[^=]*',
'aria-[^=]*',
'role',
'rel',
'id') as $property_name)
$content = preg_replace('/ ' . $property_name . '=\"[^"]*\"/i', '', $content);
$content = preg_replace('/<\/a [^>]+>/i', '</a>', $content);
//Convert textual representation of emoticons eg "<i><u>smile emoticon</u></i>" back to ASCII emoticons eg ":)"
$content = preg_replace_callback('/<i><u>([^ <>]+) ([^<>]+)<\/u><\/i>/i', $unescape_fb_emote, $content);
//Convert textual representation of emoticons eg
//"<i><u>smile emoticon</u></i>" back to ASCII emoticons eg ":)"
$content = preg_replace_callback(
'/<i><u>([^ <>]+) ([^<>]+)<\/u><\/i>/i',
$unescape_fb_emote,
$content
);
//Retrieve date of the post
$date = $post->find("abbr")[0];

View file

@ -1,14 +1,15 @@
<?php
class FierPandaBridge extends BridgeAbstract {
const MAINTAINER = "snroki";
const NAME = "Fier Panda Bridge";
const URI = "http://www.fier-panda.fr/";
const MAINTAINER = 'snroki';
const NAME = 'Fier Panda Bridge';
const URI = 'http://www.fier-panda.fr/';
const CACHE_TIMEOUT = 21600; // 6h
const DESCRIPTION = "Returns latest articles from Fier Panda.";
const DESCRIPTION = 'Returns latest articles from Fier Panda.';
public function collectData(){
$html = getSimpleHTMLDOM(self::URI) or 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){
$item = array();

View file

@ -5,11 +5,11 @@
*/
class FlickrBridge extends BridgeAbstract {
const MAINTAINER = "logmanoriginal";
const NAME = "Flickr Bridge";
const URI = "https://www.flickr.com/";
const MAINTAINER = 'logmanoriginal';
const NAME = 'Flickr Bridge';
const URI = 'https://www.flickr.com/';
const CACHE_TIMEOUT = 21600; // 6 hours
const DESCRIPTION = "Returns images from Flickr";
const DESCRIPTION = 'Returns images from Flickr';
const PARAMETERS = array(
'Explore' => array(),
@ -105,9 +105,8 @@ class FlickrBridge extends BridgeAbstract {
$item['content'] = '<a href="'
. $item['uri']
. '"><img src="'
. $imageURI . '" /></a>'
. '<br>'
. '<p>'
. $imageURI
. '" /></a><br><p>'
. $description
. '</p>';

View file

@ -1,10 +1,10 @@
<?php
class FootitoBridge extends BridgeAbstract {
const MAINTAINER = "superbaillot.net";
const NAME = "Footito";
const URI = "http://www.footito.fr/";
const DESCRIPTION = "Footito";
const MAINTAINER = 'superbaillot.net';
const NAME = 'Footito';
const URI = 'http://www.footito.fr/';
const DESCRIPTION = 'Footito';
public function collectData(){
$html = getSimpleHTMLDOM(self::URI)
@ -14,15 +14,50 @@ class FootitoBridge extends BridgeAbstract{
$item = array();
$content = trim($element->innertext);
$content = str_replace("<img", "<img style='float : left;'", $content );
$content = str_replace("class=\"logo\"", "style='float : left;'", $content );
$content = str_replace("class=\"contenu\"", "style='margin-left : 60px;'", $content );
$content = str_replace("class=\"responsive-comment\"", "style='border-top : 1px #DDD solid; background-color : white; padding : 10px;'", $content );
$content = str_replace("class=\"jaime\"", "style='display : none;'", $content );
$content = str_replace("class=\"auteur-event responsive\"", "style='display : none;'", $content );
$content = str_replace("class=\"report-abuse-button\"", "style='display : none;'", $content );
$content = str_replace("class=\"reaction clearfix\"", "style='margin : 10px 0px; padding : 5px; border-bottom : 1px #DDD solid;'", $content );
$content = str_replace("class=\"infos\"", "style='font-size : 0.7em;'", $content );
$content = str_replace(
"<img",
"<img style='float : left;'",
$content );
$content = str_replace(
"class=\"logo\"",
"style='float : left;'",
$content );
$content = str_replace(
"class=\"contenu\"",
"style='margin-left : 60px;'",
$content );
$content = str_replace(
"class=\"responsive-comment\"",
"style='border-top : 1px #DDD solid; background-color : white; padding : 10px;'",
$content );
$content = str_replace(
"class=\"jaime\"",
"style='display : none;'",
$content );
$content = str_replace(
"class=\"auteur-event responsive\"",
"style='display : none;'",
$content );
$content = str_replace(
"class=\"report-abuse-button\"",
"style='display : none;'",
$content );
$content = str_replace(
"class=\"reaction clearfix\"",
"style='margin : 10px 0px; padding : 5px; border-bottom : 1px #DDD solid;'",
$content );
$content = str_replace(
"class=\"infos\"",
"style='font-size : 0.7em;'",
$content );
$item['content'] = $content;

View file

@ -1,11 +1,11 @@
<?php
class FourchanBridge extends BridgeAbstract {
const MAINTAINER = "mitsukarenai";
const NAME = "4chan";
const URI = "https://boards.4chan.org/";
const MAINTAINER = 'mitsukarenai';
const NAME = '4chan';
const URI = 'https://boards.4chan.org/';
const CACHE_TIMEOUT = 300; // 5min
const DESCRIPTION = "Returns posts from the specified thread";
const DESCRIPTION = 'Returns posts from the specified thread';
const PARAMETERS = array( array(
'c' => array(
@ -21,7 +21,6 @@ class FourchanBridge extends BridgeAbstract{
public function getURI(){
return static::URI . $this->getInput('c') . '/thread/' . $this->getInput('t');
}
public function collectData(){
@ -37,12 +36,14 @@ class FourchanBridge extends BridgeAbstract{
$item['author'] = $element->find('span.name', 0)->plaintext;
$file = $element->find('.file', 0);
if(!empty($file)){
$item['image'] = $element->find('.file a', 0)->href;
$item['imageThumb'] = $element->find('.file img', 0)->src;
if(!isset($item['imageThumb']) and strpos($item['image'], '.swf') !== FALSE)
if(!isset($item['imageThumb']) and strpos($item['image'], '.swf') !== false)
$item['imageThumb'] = 'http://i.imgur.com/eO0cxf9.jpg';
}
if(!empty($element->find('span.subject', 0)->innertext)){
$item['subject'] = $element->find('span.subject', 0)->innertext;
}
@ -55,10 +56,15 @@ class FourchanBridge extends BridgeAbstract{
$content = $element->find('.postMessage', 0)->innertext;
$content = str_replace('href="#p','href="' . $this->getURI() . '#p', $content);
$item['content'] = '<span id="' . $item['id'] . '">' . $content . '</span>';
if(isset($item['image'])){
$item['content'] = '<a href="'.$item['image'].'">'
.'<img alt="'.$item['id'].'" src="'.$item['imageThumb'].'" />'
.'</a><br>'
$item['content'] = '<a href="'
. $item['image']
. '"><img alt="'
. $item['id']
. '" src="'
. $item['imageThumb']
. '" /></a><br>'
.$item['content'];
}
$this->items[] = $item;

View file

@ -88,13 +88,13 @@ class FuturaSciencesBridge extends FeedExpander {
$item['uri'] = str_replace('#xtor=RSS-8', '', $item['uri']);
$article = getSimpleHTMLDOMCached($item['uri'])
or returnServerError('Could not request Futura-Sciences: ' . $item['uri']);
$item['content'] = $this->ExtractArticleContent($article);
$author = $this->ExtractAuthor($article);
$item['content'] = $this->extractArticleContent($article);
$author = $this->extractAuthor($article);
$item['author'] = empty($author) ? $item['author'] : $author;
return $item;
}
private function StripWithDelimiters($string, $start, $end) {
private function stripWithDelimiters($string, $start, $end){
while(strpos($string, $start) !== false){
$section_to_remove = substr($string, strpos($string, $start));
$section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end));
@ -102,7 +102,7 @@ class FuturaSciencesBridge extends FeedExpander {
} return $string;
}
private function StripRecursiveHTMLSection($string, $tag_name, $tag_start) {
private function stripRecursiveHTMLSection($string, $tag_name, $tag_start){
$open_tag = '<' . $tag_name;
$close_tag = '</' . $tag_name . '>';
$close_tag_length = strlen($close_tag);
@ -126,7 +126,7 @@ class FuturaSciencesBridge extends FeedExpander {
return $string;
}
private function ExtractArticleContent($article){
private function extractArticleContent($article){
$contents = $article->find('section.article-text-classic', 0)->innertext;
$headline = trim($article->find('p.description', 0)->plaintext);
if(!empty($headline))
@ -148,22 +148,22 @@ class FuturaSciencesBridge extends FeedExpander {
'<div id="forumcomments',
'<div ng-if="active"'
) as $div_start) {
$contents = $this->StripRecursiveHTMLSection($contents , 'div', $div_start);
$contents = $this->stripRecursiveHTMLSection($contents , 'div', $div_start);
}
$contents = $this->StripWithDelimiters($contents, '<hr ', '/>');
$contents = $this->StripWithDelimiters($contents, '<p class="content-date', '</p>');
$contents = $this->StripWithDelimiters($contents, '<h1 class="content-title', '</h1>');
$contents = $this->StripWithDelimiters($contents, 'fs:definition="', '"');
$contents = $this->StripWithDelimiters($contents, 'fs:xt:clicktype="', '"');
$contents = $this->StripWithDelimiters($contents, 'fs:xt:clickname="', '"');
$contents = $this->StripWithDelimiters($contents, '<script ', '</script>');
$contents = $this->stripWithDelimiters($contents, '<hr ', '/>');
$contents = $this->stripWithDelimiters($contents, '<p class="content-date', '</p>');
$contents = $this->stripWithDelimiters($contents, '<h1 class="content-title', '</h1>');
$contents = $this->stripWithDelimiters($contents, 'fs:definition="', '"');
$contents = $this->stripWithDelimiters($contents, 'fs:xt:clicktype="', '"');
$contents = $this->stripWithDelimiters($contents, 'fs:xt:clickname="', '"');
$contents = $this->stripWithDelimiters($contents, '<script ', '</script>');
return $headline . trim($contents);
}
// Extracts the author from an article or element
private function ExtractAuthor($article){
private function extractAuthor($article){
$article_author = $article->find('h3.epsilon', 0);
if($article_author){
return trim(str_replace(', Futura-Sciences', '', $article_author->plaintext));

View file

@ -20,23 +20,27 @@ class GBAtempBridge extends BridgeAbstract {
)
));
private function ExtractFromDelimiters($string, $start, $end) {
private function extractFromDelimiters($string, $start, $end){
if(strpos($string, $start) !== false){
$section_retrieved = substr($string, strpos($string, $start) + strlen($start));
$section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end));
return $section_retrieved;
} return false;
}
private function StripWithDelimiters($string, $start, $end) {
return false;
}
private function stripWithDelimiters($string, $start, $end){
while(strpos($string, $start) !== false){
$section_to_remove = substr($string, strpos($string, $start));
$section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end));
$string = str_replace($section_to_remove, '', $string);
} return $string;
}
private function build_item($uri, $title, $author, $timestamp, $content) {
return $string;
}
private function buildItem($uri, $title, $author, $timestamp, $content){
$item = array();
$item['uri'] = $uri;
$item['title'] = $title;
@ -46,21 +50,21 @@ class GBAtempBridge extends BridgeAbstract {
return $item;
}
private function cleanup_post_content($content, $site_url) {
private function cleanupPostContent($content, $site_url){
$content = str_replace(':arrow:', '&#x27a4;', $content);
$content = str_replace('href="attachments/', 'href="'.$site_url.'attachments/', $content);
$content = $this->StripWithDelimiters($content, '<script', '</script>');
$content = $this->stripWithDelimiters($content, '<script', '</script>');
return $content;
}
private function fetch_post_content($uri, $site_url) {
private function fetchPostContent($uri, $site_url){
$html = getSimpleHTMLDOM($uri);
if(!$html){
return 'Could not request GBAtemp ' . $uri;
}
$content = $html->find('div.messageContent', 0)->innertext;
return $this->cleanup_post_content($content, $site_url);
return $this->cleanupPostContent($content, $site_url);
}
public function collectData(){
@ -72,44 +76,69 @@ class GBAtempBridge extends BridgeAbstract {
case 'N':
foreach($html->find('li[class=news_item full]') as $newsItem){
$url = self::URI . $newsItem->find('a', 0)->href;
$time = intval($this->ExtractFromDelimiters($newsItem->find('abbr.DateTime', 0)->outertext, 'data-time="', '"'));
$time = intval(
$this->extractFromDelimiters(
$newsItem->find('abbr.DateTime', 0)->outertext,
'data-time="',
'"'
)
);
$author = $newsItem->find('a.username', 0)->plaintext;
$title = $newsItem->find('a', 1)->plaintext;
$content = $this->fetch_post_content($url, self::URI);
$this->items[] = $this->build_item($url, $title, $author, $time, $content);
$content = $this->fetchPostContent($url, self::URI);
$this->items[] = $this->buildItem($url, $title, $author, $time, $content);
}
case 'R':
foreach($html->find('li.portal_review') as $reviewItem){
$url = self::URI . $reviewItem->find('a', 0)->href;
$title = $reviewItem->find('span.review_title', 0)->plaintext;
$content = getSimpleHTMLDOM($url) or returnServerError('Could not request GBAtemp: '.$uri);
$content = getSimpleHTMLDOM($url)
or returnServerError('Could not request GBAtemp: ' . $uri);
$author = $content->find('a.username', 0)->plaintext;
$time = intval($this->ExtractFromDelimiters($content->find('abbr.DateTime', 0)->outertext, 'data-time="', '"'));
$time = intval(
$this->extractFromDelimiters(
$content->find('abbr.DateTime', 0)->outertext,
'data-time="',
'"'
)
);
$intro = '<p><b>' . ($content->find('div#review_intro', 0)->plaintext) . '</b></p>';
$review = $content->find('div#review_main', 0)->innertext;
$subheader = '<p><b>' . $content->find('div.review_subheader', 0)->plaintext . '</b></p>';
$procons = $content->find('table.review_procons', 0)->outertext;
$scores = $content->find('table.reviewscores', 0)->outertext;
$content = $this->cleanup_post_content($intro.$review.$subheader.$procons.$scores, self::URI);
$this->items[] = $this->build_item($url, $title, $author, $time, $content);
$content = $this->cleanupPostContent($intro . $review . $subheader . $procons . $scores, self::URI);
$this->items[] = $this->buildItem($url, $title, $author, $time, $content);
}
case 'T':
foreach($html->find('li.portal-tutorial') as $tutorialItem){
$url = self::URI . $tutorialItem->find('a', 0)->href;
$title = $tutorialItem->find('a', 0)->plaintext;
$time = intval($this->ExtractFromDelimiters($tutorialItem->find('abbr.DateTime', 0)->outertext, 'data-time="', '"'));
$time = intval(
$this->extractFromDelimiters(
$tutorialItem->find('abbr.DateTime', 0)->outertext,
'data-time="',
'"'
)
);
$author = $tutorialItem->find('a.username', 0)->plaintext;
$content = $this->fetch_post_content($url, self::URI);
$this->items[] = $this->build_item($url, $title, $author, $time, $content);
$content = $this->fetchPostContent($url, self::URI);
$this->items[] = $this->buildItem($url, $title, $author, $time, $content);
}
case 'F':
foreach($html->find('li.rc_item') as $postItem){
$url = self::URI . $postItem->find('a', 1)->href;
$title = $postItem->find('a', 1)->plaintext;
$time = intval($this->ExtractFromDelimiters($postItem->find('abbr.DateTime', 0)->outertext, 'data-time="', '"'));
$time = intval(
$this->extractFromDelimiters(
$postItem->find('abbr.DateTime', 0)->outertext,
'data-time="',
'"'
)
);
$author = $postItem->find('a.username', 0)->plaintext;
$content = $this->fetch_post_content($url, self::URI);
$this->items[] = $this->build_item($url, $title, $author, $time, $content);
$content = $this->fetchPostContent($url, self::URI);
$this->items[] = $this->buildItem($url, $title, $author, $time, $content);
}
}
}

View file

@ -3,10 +3,10 @@ require_once('DanbooruBridge.php');
class GelbooruBridge extends DanbooruBridge {
const MAINTAINER = "mitsukarenai";
const NAME = "Gelbooru";
const URI = "http://gelbooru.com/";
const DESCRIPTION = "Returns images from given page";
const MAINTAINER = 'mitsukarenai';
const NAME = 'Gelbooru';
const URI = 'http://gelbooru.com/';
const DESCRIPTION = 'Returns images from given page';
const PATHTODATA = '.thumb';
const IDATTRIBUTE = 'id';
@ -14,8 +14,9 @@ class GelbooruBridge extends DanbooruBridge{
const PIDBYPAGE = 63;
protected function getFullURI(){
return $this->getURI().'index.php?page=post&s=list&'
.'&pid='.($this->getInput('p')?($this->getInput('p') -1)*static::PIDBYPAGE:'')
return $this->getURI()
. 'index.php?page=post&s=list&pid='
. ($this->getInput('p') ? ($this->getInput('p') - 1) * static::PIDBYPAGE : '')
. '&tags=' . urlencode($this->getInput('t'));
}
}

View file

@ -3,11 +3,11 @@ define('GIPHY_LIMIT', 10);
class GiphyBridge extends BridgeAbstract {
const MAINTAINER = "kraoc";
const NAME = "Giphy Bridge";
const URI = "http://giphy.com/";
const MAINTAINER = 'kraoc';
const NAME = 'Giphy Bridge';
const URI = 'http://giphy.com/';
const CACHE_TIMEOUT = 300; //5min
const DESCRIPTION = "Bridge for giphy.com";
const DESCRIPTION = 'Bridge for giphy.com';
const PARAMETERS = array( array(
's' => array(
@ -58,10 +58,15 @@ class GiphyBridge extends BridgeAbstract{
$title = $item['id'];
}
$item['title'] = trim($title);
$item['content'] =
'<a href="'.$item['uri'].'">'
.'<img src="'.$img->getAttribute('src').'" width="'.$img->getAttribute('data-original-width').'" height="'.$img->getAttribute('data-original-height').'" />'
.'</a>';
$item['content'] = '<a href="'
. $item['uri']
. '"><img src="'
. $img->getAttribute('src')
. '" width="'
. $img->getAttribute('data-original-width')
. '" height="'
. $img->getAttribute('data-original-height')
. '" /></a>';
$this->items[] = $item;
$limit++;

View file

@ -18,7 +18,6 @@ class GithubIssueBridge extends BridgeAbstract{
'required' => true
)
),
'Project Issues' => array(
'c' => array(
'name' => 'Show Issues Comments',
@ -75,8 +74,7 @@ class GithubIssueBridge extends BridgeAbstract{
$author = $comment->find('.author', 0)->plaintext;
}
$uri=static::URI.$this->getInput('u').'/'.$this->getInput('p').'/issues/'
.$issueNbr;
$uri = static::URI . $this->getInput('u') . '/' . $this->getInput('p') . '/issues/' . $issueNbr;
$comment = $comment->firstChild();
if(!$event){
@ -122,9 +120,8 @@ class GithubIssueBridge extends BridgeAbstract{
$comments = $issue->find('.js-discussion', 0);
foreach($comments->children() as $comment){
$classes = explode(' ', $comment->getAttribute('class'));
if(in_array('discussion-item',$classes) ||
in_array('timeline-comment-wrapper',$classes)
){
if(in_array('discussion-item', $classes)
|| in_array('timeline-comment-wrapper', $classes)){
$item = $this->extractIssueComment($issueNbr, $title, $comment);
if(array_keys($item) !== range(0, count($item) - 1)){
$item = array($item);

View file

@ -1,11 +1,11 @@
<?php
class GizmodoBridge extends FeedExpander {
const MAINTAINER = "polopollo";
const NAME = "Gizmodo";
const URI = "http://gizmodo.com/";
const MAINTAINER = 'polopollo';
const NAME = 'Gizmodo';
const URI = 'http://gizmodo.com/';
const CACHE_TIMEOUT = 1800; // 30min
const DESCRIPTION = "Returns the newest posts from Gizmodo (full text).";
const DESCRIPTION = 'Returns the newest posts from Gizmodo (full text).';
protected function parseItem($item){
$item = parent::parseItem($item);
@ -16,7 +16,11 @@ class GizmodoBridge extends FeedExpander {
} else {
$text = $articleHTMLContent->find('div.entry-content', 0)->innertext;
foreach($articleHTMLContent->find('pagespeed_iframe') as $element){
$text .= '<p>link to a iframe (could be a video): <a href="'.$element->src.'">'.$element->src.'</a></p><br>';
$text .= '<p>link to a iframe (could be a video): <a href="'
. $element->src
. '">'
. $element->src
. '</a></p><br>';
}
$text = strip_tags($text, '<p><b><a><blockquote><img><em>');

View file

@ -15,7 +15,8 @@ class GoComicsBridge extends BridgeAbstract {
));
public function collectData(){
$html = getSimpleHTMLDOM($this->getURI()) or returnServerError('Could not request GoComics: '.$this->getURI());
$html = getSimpleHTMLDOM($this->getURI())
or returnServerError('Could not request GoComics: ' . $this->getURI());
foreach($html->find('div.item-comic-container') as $element){
@ -45,7 +46,6 @@ class GoComicsBridge extends BridgeAbstract {
}
public function getName(){
return $this->getInput('comicname') .' - '.'GoComics';
return $this->getInput('comicname') . ' - GoComics';
}
}
?>

View file

@ -1,14 +1,14 @@
<?php
class GooglePlusPostBridge extends BridgeAbstract
{
class GooglePlusPostBridge extends BridgeAbstract{
protected $_title;
protected $_url;
const MAINTAINER = "Grummfy";
const NAME = "Google Plus Post Bridge";
const URI = "https://plus.google.com/";
const MAINTAINER = 'Grummfy';
const NAME = 'Google Plus Post Bridge';
const URI = 'https://plus.google.com/';
const CACHE_TIMEOUT = 600; //10min
const DESCRIPTION = "Returns user public post (without API).";
const DESCRIPTION = 'Returns user public post (without API).';
const PARAMETERS = array( array(
'username' => array(
@ -17,23 +17,24 @@ class GooglePlusPostBridge extends BridgeAbstract
)
));
public function collectData()
{
public function collectData(){
// get content parsed
$html = getSimpleHTMLDOMCached(self::URI . urlencode($this->getInput('username')) . '/posts'
// force language
, 84600, false, stream_context_create(array('http'=> array(
, 84600
, false
, stream_context_create(array(
'http' => array(
'header' => 'Accept-Language: fr,fr-be,fr-fr;q=0.8,en;q=0.4,en-us;q=0.2;*' . "\r\n"
)))
) OR 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
$this->_title = $html->find('meta[property]', 0)->getAttribute('content');
$this->_url = $html->find('meta[itemprop=url]', 0)->getAttribute('content');
// div[jsmodel=XNmfOc]
foreach($html->find('div.yt') as $post)
{
foreach($html->find('div.yt') as $post){
$item = array();
// $item['content'] = $post->find('div.Al', 0)->innertext;
$item['author'] = $item['fullname'] = $post->find('header.lea h3 a', 0)->innertext;
@ -45,34 +46,39 @@ class GooglePlusPostBridge extends BridgeAbstract
// hashtag to treat : https://plus.google.com/explore/tag
$hashtags = array();
foreach($post->find('a.d-s') as $hashtag)
{
foreach($post->find('a.d-s') as $hashtag){
$hashtags[trim($hashtag->plaintext)] = self::URI . $hashtag->href;
}
$item['content'] = '';
// avatar display
$item['content'] .= '<div style="float:left; margin: 0 0.5em 0.5em 0;"><a href="' . self::URI . urlencode($this->getInput('username'));
$item['content'] .= '"><img align="top" alt="' . $item['author'] . '" src="' . $item['avatar'].'" /></a></div>';
$item['content'] .= '<div style="float:left; margin: 0 0.5em 0.5em 0;"><a href="'
. self::URI
. urlencode($this->getInput('username'));
$item['content'] .= '"><img align="top" alt="'
. $item['author']
. '" src="'
. $item['avatar']
. '" /></a></div>';
$content = $post->find('div.Al', 0);
// XXX ugly but I don't have any idea how to do a better stuff, str_replace on link doesn't work as expected and ask too many checks
foreach($content->find('a') as $link)
{
// XXX ugly but I don't have any idea how to do a better stuff,
// str_replace on link doesn't work as expected and ask too many checks
foreach($content->find('a') as $link){
$hasHttp = strpos($link->href, 'http');
$hasDoubleSlash = strpos($link->href, '//');
if((!$hasHttp && !$hasDoubleSlash)
|| (false !== $hasHttp && strpos($link->href, 'http') != 0)
|| (false === $hasHttp && false !== $hasDoubleSlash && $hasDoubleSlash != 0))
{
|| (false === $hasHttp && false !== $hasDoubleSlash && $hasDoubleSlash != 0)){
// skipp bad link, for some hashtag or other stuff
if (strpos($link->href, '/') == 0)
{
if(strpos($link->href, '/') == 0){
$link->href = substr($link->href, 1);
}
$link->href = self::URI . $link->href;
}
}
@ -86,13 +92,11 @@ class GooglePlusPostBridge extends BridgeAbstract
}
}
public function getName()
{
public function getName(){
return $this->_title ?: 'Google Plus Post Bridge';
}
public function getURI()
{
public function getURI(){
return $this->_url ?: self::URI;
}
}

View file

@ -9,11 +9,11 @@
*/
class GoogleSearchBridge extends BridgeAbstract {
const MAINTAINER = "sebsauvage";
const NAME = "Google search";
const URI = "https://www.google.com/";
const MAINTAINER = 'sebsauvage';
const NAME = 'Google search';
const URI = 'https://www.google.com/';
const CACHE_TIMEOUT = 1800; // 30min
const DESCRIPTION = "Returns most recent results from Google search.";
const DESCRIPTION = 'Returns most recent results from Google search.';
const PARAMETERS = array(array(
'q' => array(
@ -22,18 +22,18 @@ class GoogleSearchBridge extends BridgeAbstract {
)
));
public function collectData(){
$html = '';
$html = getSimpleHTMLDOM(self::URI.'search?q='.urlencode($this->getInput('q'))
$html = getSimpleHTMLDOM(self::URI
. 'search?q='
. urlencode($this->getInput('q'))
.'&num=100&complete=0&tbs=qdr:y,sbd:1')
or returnServerError('No results for this query.');
$emIsRes = $html->find('div[id=ires]', 0);
if(!is_null($emIsRes)){
foreach($emIsRes->find('div[class=g]') as $element){
$item = array();
@ -42,10 +42,11 @@ class GoogleSearchBridge extends BridgeAbstract {
$t = $element->find('a[href]', 0)->href;
$item['uri'] = '' . $t;
parse_str(parse_url($t, PHP_URL_QUERY), $parameters);
if (isset($parameters['q'])) { $item['uri'] = $parameters['q']; }
if(isset($parameters['q'])){
$item['uri'] = $parameters['q'];
}
$item['title'] = $element->find('h3', 0)->plaintext;
$item['content'] = $element->find('span[class=st]', 0)->plaintext;
$this->items[] = $item;
@ -54,7 +55,6 @@ class GoogleSearchBridge extends BridgeAbstract {
}
public function getName(){
return $this->getInput('q') . ' - Google search';
}
}

View file

@ -1,17 +1,19 @@
<?php
class HDWallpapersBridge extends BridgeAbstract {
const MAINTAINER = "nel50n";
const NAME = "HD Wallpapers Bridge";
const URI = "http://www.hdwallpapers.in/";
const MAINTAINER = 'nel50n';
const NAME = 'HD Wallpapers Bridge';
const URI = 'http://www.hdwallpapers.in/';
const CACHE_TIMEOUT = 43200; //12h
const DESCRIPTION = "Returns the latests wallpapers from HDWallpapers";
const DESCRIPTION = 'Returns the latests wallpapers from HDWallpapers';
const PARAMETERS = array( array(
'c' => array(
'name' => 'category',
'defaultValue' => 'latest_wallpapers'
),
'm'=>array('name'=>'max number of wallpapers'),
'm' => array(
'name' => 'max number of wallpapers'
),
'r' => array(
'name' => 'resolution',
'defaultValue' => '1920x1200',
@ -31,7 +33,8 @@ class HDWallpapersBridge extends BridgeAbstract {
for($page = 1; $page <= $lastpage; $page++){
$link = self::URI . '/' . $category . '/page/' . $page;
$html = getSimpleHTMLDOM($link) or returnServerError('No results for this query.');
$html = getSimpleHTMLDOM($link)
or returnServerError('No results for this query.');
if($page === 1){
preg_match('/page\/(\d+)$/', $html->find('.pagination a', -2)->href, $matches);
@ -43,10 +46,20 @@ class HDWallpapersBridge extends BridgeAbstract {
$item = array();
// http://www.hdwallpapers.in/download/yosemite_reflections-1680x1050.jpg
$item['uri'] = self::URI.'/download'.str_replace('wallpapers.html', $this->getInput('r').'.jpg', $element->href);
$item['uri'] = self::URI
. '/download'
. str_replace('wallpapers.html', $this->getInput('r') . '.jpg', $element->href);
$item['timestamp'] = time();
$item['title'] = $element->find('p', 0)->text();
$item['content'] = $item['title'].'<br><a href="'.$item['uri'].'"><img src="'.self::URI.$thumbnail->src.'" /></a>';
$item['content'] = $item['title']
. '<br><a href="'
. $item['uri']
. '"><img src="'
. self::URI
. $thumbnail->src
. '" /></a>';
$this->items[] = $item;
$num++;
@ -57,6 +70,10 @@ class HDWallpapersBridge extends BridgeAbstract {
}
public function getName(){
return 'HDWallpapers - '.str_replace(['__', '_'], [' & ', ' '], $this->getInput('c')).' ['.$this->getInput('r').']';
return 'HDWallpapers - '
. str_replace(['__', '_'], [' & ', ' '], $this->getInput('c'))
. ' ['
. $this->getInput('r')
. ']';
}
}

View file

@ -1,22 +1,36 @@
<?php
class HentaiHavenBridge extends BridgeAbstract {
const MAINTAINER = "albirew";
const NAME = "Hentai Haven";
const URI = "http://hentaihaven.org/";
const MAINTAINER = 'albirew';
const NAME = 'Hentai Haven';
const URI = 'http://hentaihaven.org/';
const CACHE_TIMEOUT = 21600; // 6h
const DESCRIPTION = "Returns releases from Hentai Haven";
const DESCRIPTION = 'Returns releases from Hentai Haven';
public function collectData(){
$html = getSimpleHTMLDOM(self::URI)
or returnServerError('Could not request Hentai Haven.');
foreach($html->find('div.zoe-grid') as $element){
$item = array();
$item['uri'] = $element->find('div.brick-content h3 a', 0)->href;
$thumbnailUri = $element->find('a.thumbnail-image img', 0)->getAttribute('data-src');
$item['title'] = mb_convert_encoding(trim($element->find('div.brick-content h3 a', 0)->innertext), 'UTF-8', 'HTML-ENTITIES');
$item['title'] = mb_convert_encoding(
trim($element->find('div.brick-content h3 a', 0)->innertext),
'UTF-8',
'HTML-ENTITIES'
);
$item['tags'] = $element->find('div.oFlyout_bg div.oFlyout div.flyoutContent span.tags', 0)->plaintext;
$item['content'] = 'Tags: ' . $item['tags'].'<br><br><a href="' . $item['uri'] . '"><img width="300" height="169" src="' . $thumbnailUri . '" /></a><br>' . $element->find('div.oFlyout_bg div.oFlyout div.flyoutContent p.description', 0)->innertext;
$item['content'] = 'Tags: '
. $item['tags']
. '<br><br><a href="'
. $item['uri']
. '"><img width="300" height="169" src="'
. $thumbnailUri
. '" /></a><br>'
. $element->find('div.oFlyout_bg div.oFlyout div.flyoutContent p.description', 0)->innertext;
$this->items[] = $item;
}
}

View file

@ -1,11 +1,11 @@
<?php
class IdenticaBridge extends BridgeAbstract {
const MAINTAINER = "mitsukarenai";
const NAME = "Identica Bridge";
const URI = "https://identi.ca/";
const MAINTAINER = 'mitsukarenai';
const NAME = 'Identica Bridge';
const URI = 'https://identi.ca/';
const CACHE_TIMEOUT = 300; // 5min
const DESCRIPTION = "Returns user timelines";
const DESCRIPTION = 'Returns user timelines';
const PARAMETERS = array( array(
'u' => array(
@ -20,9 +20,15 @@ class IdenticaBridge extends BridgeAbstract{
foreach($html->find('li.major') as $dent){
$item = array();
$item['uri'] = html_entity_decode($dent->find('a', 0)->href); // get dent link
$item['timestamp'] = strtotime($dent->find('abbr.easydate', 0)->plaintext); // extract dent timestamp
$item['content'] = trim($dent->find('div.activity-content', 0)->innertext); // extract dent text
// get dent link
$item['uri'] = html_entity_decode($dent->find('a', 0)->href);
// extract dent timestamp
$item['timestamp'] = strtotime($dent->find('abbr.easydate', 0)->plaintext);
// extract dent text
$item['content'] = trim($dent->find('div.activity-content', 0)->innertext);
$item['title'] = $this->getInput('u') . ' | ' . $item['content'];
$this->items[] = $item;
}

View file

@ -1,10 +1,10 @@
<?php
class InstagramBridge extends BridgeAbstract {
const MAINTAINER = "pauder";
const NAME = "Instagram Bridge";
const URI = "http://instagram.com/";
const DESCRIPTION = "Returns the newest images";
const MAINTAINER = 'pauder';
const NAME = 'Instagram Bridge';
const URI = 'http://instagram.com/';
const DESCRIPTION = 'Returns the newest images';
const PARAMETERS = array( array(
'u' => array(
@ -19,15 +19,13 @@ class InstagramBridge extends BridgeAbstract{
$innertext = null;
foreach($html->find('script') as $script)
{
foreach($html->find('script') as $script){
if('' === $script->innertext){
continue;
}
$pos = strpos(trim($script->innertext), 'window._sharedData');
if (0 !== $pos)
{
if(0 !== $pos){
continue;
}
@ -38,25 +36,19 @@ class InstagramBridge extends BridgeAbstract{
$json = trim(substr($innertext, $pos + 18), ' =;');
$data = json_decode($json);
$userMedia = $data->entry_data->ProfilePage[0]->user->media->nodes;
foreach($userMedia as $media)
{
foreach($userMedia as $media){
$item = array();
$item['uri'] = self::URI . 'p/' . $media->code . '/';
$item['content'] = '<img src="' . htmlentities($media->display_src) . '" />';
if (isset($media->caption))
{
if (isset($media->caption)){
$item['title'] = $media->caption;
} else {
$item['title'] = basename($media->display_src);
}
$item['timestamp'] = $media->date;
$this->items[] = $item;
}
}
@ -68,4 +60,3 @@ class InstagramBridge extends BridgeAbstract{
return self::URI . urlencode($this->getInput('u'));
}
}

View file

@ -108,17 +108,15 @@ class IsoHuntBridge extends BridgeAbstract{
break;
}
break;
case 'By "Torrent" category':
$uri .= $this->build_category_uri(
$uri .= $this->buildCategoryUri(
$this->getInput('torrent_category'),
$this->getInput('torrent_popularity')
);
break;
case 'Search torrent by name':
$category = $this->getInput('search_category');
$uri .= $this->build_category_uri($category);
$uri .= $this->buildCategoryUri($category);
if($category !== 'movies')
$uri .= '&ihq=' . urlencode($this->getInput('search_name'));
break;
@ -132,73 +130,68 @@ class IsoHuntBridge extends BridgeAbstract{
public function getName(){
switch($this->queriedContext){
case 'By "Latest" category':
$categoryName =
array_search(
$categoryName = array_search(
$this->getInput('latest_category'),
self::PARAMETERS['By "Latest" category']['latest_category']['values']
);
$name = 'Latest ' . $categoryName . ' - ' . self::NAME;
break;
case 'By "Torrent" category':
$categoryName =
array_search(
$categoryName = array_search(
$this->getInput('torrent_category'),
self::PARAMETERS['By "Torrent" category']['torrent_category']['values']
);
$name = 'Category: ' . $categoryName . ' - ' . self::NAME;
break;
case 'Search torrent by name':
$categoryName =
array_search(
$categoryName = array_search(
$this->getInput('search_category'),
self::PARAMETERS['Search torrent by name']['search_category']['values']
);
$name = 'Search: "' . $this->getInput('search_name') . '" in category: ' . $categoryName . ' - ' . self::NAME;
$name = 'Search: "'
. $this->getInput('search_name')
. '" in category: '
. $categoryName . ' - '
. self::NAME;
break;
default: return parent::getName();
}
return $name;
}
public function collectData(){
$html = $this->load_html($this->getURI());
$html = $this->loadHtml($this->getURI());
switch($this->queriedContext){
case 'By "Latest" category':
switch($this->getInput('latest_category')){
case 'hot_torrents':
$this->get_latest_hot_torrents($html);
$this->getLatestHotTorrents($html);
break;
case 'news':
$this->get_latest_news($html);
$this->getLatestNews($html);
break;
case 'releases':
case 'torrents':
$this->get_latest_torrents($html);
$this->getLatestTorrents($html);
break;
}
break;
case 'By "Torrent" category':
if($this->getInput('torrent_category') === 'movies'){
// This one is special (content wise)
$this->get_movie_torrents($html);
$this->getMovieTorrents($html);
} else {
$this->get_latest_torrents($html);
$this->getLatestTorrents($html);
}
break;
case 'Search torrent by name':
if( $this->getInput('search_category') === 'movies'){
// This one is special (content wise)
$this->get_movie_torrents($html);
$this->getMovieTorrents($html);
} else {
$this->get_latest_torrents($html);
$this->getLatestTorrents($html);
}
break;
}
@ -206,7 +199,7 @@ class IsoHuntBridge extends BridgeAbstract{
#region Helper functions for "Movie Torrents"
private function get_movie_torrents($html){
private function getMovieTorrents($html){
$container = $html->find('div#w0', 0);
if(!$container)
returnServerError('Unable to find torrent container!');
@ -227,11 +220,11 @@ class IsoHuntBridge extends BridgeAbstract{
$item = array();
$item['uri'] = $this->fix_relative_uri($anchor->href);
$item['uri'] = $this->fixRelativeUri($anchor->href);
$item['title'] = $anchor->title;
// $item['author'] =
$item['timestamp'] = strtotime($date->plaintext);
$item['content'] = $this->fix_relative_uri($torrent->innertext);
$item['content'] = $this->fixRelativeUri($torrent->innertext);
$this->items[] = $item;
}
@ -241,7 +234,7 @@ class IsoHuntBridge extends BridgeAbstract{
#region Helper functions for "Latest Hot Torrents"
private function get_latest_hot_torrents($html){
private function getLatestHotTorrents($html){
$container = $html->find('div#serps', 0);
if(!$container)
returnServerError('Unable to find torrent container!');
@ -279,7 +272,7 @@ class IsoHuntBridge extends BridgeAbstract{
#region Helper functions for "Latest News"
private function get_latest_news($html){
private function getLatestNews($html){
$container = $html->find('div#postcontainer', 0);
if(!$container)
returnServerError('Unable to find post container!');
@ -291,17 +284,17 @@ class IsoHuntBridge extends BridgeAbstract{
foreach($posts as $post){
$item = array();
$item['uri'] = $this->latest_news_extract_uri($post);
$item['title'] = $this->latest_news_extract_title($post);
$item['author'] = $this->latest_news_extract_author($post);
$item['timestamp'] = $this->latest_news_extract_timestamp($post);
$item['content'] = $this->latest_news_extract_content($post);
$item['uri'] = $this->latestNewsExtractUri($post);
$item['title'] = $this->latestNewsExtractTitle($post);
$item['author'] = $this->latestNewsExtractAuthor($post);
$item['timestamp'] = $this->latestNewsExtractTimestamp($post);
$item['content'] = $this->latestNewsExtractContent($post);
$this->items[] = $item;
}
}
private function latest_news_extract_author($post){
private function latestNewsExtractAuthor($post){
$author = $post->find('small', 0);
if(!$author)
returnServerError('Unable to find author!');
@ -312,7 +305,7 @@ class IsoHuntBridge extends BridgeAbstract{
return $matches[1];
}
private function latest_news_extract_timestamp($post){
private function latestNewsExtractTimestamp($post){
$date = $post->find('small', 0);
if(!$date)
returnServerError('Unable to find date!');
@ -330,7 +323,7 @@ class IsoHuntBridge extends BridgeAbstract{
return $timestamp;
}
private function latest_news_extract_title($post){
private function latestNewsExtractTitle($post){
$title = $post->find('a', 0);
if(!$title)
returnServerError('Unable to find title!');
@ -338,7 +331,7 @@ class IsoHuntBridge extends BridgeAbstract{
return $title->plaintext;
}
private function latest_news_extract_uri($post){
private function latestNewsExtractUri($post){
$uri = $post->find('a', 0);
if(!$uri)
returnServerError('Unable to find uri!');
@ -346,7 +339,7 @@ class IsoHuntBridge extends BridgeAbstract{
return $uri->href;
}
private function latest_news_extract_content($post){
private function latestNewsExtractContent($post){
$content = $post->find('div', 0);
if(!$content)
returnServerError('Unable to find content!');
@ -368,7 +361,7 @@ class IsoHuntBridge extends BridgeAbstract{
#region Helper functions for "Latest Torrents", "Latest Releases" and "Torrent Category"
private function get_latest_torrents($html){
private function getLatestTorrents($html){
$container = $html->find('div#serps', 0);
if(!$container)
returnServerError('Unable to find torrent container!');
@ -380,17 +373,17 @@ class IsoHuntBridge extends BridgeAbstract{
foreach($torrents as $torrent){
$item = array();
$item['uri'] = $this->latest_torrents_extract_uri($torrent);
$item['title'] = $this->latest_torrents_extract_title($torrent);
$item['author'] = $this->latest_torrents_extract_author($torrent);
$item['timestamp'] = $this->latest_torrents_extract_timestamp($torrent);
$item['uri'] = $this->latestTorrentsExtractUri($torrent);
$item['title'] = $this->latestTorrentsExtractTitle($torrent);
$item['author'] = $this->latestTorrentsExtractAuthor($torrent);
$item['timestamp'] = $this->latestTorrentsExtractTimestamp($torrent);
$item['content'] = ''; // There is no valuable content
$this->items[] = $item;
}
}
private function latest_torrents_extract_title($torrent){
private function latestTorrentsExtractTitle($torrent){
$cell = $torrent->find('td.title-row', 0);
if(!$cell)
returnServerError('Unable to find title cell!');
@ -402,7 +395,7 @@ class IsoHuntBridge extends BridgeAbstract{
return $title->plaintext;
}
private function latest_torrents_extract_uri($torrent){
private function latestTorrentsExtractUri($torrent){
$cell = $torrent->find('td.title-row', 0);
if(!$cell)
returnServerError('Unable to find title cell!');
@ -411,10 +404,10 @@ class IsoHuntBridge extends BridgeAbstract{
if(!$uri)
returnServerError('Unable to find uri!');
return $this->fix_relative_uri($uri->href);
return $this->fixRelativeUri($uri->href);
}
private function latest_torrents_extract_author($torrent){
private function latestTorrentsExtractAuthor($torrent){
$cell = $torrent->find('td.user-row', 0);
if(!$cell)
return; // No author
@ -426,7 +419,7 @@ class IsoHuntBridge extends BridgeAbstract{
return $user->plaintext;
}
private function latest_torrents_extract_timestamp($torrent){
private function latestTorrentsExtractTimestamp($torrent){
$cell = $torrent->find('td.date-row', 0);
if(!$cell)
returnServerError('Unable to find date cell!');
@ -438,7 +431,7 @@ class IsoHuntBridge extends BridgeAbstract{
#region Generic helper functions
private function load_html($uri){
private function loadHtml($uri){
$html = getSimpleHTMLDOM($uri);
if(!$html)
returnServerError('Unable to load ' . $uri . '!');
@ -446,11 +439,11 @@ class IsoHuntBridge extends BridgeAbstract{
return $html;
}
private function fix_relative_uri($uri){
private function fixRelativeUri($uri){
return preg_replace('/\//i', self::URI, $uri, 1);
}
private function build_category_uri($category, $order_popularity = false){
private function buildCategoryUri($category, $order_popularity = false){
switch($category){
case 'anime': $index = 1; break;
case 'software' : $index = 2; break;

View file

@ -15,7 +15,7 @@ class JapanExpoBridge extends BridgeAbstract {
public function collectData(){
function french_pubdate_to_timestamp($date_to_parse) {
function frenchPubDateToTimestamp($date_to_parse) {
return strtotime(
strtr(
strtolower(str_replace('Publié le ', '', $date_to_parse)),
@ -53,6 +53,7 @@ class JapanExpoBridge extends BridgeAbstract {
$url = $element->href;
$thumbnail = 'http://s.japan-expo.com/katana/images/JES049/paris.png';
preg_match('/url\(([^)]+)\)/', $element->find('img.rspvimgset', 0)->style, $img_search_result);
if(count($img_search_result) >= 2)
$thumbnail = trim($img_search_result[1], "'");
@ -68,13 +69,23 @@ class JapanExpoBridge extends BridgeAbstract {
$title = $title_html->plaintext;
$headings = $title_html->next_sibling()->outertext;
$article = $article_html->find('div.content', 0)->innertext;
$article = preg_replace_callback('/<img [^>]+ style="[^\(]+\(\'([^\']+)\'[^>]+>/i', $convert_article_images, $article);
$article = preg_replace_callback(
'/<img [^>]+ style="[^\(]+\(\'([^\']+)\'[^>]+>/i',
$convert_article_images,
$article);
$content = $headings . $article;
} else {
$date_text = $element->find('span.date', 0)->plaintext;
$timestamp = french_pubdate_to_timestamp($date_text);
$timestamp = frenchPubDateToTimestamp($date_text);
$title = trim($element->find('span._title', 0)->plaintext);
$content = '<img src="'.$thumbnail.'"></img><br />'.$date_text.'<br /><a href="'.$url.'">Lire l\'article</a>';
$content = '<img src="'
. $thumbnail
. '"></img><br />'
. $date_text
. '<br /><a href="'
. $url
. '">Lire l\'article</a>';
}
$item = array();

View file

@ -3,9 +3,9 @@ require_once('MoebooruBridge.php');
class KonachanBridge extends MoebooruBridge {
const MAINTAINER = "mitsukarenai";
const NAME = "Konachan";
const URI = "http://konachan.com/";
const DESCRIPTION = "Returns images from given page";
const MAINTAINER = 'mitsukarenai';
const NAME = 'Konachan';
const URI = 'http://konachan.com/';
const DESCRIPTION = 'Returns images from given page';
}

View file

@ -1,10 +1,10 @@
<?php
class KoreusBridge extends FeedExpander {
const MAINTAINER = "pit-fgfjiudghdf";
const NAME = "Koreus";
const URI = "http://www.koreus.com/";
const DESCRIPTION = "Returns the newest posts from Koreus (full text)";
const MAINTAINER = 'pit-fgfjiudghdf';
const NAME = 'Koreus';
const URI = 'http://www.koreus.com/';
const DESCRIPTION = 'Returns the newest posts from Koreus (full text)';
protected function parseItem($item){
$item = parent::parseItem($item);

View file

@ -1,10 +1,10 @@
<?php
class KununuBridge extends BridgeAbstract {
const MAINTAINER = "logmanoriginal";
const NAME = "Kununu Bridge";
const URI = "https://www.kununu.com/";
const MAINTAINER = 'logmanoriginal';
const NAME = 'Kununu Bridge';
const URI = 'https://www.kununu.com/';
const CACHE_TIMEOUT = 86400; // 24h
const DESCRIPTION = "Returns the latest reviews for a company and site of your choice.";
const DESCRIPTION = 'Returns the latest reviews for a company and site of your choice.';
const PARAMETERS = array(
'global' => array(
@ -28,7 +28,6 @@ class KununuBridge extends BridgeAbstract {
'title' => 'Activate to load full article'
)
),
array(
'company' => array(
'name' => 'Company',
@ -44,7 +43,7 @@ class KununuBridge extends BridgeAbstract {
public function getURI(){
if(!is_null($this->getInput('company')) && !is_null($this->getInput('site'))){
$company = $this->fix_company_name($this->getInput('company'));
$company = $this->fixCompanyName($this->getInput('company'));
$site = $this->getInput('site');
$section = '';
@ -67,7 +66,7 @@ class KununuBridge extends BridgeAbstract {
function getName(){
if(!is_null($this->getInput('company'))){
$company = $this->fix_company_name($this->getInput('company'));
$company = $this->fixCompanyName($this->getInput('company'));
return ($this->companyName ?: $company) . ' - ' . self::NAME;
}
@ -82,7 +81,7 @@ class KununuBridge extends BridgeAbstract {
if(!$html)
returnServerError('Unable to receive data from ' . $this->getURI() . '!');
// Update name for this request
$this->companyName = $this->extract_company_name($html);
$this->companyName = $this->extractCompanyName($html);
// Find the section with all the panels (reviews)
$section = $html->find('section.kununu-scroll-element', 0);
@ -98,15 +97,18 @@ class KununuBridge extends BridgeAbstract {
foreach($articles as $article){
$item = array();
$item['author'] = $this->extract_article_author_position($article);
$item['timestamp'] = $this->extract_article_date($article);
$item['title'] = $this->extract_article_rating($article) . ' : ' . $this->extract_article_summary($article);
$item['uri'] = $this->extract_article_uri($article);
$item['author'] = $this->extractArticleAuthorPosition($article);
$item['timestamp'] = $this->extractArticleDate($article);
$item['title'] = $this->extractArticleRating($article)
. ' : '
. $this->extractArticleSummary($article);
$item['uri'] = $this->extractArticleUri($article);
if($full)
$item['content'] = $this->extract_full_description($item['uri']);
$item['content'] = $this->extractFullDescription($item['uri']);
else
$item['content'] = $this->extract_article_description($article);
$item['content'] = $this->extractArticleDescription($article);
$this->items[] = $item;
}
@ -115,24 +117,24 @@ class KununuBridge extends BridgeAbstract {
/**
* Fixes relative URLs in the given text
*/
private function fix_url($text){
private function fixUrl($text){
return preg_replace('/href=(\'|\")\//i', 'href="'.self::URI, $text);
}
/*
* Returns a fixed version of the provided company name
*/
private function fix_company_name($company){
private function fixCompanyName($company){
$company = trim($company);
$company = str_replace(' ', '-', $company);
$company = strtolower($company);
return $this->encode_umlauts($company);
return $this->encodeUmlauts($company);
}
/**
* Encodes unmlauts in the given text
*/
private function encode_umlauts($text){
private function encodeUmlauts($text){
$umlauts = Array("/ä/","/ö/","/ü/","/Ä/","/Ö/","/Ü/","/ß/");
$replace = Array("ae","oe","ue","Ae","Oe","Ue","ss");
@ -142,7 +144,7 @@ class KununuBridge extends BridgeAbstract {
/**
* Returns the company name from the review html
*/
private function extract_company_name($html){
private function extractCompanyName($html){
$company_name = $html->find('h1[itemprop=name]', 0);
if(is_null($company_name))
returnServerError('Cannot find company name!');
@ -153,7 +155,7 @@ class KununuBridge extends BridgeAbstract {
/**
* Returns the date from a given article
*/
private function extract_article_date($article){
private function extractArticleDate($article){
// They conviniently provide a time attribute for us :)
$date = $article->find('meta[itemprop=dateCreated]', 0);
if(is_null($date))
@ -165,7 +167,7 @@ class KununuBridge extends BridgeAbstract {
/**
* Returns the rating from a given article
*/
private function extract_article_rating($article){
private function extractArticleRating($article){
$rating = $article->find('span.rating', 0);
if(is_null($rating))
returnServerError('Cannot find article rating!');
@ -176,7 +178,7 @@ class KununuBridge extends BridgeAbstract {
/**
* Returns the summary from a given article
*/
private function extract_article_summary($article){
private function extractArticleSummary($article){
$summary = $article->find('[itemprop=name]', 0);
if(is_null($summary))
returnServerError('Cannot find article summary!');
@ -187,7 +189,7 @@ class KununuBridge extends BridgeAbstract {
/**
* Returns the URI from a given article
*/
private function extract_article_uri($article){
private function extractArticleUri($article){
$anchor = $article->find('ku-company-review-more', 0);
if(is_null($anchor))
returnServerError('Cannot find article URI!');
@ -198,7 +200,7 @@ class KununuBridge extends BridgeAbstract {
/**
* Returns the position of the author from a given article
*/
private function extract_article_author_position($article){
private function extractArticleAuthorPosition($article){
// We need to parse the user-content manually
$user_content = $article->find('div.user-content', 0);
if(is_null($user_content))
@ -219,18 +221,18 @@ class KununuBridge extends BridgeAbstract {
/**
* Returns the description from a given article
*/
private function extract_article_description($article){
private function extractArticleDescription($article){
$description = $article->find('[itemprop=reviewBody]', 0);
if(is_null($description))
returnServerError('Cannot find article description!');
return $this->fix_url($description->innertext);
return $this->fixUrl($description->innertext);
}
/**
* Returns the full description from a given uri
*/
private function extract_full_description($uri){
private function extractFullDescription($uri){
// Load full article
$html = getSimpleHTMLDOMCached($uri);
if($html === false)
@ -242,6 +244,6 @@ class KununuBridge extends BridgeAbstract {
returnServerError('Cannot find article!');
// Luckily they use the same layout for the review overview and full article pages :)
return $this->extract_article_description($article);
return $this->extractArticleDescription($article);
}
}

View file

@ -123,12 +123,13 @@ class LWNprevBridge extends BridgeAbstract{
$contentEnd = false;
while(!$contentEnd){
$node = $node->nextSibling;
if(
!$node || (
if(!$node || (
$node->nodeType !== XML_TEXT_NODE && (
$node->nodeName==='h2' ||
(!is_null($node->attributes) && !is_null($class=$node->attributes->getNamedItem('class')) &&
in_array($class->nodeValue,array('Cat1HL','Cat2HL')))
$node->nodeName === 'h2' || (
!is_null($node->attributes) &&
!is_null($class = $node->attributes->getNamedItem('class')) &&
in_array($class->nodeValue, array('Cat1HL', 'Cat2HL'))
)
)
)
){

View file

@ -1,12 +1,14 @@
<?php
class LeBonCoinBridge extends BridgeAbstract {
const MAINTAINER = "16mhz";
const NAME = "LeBonCoin";
const URI = "http://www.leboncoin.fr/";
const DESCRIPTION = "Returns most recent results from LeBonCoin for a region, and optionally a category and a keyword .";
const MAINTAINER = '16mhz';
const NAME = 'LeBonCoin';
const URI = 'http://www.leboncoin.fr/';
const DESCRIPTION = 'Returns most recent results from LeBonCoin for a
region, and optionally a category and a keyword .';
const PARAMETERS = array( array(
const PARAMETERS = array(
array(
'k' => array('name' => 'Mot Clé'),
'r' => array(
'name' => 'Région',
@ -143,14 +145,16 @@ class LeBonCoinBridge extends BridgeAbstract{
$category = 'annonces';
}
$html = getSimpleHTMLDOM(
self::URI.$category.'/offres/' . $this->getInput('r') . '/?'
.'f=a&th=1&'
.'q=' . urlencode($this->getInput('k'))
) or returnServerError('Could not request LeBonCoin.');
$html = getSimpleHTMLDOM(self::URI
. $category
. '/offres/'
. $this->getInput('r')
. '/?f=a&th=1&q='
. urlencode($this->getInput('k')))
or returnServerError('Could not request LeBonCoin.');
$list = $html->find('.tabsContent', 0);
if($list === NULL) {
if($list === null){
return;
}
@ -165,7 +169,7 @@ class LeBonCoinBridge extends BridgeAbstract{
$title = html_entity_decode($element->getAttribute('title'));
$content_image = $element->find('div.item_image', 0)->find('.lazyload', 0);
if($content_image !== NULL) {
if($content_image !== null){
$content = '<img src="' . $content_image->getAttribute('data-imgsrc') . '" alt="thumbnail">';
} else {
$content = "";
@ -176,7 +180,7 @@ class LeBonCoinBridge extends BridgeAbstract{
for($i = 0; $i <= 1; $i++) $content .= $detailsList->find('p.item_supp', $i)->plaintext;
$price = $detailsList->find('h3.item_price', 0);
$content .= $price === NULL ? '' : $price->plaintext;
$content .= $price === null ? '' : $price->plaintext;
$item['title'] = $title;
$item['content'] = $content . $date;

View file

@ -1,11 +1,11 @@
<?php
class LeMondeInformatiqueBridge extends FeedExpander {
const MAINTAINER = "ORelio";
const NAME = "Le Monde Informatique";
const URI = "http://www.lemondeinformatique.fr/";
const MAINTAINER = 'ORelio';
const NAME = 'Le Monde Informatique';
const URI = 'http://www.lemondeinformatique.fr/';
const CACHE_TIMEOUT = 1800; // 30min
const DESCRIPTION = "Returns the newest articles.";
const DESCRIPTION = 'Returns the newest articles.';
public function collectData(){
$this->collectExpandableDatas(self::URI . 'rss/rss.xml', 10);
@ -15,28 +15,30 @@ class LeMondeInformatiqueBridge extends FeedExpander {
$item = parent::parseItem($newsItem);
$article_html = getSimpleHTMLDOMCached($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;
return $item;
}
private function StripCDATA($string) {
private function stripCDATA($string){
$string = str_replace('<![CDATA[', '', $string);
$string = str_replace(']]>', '', $string);
return $string;
}
private function StripWithDelimiters($string, $start, $end) {
private function stripWithDelimiters($string, $start, $end){
while(strpos($string, $start) !== false){
$section_to_remove = substr($string, strpos($string, $start));
$section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end));
$string = str_replace($section_to_remove, '', $string);
} return $string;
}
private function CleanArticle($article_html) {
$article_html = $this->StripWithDelimiters($article_html, '<script', '</script>');
$article_html = $this->StripWithDelimiters($article_html, '<h1 class="cleanprint-title"', '</h1>');
return $string;
}
private function cleanArticle($article_html){
$article_html = $this->stripWithDelimiters($article_html, '<script', '</script>');
$article_html = $this->stripWithDelimiters($article_html, '<h1 class="cleanprint-title"', '</h1>');
return $article_html;
}
}

View file

@ -66,5 +66,3 @@ class LegifranceJOBridge extends BridgeAbstract{
}
}
}

View file

@ -1,11 +1,11 @@
<?php
class LesJoiesDuCodeBridge extends BridgeAbstract {
const MAINTAINER = "superbaillot.net";
const NAME = "Les Joies Du Code";
const URI = "http://lesjoiesducode.fr/";
const MAINTAINER = 'superbaillot.net';
const NAME = 'Les Joies Du Code';
const URI = 'http://lesjoiesducode.fr/';
const CACHE_TIMEOUT = 7200; // 2h
const DESCRIPTION = "LesJoiesDuCode";
const DESCRIPTION = 'LesJoiesDuCode';
public function collectData(){
$html = getSimpleHTMLDOM(self::URI)
@ -30,13 +30,11 @@ class LesJoiesDuCodeBridge extends BridgeAbstract{
$auteur = $temp->find('i', 0);
$pos = strpos($auteur->innertext, "by");
if($pos > 0)
{
if($pos > 0){
$auteur = trim(str_replace("*/", "", substr($auteur->innertext, ($pos + 2))));
$item['author'] = $auteur;
}
$item['content'] .= trim($content);
$item['uri'] = $url;
$item['title'] = trim($titre);

View file

@ -12,11 +12,11 @@ class LichessBridge extends FeedExpander {
protected function parseItem($newsItem){
$item = parent::parseItem($newsItem);
$item['content'] = $this->retrieve_lichess_post($item['uri']);
$item['content'] = $this->retrieveLichessPost($item['uri']);
return $item;
}
private function retrieve_lichess_post($blog_post_uri){
private function retrieveLichessPost($blog_post_uri){
$blog_post_html = getSimpleHTMLDOMCached($blog_post_uri);
$blog_post_div = $blog_post_html->find('#lichess_blog', 0);

View file

@ -1,11 +1,12 @@
<?php
class LinkedInCompanyBridge extends BridgeAbstract {
const MAINTAINER = "regisenguehard";
const NAME = "LinkedIn Company";
const URI = "https://www.linkedin.com/";
const MAINTAINER = 'regisenguehard';
const NAME = 'LinkedIn Company';
const URI = 'https://www.linkedin.com/';
const CACHE_TIMEOUT = 21600; //6
const DESCRIPTION = "Returns most recent actus from Company on LinkedIn. (https://www.linkedin.com/company/<strong style=\"font-weight:bold;\">apple</strong>)";
const DESCRIPTION = 'Returns most recent actus from Company on LinkedIn.
(https://www.linkedin.com/company/<strong style=\"font-weight:bold;\">apple</strong>)';
const PARAMETERS = array( array(
'c' => array(

View file

@ -3,9 +3,9 @@ require_once('MoebooruBridge.php');
class LolibooruBridge extends MoebooruBridge {
const MAINTAINER = "mitsukarenai";
const NAME = "Lolibooru";
const URI = "https://lolibooru.moe/";
const DESCRIPTION = "Returns images from given page and tags";
const MAINTAINER = 'mitsukarenai';
const NAME = 'Lolibooru';
const URI = 'https://lolibooru.moe/';
const DESCRIPTION = 'Returns images from given page and tags';
}

View file

@ -1,11 +1,11 @@
<?php
class MangareaderBridge extends BridgeAbstract {
const MAINTAINER = "logmanoriginal";
const NAME = "Mangareader Bridge";
const URI = "http://www.mangareader.net/";
const MAINTAINER = 'logmanoriginal';
const NAME = 'Mangareader Bridge';
const URI = 'http://www.mangareader.net/';
const CACHE_TIMEOUT = 10800; // 3h
const DESCRIPTION = "Returns the latest updates, popular mangas or manga updates (new chapters)";
const DESCRIPTION = 'Returns the latest updates, popular mangas or manga updates (new chapters)';
const PARAMETERS = array(
'Get latest updates' => array(),
@ -95,13 +95,13 @@ class MangareaderBridge extends BridgeAbstract {
switch($this->queriedContext){
case 'Get latest updates':
$this->request = 'Latest updates';
$this->get_latest_updates($xpath);
$this->getLatestUpdates($xpath);
break;
case 'Get popular mangas':
// Find manga name within "Popular mangas for ..."
$pagetitle = $xpath->query(".//*[@id='bodyalt']/h1")->item(0)->nodeValue;
$this->request = substr($pagetitle, 0, strrpos($pagetitle, " -"));
$this->get_popular_mangas($xpath);
$this->getPopularMangas($xpath);
break;
case 'Get manga updates':
$limit = $this->getInput('limit');
@ -113,7 +113,7 @@ class MangareaderBridge extends BridgeAbstract {
->item(0)
->nodeValue;
$this->get_manga_updates($xpath, $limit);
$this->getMangaUpdates($xpath, $limit);
break;
}
@ -126,7 +126,7 @@ class MangareaderBridge extends BridgeAbstract {
}
}
private function get_latest_updates($xpath){
private function getLatestUpdates($xpath){
// Query each item (consists of Manga + chapters)
$nodes = $xpath->query("//*[@id='latestchapters']/table//td");
@ -149,8 +149,7 @@ class MangareaderBridge extends BridgeAbstract {
if($item['content'] <> ""){
$item['content'] .= "<br>";
}
$item['content'] .=
"<a href='"
$item['content'] .= "<a href='"
. self::URI
. htmlspecialchars($chapter->getAttribute('href'))
. "'>"
@ -163,7 +162,7 @@ class MangareaderBridge extends BridgeAbstract {
}
}
private function get_popular_mangas($xpath){
private function getPopularMangas($xpath){
// Query all mangas
$mangas = $xpath->query("//*[@id='mangaresults']/*[@class='mangaresultitem']");
@ -201,7 +200,7 @@ EOD;
}
}
private function get_manga_updates($xpath, $limit){
private function getMangaUpdates($xpath, $limit){
$query = "(.//*[@id='listing']//tr)[position() > 1]";
if($limit !== -1){
@ -244,9 +243,7 @@ EOD;
return self::URI . $path;
}
public function getName(){
return (!empty($this->request) ? $this->request . ' - ' : '') . 'Mangareader Bridge';
}
}
?>

View file

@ -3,9 +3,9 @@ require_once('Shimmie2Bridge.php');
class MilbooruBridge extends Shimmie2Bridge {
const MAINTAINER = "mitsukarenai";
const NAME = "Milbooru";
const URI = "http://sheslostcontrol.net/moe/shimmie/";
const DESCRIPTION = "Returns images from given page";
const MAINTAINER = 'mitsukarenai';
const NAME = 'Milbooru';
const URI = 'http://sheslostcontrol.net/moe/shimmie/';
const DESCRIPTION = 'Returns images from given page';
}

View file

@ -2,20 +2,20 @@
class MixCloudBridge extends BridgeAbstract {
const MAINTAINER = "Alexis CHEMEL";
const NAME = "MixCloud";
const URI = "https://mixcloud.com/";
const MAINTAINER = 'Alexis CHEMEL';
const NAME = 'MixCloud';
const URI = 'https://mixcloud.com/';
const CACHE_TIMEOUT = 3600; // 1h
const DESCRIPTION = "Returns latest musics on user stream";
const DESCRIPTION = 'Returns latest musics on user stream';
const PARAMETERS = array(array(
'u' => array(
'name' => 'username',
'required' => true,
)));
)
));
public function getName(){
return 'MixCloud - ' . $this->getInput('u');
}
@ -29,12 +29,14 @@ class MixCloudBridge extends BridgeAbstract {
$item = array();
$item['uri'] = self::URI . $element->find('h3.card-cloudcast-title a', 0)->getAttribute('href');
$item['title'] = html_entity_decode($element->find('h3.card-cloudcast-title a span', 0)->getAttribute('title'), ENT_QUOTES);
$item['title'] = html_entity_decode(
$element->find('h3.card-cloudcast-title a span', 0)->getAttribute('title'),
ENT_QUOTES
);
$image = $element->find('img.image-for-cloudcast', 0);
if($image){
$item['content'] = '<img src="' . $image->getAttribute('src') . '" />';
}

View file

@ -1,10 +1,10 @@
<?php
class MoebooruBridge extends BridgeAbstract {
const NAME = "Moebooru";
const URI = "https://moe.dev.myconan.net/";
const NAME = 'Moebooru';
const URI = 'https://moe.dev.myconan.net/';
const CACHE_TIMEOUT = 1800; // 30min
const DESCRIPTION = "Returns images from given page";
const DESCRIPTION = 'Returns images from given page';
const MAINTAINER = 'pmaziere';
const PARAMETERS = array( array(
@ -13,34 +13,43 @@ class MoebooruBridge extends BridgeAbstract{
'defaultValue' => 1,
'type' => 'number'
),
't'=>array('name'=>'tags')
't' => array(
'name' => 'tags'
)
));
protected function getFullURI(){
return $this->getURI().'post?'
.'page='.$this->getInput('p')
.'&tags='.urlencode($this->getInput('t'));
return $this->getURI()
. 'post?page='
. $this->getInput('p')
. '&tags='
. urlencode($this->getInput('t'));
}
public function collectData(){
$html = getSimpleHTMLDOM($this->getFullURI())
or returnServerError('Could not request ' . $this->getName());
$input_json = explode('Post.register(', $html);
foreach($input_json as $element)
$data[] = preg_replace('/}\)(.*)/', '}', $element);
unset($data[0]);
foreach($data as $datai){
$json = json_decode($datai, TRUE);
$json = json_decode($datai, true);
$item = array();
$item['uri'] = $this->getURI() . '/post/show/' . $json['id'];
$item['postid'] = $json['id'];
$item['timestamp'] = $json['created_at'];
$item['imageUri'] = $json['file_url'];
$item['title'] = $this->getName() . ' | ' . $json['id'];
$item['content'] = '<a href="' . $item['imageUri'] . '"><img src="' . $json['preview_url'] . '" /></a><br>Tags: '.$json['tags'];
$item['content'] = '<a href="'
. $item['imageUri']
. '"><img src="'
. $json['preview_url']
. '" /></a><br>Tags: '
. $json['tags'];
$this->items[] = $item;
}
}

View file

@ -1,11 +1,11 @@
<?php
class MondeDiploBridge extends BridgeAbstract {
const MAINTAINER = "Pitchoule";
const MAINTAINER = 'Pitchoule';
const NAME = 'Monde Diplomatique';
const URI = 'http://www.monde-diplomatique.fr/';
const CACHE_TIMEOUT = 21600; //6h
const DESCRIPTION = "Returns most recent results from MondeDiplo.";
const DESCRIPTION = 'Returns most recent results from MondeDiplo.';
public function collectData(){
$html = getSimpleHTMLDOM(self::URI)
@ -16,7 +16,10 @@ class MondeDiploBridge extends BridgeAbstract{
$item = array();
$item['uri'] = self::URI . $element->href;
$item['title'] = $element->find('h3', 0)->plaintext;
$item['content'] = $element->find('div.dates_auteurs', 0)->plaintext . '<br>' . strstr($element->find('div', 0)->plaintext, $element->find('div.dates_auteurs', 0)->plaintext, true);
$item['content'] = $element->find('div.dates_auteurs', 0)->plaintext
. '<br>'
. strstr($element->find('div', 0)->plaintext, $element->find('div.dates_auteurs', 0)->plaintext, true);
$this->items[] = $item;
}
}

View file

@ -1,30 +1,32 @@
<?php
class MsnMondeBridge extends BridgeAbstract{
class MsnMondeBridge extends BridgeAbstrac {
const MAINTAINER = "kranack";
const MAINTAINER = 'kranack';
const NAME = 'MSN Actu Monde';
const URI = 'http://www.msn.com/';
const DESCRIPTION = "Returns the 10 newest posts from MSN Actualités (full text)";
const DESCRIPTION = 'Returns the 10 newest posts from MSN Actualités (full text)';
public function getURI(){
return self::URI . 'fr-fr/actualite/monde';
}
private function MsnMondeExtractContent($url, &$item) {
private function msnMondeExtractContent($url, &$item){
$html2 = getSimpleHTMLDOM($url);
$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);
}
public function collectData(){
$html = getSimpleHTMLDOM($this->getURI()) or returnServerError('Could not request MsnMonde.');
$html = getSimpleHTMLDOM($this->getURI())
or returnServerError('Could not request MsnMonde.');
$limit = 0;
foreach($html->find('.smalla') as $article){
if($limit < 10){
$item = array();
$item['title'] = utf8_decode($article->find('h4', 0)->innertext);
$item['uri'] = self::URI . utf8_decode($article->find('a', 0)->href);
$this->MsnMondeExtractContent($item['uri'], $item);
$this->msnMondeExtractContent($item['uri'], $item);
$this->items[] = $item;
$limit++;
}

View file

@ -3,10 +3,10 @@ require_once('GelbooruBridge.php');
class MspabooruBridge extends GelbooruBridge {
const MAINTAINER = "mitsukarenai";
const NAME = "Mspabooru";
const URI = "http://mspabooru.com/";
const DESCRIPTION = "Returns images from given page";
const MAINTAINER = 'mitsukarenai';
const NAME = 'Mspabooru';
const URI = 'http://mspabooru.com/';
const DESCRIPTION = 'Returns images from given page';
const PIDBYPAGE = 50;
}

View file

@ -1,19 +1,20 @@
<?php
class NasaApodBridge extends BridgeAbstract {
const MAINTAINER = "corenting";
const NAME = "NASA APOD Bridge";
const URI = "http://apod.nasa.gov/apod/";
const MAINTAINER = 'corenting';
const NAME = 'NASA APOD Bridge';
const URI = 'http://apod.nasa.gov/apod/';
const CACHE_TIMEOUT = 43200; // 12h
const DESCRIPTION = "Returns the 3 latest NASA APOD pictures and explanations";
const DESCRIPTION = 'Returns the 3 latest NASA APOD pictures and explanations';
public function collectData(){
$html = getSimpleHTMLDOM(self::URI.'archivepix.html') or 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);
for($i = 0; $i < 3;$i++)
{
for($i = 0; $i < 3; $i++){
$line = $list[$i];
$item = array();

View file

@ -1,17 +1,19 @@
<?php
class NeuviemeArtBridge extends FeedExpander {
const MAINTAINER = "ORelio";
const MAINTAINER = 'ORelio';
const NAME = '9ème Art Bridge';
const URI = "http://www.9emeart.fr/";
const DESCRIPTION = "Returns the newest articles.";
const URI = 'http://www.9emeart.fr/';
const DESCRIPTION = 'Returns the newest articles.';
private function StripWithDelimiters($string, $start, $end) {
private function stripWithDelimiters($string, $start, $end){
while(strpos($string, $start) !== false){
$section_to_remove = substr($string, strpos($string, $start));
$section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end));
$string = str_replace($section_to_remove, '', $string);
} return $string;
}
return $string;
}
protected function parseItem($item){
@ -39,9 +41,9 @@ class NeuviemeArtBridge extends FeedExpander {
'src="/', 'src="' . self::URI,
$article_html->find('div.newsGenerique_con', 0)->innertext
);
$article_content = $this->StripWithDelimiters($article_content, '<script', '</script>');
$article_content = $this->StripWithDelimiters($article_content, '<style', '</style>');
$article_content = $this->StripWithDelimiters($article_content, '<link', '>');
$article_content = $this->stripWithDelimiters($article_content, '<script', '</script>');
$article_content = $this->stripWithDelimiters($article_content, '<style', '</style>');
$article_content = $this->stripWithDelimiters($article_content, '<link', '>');
$item['content'] = $article_content;

View file

@ -1,10 +1,10 @@
<?php
class NextInpactBridge extends FeedExpander {
const MAINTAINER = "qwertygc";
const NAME = "NextInpact Bridge";
const URI = "http://www.nextinpact.com/";
const DESCRIPTION = "Returns the newest articles.";
const MAINTAINER = 'qwertygc';
const NAME = 'NextInpact Bridge';
const URI = 'http://www.nextinpact.com/';
const DESCRIPTION = 'Returns the newest articles.';
public function collectData(){
$this->collectExpandableDatas(self::URI . 'rss/news.xml', 10);
@ -12,15 +12,20 @@ class NextInpactBridge extends FeedExpander {
protected function parseItem($newsItem){
$item = parent::parseItem($newsItem);
$item['content'] = $this->ExtractContent($item['uri']);
$item['content'] = $this->extractContent($item['uri']);
return $item;
}
private function ExtractContent($url) {
private function extractContent($url){
$html2 = getSimpleHTMLDOMCached($url);
$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>'
.'<div>'.$html2->find('div[itemprop=articleBody]', 0)->innertext.'</div>';
$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><div>'
. $html2->find('div[itemprop=articleBody]', 0)->innertext
. '</div>';
$premium_article = $html2->find('h2.title_reserve_article', 0);
if (is_object($premium_article))
$text = $text . '<p><em>' . $premium_article->innertext . '</em></p>';

View file

@ -43,28 +43,32 @@ class NextgovBridge extends FeedExpander {
}
}
$item['content'] .= $this->ExtractContent($item['uri']);
$item['content'] .= $this->extractContent($item['uri']);
return $item;
}
private function StripWithDelimiters($string, $start, $end) {
private function stripWithDelimiters($string, $start, $end){
while (strpos($string, $start) !== false) {
$section_to_remove = substr($string, strpos($string, $start));
$section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end));
$string = str_replace($section_to_remove, '', $string);
} return $string;
}
private function ExtractContent($url){
return $string;
}
private function extractContent($url){
$article = getSimpleHTMLDOMCached($url)
or returnServerError('Could not request Nextgov: ' . $url);
$contents = $article->find('div.wysiwyg', 0)->innertext;
$contents = $this->StripWithDelimiters($contents, '<div class="ad-container">', '</div>');
$contents = $this->StripWithDelimiters($contents, '<div', '</div>'); //ad outer div
return $this->StripWithDelimiters($contents, '<script', '</script>');
$contents = $this->stripWithDelimiters($contents, '<div class="ad-container">', '</div>');
$contents = $this->stripWithDelimiters($contents, '<div', '</div>'); //ad outer div
return $this->stripWithDelimiters($contents, '<script', '</script>');
$contents = ($article_thumbnail == '' ? '' : '<p><img src="' . $article_thumbnail . '" /></p>')
.'<p><b>'.$article_subtitle.'</b></p>'
. '<p><b>'
. $article_subtitle
. '</b></p>'
. trim($contents);
}
}

View file

@ -1,10 +1,10 @@
<?php
class NiceMatinBridge extends FeedExpander {
const MAINTAINER = "pit-fgfjiudghdf";
const NAME = "NiceMatin";
const URI = "http://www.nicematin.com/";
const DESCRIPTION = "Returns the 10 newest posts from NiceMatin (full text)";
const MAINTAINER = 'pit-fgfjiudghdf';
const NAME = 'NiceMatin';
const URI = 'http://www.nicematin.com/';
const DESCRIPTION = 'Returns the 10 newest posts from NiceMatin (full text)';
public function collectData(){
$this->collectExpandableDatas(self::URI . 'derniere-minute/rss', 10);
@ -12,11 +12,11 @@ class NiceMatinBridge extends FeedExpander {
protected function parseItem($newsItem){
$item = parent::parseItem($newsItem);
$item['content'] = $this->NiceMatinExtractContent($item['uri']);
$item['content'] = $this->extractContent($item['uri']);
return $item;
}
private function NiceMatinExtractContent($url) {
private function extractContent($url){
$html = getSimpleHTMLDOMCached($url);
if(!$html)
return 'Could not acquire content from url: ' . $url . '!';

View file

@ -1,11 +1,11 @@
<?php
class NovelUpdatesBridge extends BridgeAbstract {
const MAINTAINER = "albirew";
const NAME = "Novel Updates";
const URI = "http://www.novelupdates.com/";
const MAINTAINER = 'albirew';
const NAME = 'Novel Updates';
const URI = 'http://www.novelupdates.com/';
const CACHE_TIMEOUT = 21600; // 6h
const DESCRIPTION = "Returns releases from Novel Updates";
const DESCRIPTION = 'Returns releases from Novel Updates';
const PARAMETERS = array( array(
'n' => array(
'name' => 'Novel name as found in the url',
@ -37,11 +37,20 @@ class NovelUpdatesBridge extends BridgeAbstract{
$item['title'] = $element->find('td', 2)->find('a', 0)->plaintext;
$item['team'] = $element->find('td', 1)->innertext;
$item['timestamp'] = strtotime($element->find('td', 0)->plaintext);
$item['content'] =
'<a href="'.$item['uri'].'">'
.$this->seriesTitle.' - '.$item['title']
.'</a> by '.$item['team'].'<br>'
.'<a href="'.$item['uri'].'">'.$fullhtml->find('div.seriesimg', 0)->innertext.'</a>';
$item['content'] = '<a href="'
. $item['uri']
. '">'
. $this->seriesTitle
. ' - '
. $item['title']
. '</a> by '
. $item['team']
. '<br><a href="'
. $item['uri']
. '">'
. $fullhtml->find('div.seriesimg', 0)->innertext
. '</a>';
$this->items[] = $item;
}
}

View file

@ -1,11 +1,11 @@
<?php
class OpenClassroomsBridge extends BridgeAbstract {
const MAINTAINER = "sebsauvage";
const NAME = "OpenClassrooms Bridge";
const URI = "https://openclassrooms.com/";
const MAINTAINER = 'sebsauvage';
const NAME = 'OpenClassrooms Bridge';
const URI = 'https://openclassrooms.com/';
const CACHE_TIMEOUT = 21600; // 6h
const DESCRIPTION = "Returns latest tutorials from OpenClassrooms.";
const DESCRIPTION = 'Returns latest tutorials from OpenClassrooms.';
const PARAMETERS = array( array(
'u' => array(
@ -27,8 +27,7 @@ class OpenClassroomsBridge extends BridgeAbstract{
));
public function getURI(){
return self::URI.'/courses?categories='.$this->getInput('u').'&'
.'title=&sort=updatedAt+desc';
return self::URI . '/courses?categories=' . $this->getInput('u') . '&title=&sort=updatedAt+desc';
}
public function collectData(){

View file

@ -1,12 +1,11 @@
<?php
class ParuVenduImmoBridge extends BridgeAbstract
{
const MAINTAINER = "polo2ro";
const NAME = "Paru Vendu Immobilier";
const URI = "http://www.paruvendu.fr";
const CACHE_TIMEOUT = 10800; // 3h
const DESCRIPTION = "Returns the ads from the first page of search result.";
class ParuVenduImmoBridge extends BridgeAbstract {
const MAINTAINER = 'polo2ro';
const NAME = 'Paru Vendu Immobilier';
const URI = 'http://www.paruvendu.fr';
const CACHE_TIMEOUT = 10800; // 3h
const DESCRIPTION = 'Returns the ads from the first page of search result.';
const PARAMETERS = array( array(
'minarea' => array(
@ -21,11 +20,12 @@ class ParuVenduImmoBridge extends BridgeAbstract
'name' => 'Country code',
'exampleValue' => 'FR'
),
'lo'=>array('name'=>'department numbers or postal codes, comma-separated')
'lo' => array(
'name' => 'department numbers or postal codes, comma-separated'
)
));
public function collectData()
{
public function collectData(){
$html = getSimpleHTMLDOM($this->getURI())
or returnServerError('Could not request paruvendu.');
@ -54,14 +54,16 @@ class ParuVenduImmoBridge extends BridgeAbstract
$item['title'] = $element->title;
$item['content'] = $img . $desc . $price;
$this->items[] = $item;
}
}
public function getURI(){
$appartment = '&tbApp=1&tbDup=1&tbChb=1&tbLof=1&tbAtl=1&tbPla=1';
$maison = '&tbMai=1&tbVil=1&tbCha=1&tbPro=1&tbHot=1&tbMou=1&tbFer=1';
$link = self::URI.'/immobilier/annonceimmofo/liste/listeAnnonces?tt=1'.$appartment.$maison;
$link = self::URI
. '/immobilier/annonceimmofo/liste/listeAnnonces?tt=1'
. $appartment
. $maison;
if($this->getInput('minarea')){
$link .= '&sur0=' . urlencode($this->getInput('minarea'));

View file

@ -1,18 +1,20 @@
<?php
class PickyWallpapersBridge extends BridgeAbstract {
const MAINTAINER = "nel50n";
const NAME = "PickyWallpapers Bridge";
const URI = "http://www.pickywallpapers.com/";
const MAINTAINER = 'nel50n';
const NAME = 'PickyWallpapers Bridge';
const URI = 'http://www.pickywallpapers.com/';
const CACHE_TIMEOUT = 43200; // 12h
const DESCRIPTION = "Returns the latests wallpapers from PickyWallpapers";
const DESCRIPTION = 'Returns the latests wallpapers from PickyWallpapers';
const PARAMETERS = array( array(
'c' => array(
'name' => 'category',
'required' => true
),
's'=>array('name'=>'subcategory'),
's' => array(
'name' => 'subcategory'
),
'm' => array(
'name' => 'Max number of wallpapers',
'defaultValue' => 12,
@ -26,7 +28,6 @@ class PickyWallpapersBridge extends BridgeAbstract {
)
));
public function collectData(){
$lastpage = 1;
$num = 0;
@ -43,12 +44,22 @@ class PickyWallpapersBridge extends BridgeAbstract {
}
foreach($html->find('.items li img') as $element){
$item = array();
$item['uri'] = str_replace('www', 'wallpaper', self::URI).'/'.$resolution.'/'.basename($element->src);
$item['uri'] = str_replace('www', 'wallpaper', self::URI)
. '/'
. $resolution
. '/'
. basename($element->src);
$item['timestamp'] = time();
$item['title'] = $element->alt;
$item['content'] = $item['title'].'<br><a href="'.$item['uri'].'">'.$element.'</a>';
$item['content'] = $item['title']
. '<br><a href="'
. $item['uri']
. '">'
. $element
. '</a>';
$this->items[] = $item;
$num++;
@ -60,14 +71,23 @@ class PickyWallpapersBridge extends BridgeAbstract {
public function getURI(){
$subcategory = $this->getInput('s');
$link = self::URI.$this->getInput('r').'/'.$this->getInput('c').'/'.$subcategory;
$link = self::URI
. $this->getInput('r')
. '/'
. $this->getInput('c')
. '/'
. $subcategory;
return $link;
}
public function getName(){
$subcategory = $this->getInput('s');
return 'PickyWallpapers - '.$this->getInput('c')
return 'PickyWallpapers - '
. $this->getInput('c')
. ($subcategory ? ' > ' . $subcategory : '')
.' ['.$this->getInput('r').']';
. ' ['
. $this->getInput('r')
. ']';
}
}

View file

@ -1,10 +1,10 @@
<?php
class PinterestBridge extends BridgeAbstract {
const MAINTAINER = "pauder";
const NAME = "Pinterest Bridge";
const URI = "http://www.pinterest.com/";
const DESCRIPTION = "Returns the newest images on a board";
const MAINTAINER = 'pauder';
const NAME = 'Pinterest Bridge';
const URI = 'http://www.pinterest.com/';
const DESCRIPTION = 'Returns the newest images on a board';
const PARAMETERS = array(
'By username and board' => array(
@ -63,8 +63,7 @@ class PinterestBridge extends BridgeAbstract {
. htmlentities($item['avatar'])
. '" /> <strong>'
. $item['username']
. '</strong>'
. '<br />'
. '</strong><br />'
. $item['fullname'];
$item['title'] = $img->getAttribute('alt');

View file

@ -1,12 +1,12 @@
<?php
class PlanetLibreBridge extends BridgeAbstract {
const MAINTAINER = "pit-fgfjiudghdf";
const NAME = "PlanetLibre";
const URI = "http://www.planet-libre.org";
const DESCRIPTION = "Returns the 5 newest posts from PlanetLibre (full text)";
const MAINTAINER = 'pit-fgfjiudghdf';
const NAME = 'PlanetLibre';
const URI = 'http://www.planet-libre.org';
const DESCRIPTION = 'Returns the 5 newest posts from PlanetLibre (full text)';
private function PlanetLibreExtractContent($url){
private function extractContent($url){
$html2 = getSimpleHTMLDOM($url);
$text = $html2->find('div[class="post-text"]', 0)->innertext;
return $text;
@ -21,8 +21,15 @@ class PlanetLibreBridge extends BridgeAbstract{
$item = array();
$item['title'] = $element->find('h1', 0)->plaintext;
$item['uri'] = $element->find('a', 0)->href;
$item['timestamp'] = strtotime(str_replace('/', '-', $element->find('div[class="post-date"]', 0)->plaintext));
$item['content'] = $this->PlanetLibreExtractContent($item['uri']);
$item['timestamp'] = strtotime(
str_replace(
'/',
'-',
$element->find('div[class="post-date"]', 0)->plaintext
)
);
$item['content'] = $this->extractContent($item['uri']);
$this->items[] = $item;
$limit++;
}

View file

@ -1,10 +1,10 @@
<?php
class RTBFBridge extends BridgeAbstract {
const NAME = "RTBF Bridge";
const URI = "http://www.rtbf.be/auvio/emissions/";
const NAME = 'RTBF Bridge';
const URI = 'http://www.rtbf.be/auvio/emissions/';
const CACHE_TIMEOUT = 21600; //6h
const DESCRIPTION = "Returns the newest RTBF videos by series ID";
const MAINTAINER = "Frenzie";
const DESCRIPTION = 'Returns the newest RTBF videos by series ID';
const MAINTAINER = 'Frenzie';
const PARAMETERS = array( array(
'c' => array(
@ -26,13 +26,21 @@ class RTBFBridge extends BridgeAbstract {
if($count >= $limit){
break;
}
$item = array();
$item['id'] = $element->getAttribute('data-id');
$item['uri'] = self::URI . 'detail?id=' . $item['id'];
$thumbnailUriSrcSet = explode(',', $element->find('figure .www-img-16by9 img', 0)->getAttribute('data-srcset'));
$thumbnailUriSrcSet = explode(
',',
$element->find('figure .www-img-16by9 img', 0)->getAttribute('data-srcset')
);
$thumbnailUriLastSrc = end($thumbnailUriSrcSet);
$thumbnailUri = explode(' ', $thumbnailUriLastSrc)[0];
$item['title'] = trim($element->find('h3',0)->plaintext) . ' - ' . trim($element->find('h4',0)->plaintext);
$item['title'] = trim($element->find('h3',0)->plaintext)
. ' - '
. trim($element->find('h4',0)->plaintext);
$item['timestamp'] = strtotime($element->find('time', 0)->getAttribute('datetime'));
$item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $thumbnailUri . '" /></a>';
$this->items[] = $item;

View file

@ -1,10 +1,11 @@
<?php
class ReadComicsBridge extends BridgeAbstract {
const MAINTAINER = "niawag";
const NAME = "Read Comics";
const URI = "http://www.readcomics.tv/";
const DESCRIPTION = "Enter the comics as they appear in the website uri, separated by semicolons, ex: good-comic-1;good-comic-2; ...";
const MAINTAINER = 'niawag';
const NAME = 'Read Comics';
const URI = 'http://www.readcomics.tv/';
const DESCRIPTION = 'Enter the comics as they appear in the website uri,
separated by semicolons, ex: good-comic-1;good-comic-2; ...';
const PARAMETERS = array( array(
'q' => array(

View file

@ -1,23 +1,25 @@
<?php
class Releases3DSBridge extends BridgeAbstract {
const MAINTAINER = "ORelio";
const NAME = "3DS Scene Releases";
const URI = "http://www.3dsdb.com/";
const MAINTAINER = 'ORelio';
const NAME = '3DS Scene Releases';
const URI = 'http://www.3dsdb.com/';
const CACHE_TIMEOUT = 10800; // 3h
const DESCRIPTION = "Returns the newest scene releases.";
const DESCRIPTION = 'Returns the newest scene releases.';
public function collectData(){
function ExtractFromDelimiters($string, $start, $end) {
function extractFromDelimiters($string, $start, $end){
if(strpos($string, $start) !== false){
$section_retrieved = substr($string, strpos($string, $start) + strlen($start));
$section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end));
return $section_retrieved;
} return false;
}
function TypeToString($type) {
return false;
}
function typeToString($type){
switch($type){
case 1: return '3DS Game';
case 4: return 'eShop';
@ -25,7 +27,7 @@ class Releases3DSBridge extends BridgeAbstract {
}
}
function CardToString($card) {
function cardToString($card){
switch($card){
case 1: return 'Regular (CARD1)';
case 2: return 'NAND (CARD2)';
@ -34,7 +36,8 @@ class Releases3DSBridge extends BridgeAbstract {
}
$dataUrl = self::URI . 'xml.php';
$xml = getContents($dataUrl) or returnServerError('Could not request 3dsdb: '.$dataUrl);
$xml = getContents($dataUrl)
or returnServerError('Could not request 3dsdb: ' . $dataUrl);
$limit = 0;
foreach(array_reverse(explode('<release>', $xml)) as $element){
@ -46,65 +49,78 @@ class Releases3DSBridge extends BridgeAbstract {
continue;
}
$releasename = ExtractFromDelimiters($element, '<releasename>', '</releasename>');
$releasename = extractFromDelimiters($element, '<releasename>', '</releasename>');
if(empty($releasename)){
continue;
}
$id = ExtractFromDelimiters($element, '<id>', '</id>');
$name = ExtractFromDelimiters($element, '<name>', '</name>');
$publisher = ExtractFromDelimiters($element, '<publisher>', '</publisher>');
$region = ExtractFromDelimiters($element, '<region>', '</region>');
$group = ExtractFromDelimiters($element, '<group>', '</group>');
$imagesize = ExtractFromDelimiters($element, '<imagesize>', '</imagesize>');
$serial = ExtractFromDelimiters($element, '<serial>', '</serial>');
$titleid = ExtractFromDelimiters($element, '<titleid>', '</titleid>');
$imgcrc = ExtractFromDelimiters($element, '<imgcrc>', '</imgcrc>');
$filename = ExtractFromDelimiters($element, '<filename>', '</filename>');
$trimmedsize = ExtractFromDelimiters($element, '<trimmedsize>', '</trimmedsize>');
$firmware = ExtractFromDelimiters($element, '<firmware>', '</firmware>');
$type = ExtractFromDelimiters($element, '<type>', '</type>');
$card = ExtractFromDelimiters($element, '<card>', '</card>');
$id = extractFromDelimiters($element, '<id>', '</id>');
$name = extractFromDelimiters($element, '<name>', '</name>');
$publisher = extractFromDelimiters($element, '<publisher>', '</publisher>');
$region = extractFromDelimiters($element, '<region>', '</region>');
$group = extractFromDelimiters($element, '<group>', '</group>');
$imagesize = extractFromDelimiters($element, '<imagesize>', '</imagesize>');
$serial = extractFromDelimiters($element, '<serial>', '</serial>');
$titleid = extractFromDelimiters($element, '<titleid>', '</titleid>');
$imgcrc = extractFromDelimiters($element, '<imgcrc>', '</imgcrc>');
$filename = extractFromDelimiters($element, '<filename>', '</filename>');
$trimmedsize = extractFromDelimiters($element, '<trimmedsize>', '</trimmedsize>');
$firmware = extractFromDelimiters($element, '<firmware>', '</firmware>');
$type = extractFromDelimiters($element, '<type>', '</type>');
$card = extractFromDelimiters($element, '<card>', '</card>');
//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);
if($ignResult = getSimpleHTMLDOM($ignSearchUrl)){
$ignCoverArt = $ignResult->find('div.search-item-media', 0)->find('img', 0)->src;
$ignDesc = $ignResult->find('div.search-item-description', 0)->plaintext;
$ignLink = $ignResult->find('div.search-item-sub-title', 0)->find('a', 1)->href;
$ignDate = strtotime(trim($ignResult->find('span.publish-date', 0)->plaintext));
$ignDescription = '<div><img src="'.$ignCoverArt.'" /></div><div>'.$ignDesc.' <a href="'.$ignLink.'">More at IGN</a></div>';
$ignDescription = '<div><img src="'
. $ignCoverArt
. '" /></div><div>'
. $ignDesc
. ' <a href="'
. $ignLink
. '">More at IGN</a></div>';
}
//Main section : Release description from 3DS database
$releaseDescription = '<h3>Release Details</h3>'
.'<b>Release ID: </b>'.$id.'<br />'
.'<b>Game Name: </b>'.$name.'<br />'
.'<b>Publisher: </b>'.$publisher.'<br />'
.'<b>Region: </b>'.$region.'<br />'
.'<b>Group: </b>'.$group.'<br />'
.'<b>Image size: </b>'.(intval($imagesize)/8).'MB<br />'
.'<b>Serial: </b>'.$serial.'<br />'
.'<b>Title ID: </b>'.$titleid.'<br />'
.'<b>Image CRC: </b>'.$imgcrc.'<br />'
.'<b>File Name: </b>'.$filename.'<br />'
.'<b>Release Name: </b>'.$releasename.'<br />'
.'<b>Trimmed size: </b>'.intval(intval($trimmedsize)/1048576).'MB<br />'
.'<b>Firmware: </b>'.$firmware.'<br />'
.'<b>Type: </b>'.TypeToString($type).'<br />'
.'<b>Card: </b>'.CardToString($card).'<br />';
$releaseDescription = '<h3>Release Details</h3><b>Release ID: </b>' . $id
. '<br /><b>Game Name: </b>' . $name
. '<br /><b>Publisher: </b>' . $publisher
. '<br /><b>Region: </b>' . $region
. '<br /><b>Group: </b>' . $group
. '<br /><b>Image size: </b>' . (intval($imagesize) / 8)
. 'MB<br /><b>Serial: </b>' . $serial
. '<br /><b>Title ID: </b>' . $titleid
. '<br /><b>Image CRC: </b>' . $imgcrc
. '<br /><b>File Name: </b>' . $filename
. '<br /><b>Release Name: </b>' . $releasename
. '<br /><b>Trimmed size: </b>' . intval(intval($trimmedsize) / 1048576)
. 'MB<br /><b>Firmware: </b>' . $firmware
. '<br /><b>Type: </b>' . typeToString($type)
. '<br /><b>Card: </b>' . cardToString($card)
. '<br />';
//Build search links section to facilitate release search using search engines
$releaseNameEncoded = urlencode(str_replace(' ', '+', $releasename));
$searchLinkGoogle = 'https://google.com/?q=' . $releaseNameEncoded;
$searchLinkDuckDuckGo = 'https://duckduckgo.com/?q=' . $releaseNameEncoded;
$searchLinkQwant = 'https://lite.qwant.com/?q=' . $releaseNameEncoded . '&t=web';
$releaseSearchLinks = '<h3>Search this release</h3><ul>'
.'<li><a href="'.$searchLinkGoogle.'">Search using Google</a></li>'
.'<li><a href="'.$searchLinkDuckDuckGo.'">Search using DuckDuckGo</a></li>'
.'<li><a href="'.$searchLinkQwant.'">Search using Qwant</a></li>'
.'</ul>';
$releaseSearchLinks = '<h3>Search this release</h3><ul><li><a href="'
. $searchLinkGoogle
. '">Search using Google</a></li><li><a href="'
. $searchLinkDuckDuckGo
. '">Search using DuckDuckGo</a></li><li><a href="'
. $searchLinkQwant
. '">Search using Qwant</a></li></ul>';
//Build and add final item with the above three sections
$item = array();

View file

@ -1,12 +1,12 @@
<?php
class ReporterreBridge extends BridgeAbstract {
const MAINTAINER = "nyutag";
const NAME = "Reporterre Bridge";
const URI = "http://www.reporterre.net/";
const DESCRIPTION = "Returns the newest articles.";
const MAINTAINER = 'nyutag';
const NAME = 'Reporterre Bridge';
const URI = 'http://www.reporterre.net/';
const DESCRIPTION = 'Returns the newest articles.';
private function ExtractContentReporterre($url) {
private function extractContent($url){
$html2 = getSimpleHTMLDOM($url);
foreach($html2->find('div[style=text-align:justify]') as $e){
@ -17,14 +17,19 @@ class ReporterreBridge extends BridgeAbstract{
unset($html2);
// Replace all relative urls with absolute ones
$text = preg_replace('/(href|src)(\=[\"\'])(?!http)([^"\']+)/ims', "$1$2" . self::URI . "$3", $text);
$text = preg_replace(
'/(href|src)(\=[\"\'])(?!http)([^"\']+)/ims',
"$1$2" . self::URI . "$3",
$text
);
$text = strip_tags($text, '<p><br><a><img>');
return $text;
}
public function collectData(){
$html = getSimpleHTMLDOM(self::URI.'spip.php?page=backend') or returnServerError('Could not request Reporterre.');
$html = getSimpleHTMLDOM(self::URI . 'spip.php?page=backend')
or returnServerError('Could not request Reporterre.');
$limit = 0;
foreach($html->find('item') as $element){
@ -33,7 +38,7 @@ class ReporterreBridge extends BridgeAbstract{
$item['title'] = html_entity_decode($element->find('title', 0)->plaintext);
$item['timestamp'] = strtotime($element->find('dc:date', 0)->plaintext);
$item['uri'] = $element->find('guid', 0)->innertext;
$item['content'] = html_entity_decode($this->ExtractContentReporterre($item['uri']));
$item['content'] = html_entity_decode($this->extractContent($item['uri']));
$this->items[] = $item;
$limit++;
}

View file

@ -1,15 +1,18 @@
<?php
class Rue89Bridge extends FeedExpander {
const MAINTAINER = "pit-fgfjiudghdf";
const NAME = "Rue89";
const URI = "http://rue89.nouvelobs.com/";
const DESCRIPTION = "Returns the 5 newest posts from Rue89 (full text)";
const MAINTAINER = 'pit-fgfjiudghdf';
const NAME = 'Rue89';
const URI = 'http://rue89.nouvelobs.com/';
const DESCRIPTION = 'Returns the 5 newest posts from Rue89 (full text)';
protected function 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(getContents($url), true);
$item['content'] = $datas['node']['body'];

View file

@ -3,10 +3,10 @@ require_once('GelbooruBridge.php');
class Rule34Bridge extends GelbooruBridge {
const MAINTAINER = "mitsukarenai";
const NAME = "Rule34";
const URI = "http://rule34.xxx/";
const DESCRIPTION = "Returns images from given page";
const MAINTAINER = 'mitsukarenai';
const NAME = 'Rule34';
const URI = 'http://rule34.xxx/';
const DESCRIPTION = 'Returns images from given page';
const PIDBYPAGE = 50;
}

View file

@ -3,8 +3,8 @@ require_once('Shimmie2Bridge.php');
class Rule34pahealBridge extends Shimmie2Bridge {
const MAINTAINER = "mitsukarenai";
const NAME = "Rule34paheal";
const URI = "http://rule34.paheal.net/";
const DESCRIPTION = "Returns images from given page";
const MAINTAINER = 'mitsukarenai';
const NAME = 'Rule34paheal';
const URI = 'http://rule34.paheal.net/';
const DESCRIPTION = 'Returns images from given page';
}

View file

@ -3,10 +3,10 @@ require_once('GelbooruBridge.php');
class SafebooruBridge extends GelbooruBridge {
const MAINTAINER = "mitsukarenai";
const NAME = "Safebooru";
const URI = "http://safebooru.org/";
const DESCRIPTION = "Returns images from given page";
const MAINTAINER = 'mitsukarenai';
const NAME = 'Safebooru';
const URI = 'http://safebooru.org/';
const DESCRIPTION = 'Returns images from given page';
const PIDBYPAGE = 40;
}

View file

@ -3,9 +3,9 @@ require_once('MoebooruBridge.php');
class SakugabooruBridge extends MoebooruBridge {
const MAINTAINER = "mitsukarenai";
const NAME = "Sakugabooru";
const URI = "http://sakuga.yshi.org/";
const DESCRIPTION = "Returns images from given page";
const MAINTAINER = 'mitsukarenai';
const NAME = 'Sakugabooru';
const URI = 'http://sakuga.yshi.org/';
const DESCRIPTION = 'Returns images from given page';
}

View file

@ -1,11 +1,11 @@
<?php
class ScmbBridge extends BridgeAbstract {
const MAINTAINER = "Astalaseven";
const NAME = "Se Coucher Moins Bête Bridge";
const URI = "http://secouchermoinsbete.fr";
const MAINTAINER = 'Astalaseven';
const NAME = 'Se Coucher Moins Bête Bridge';
const URI = 'http://secouchermoinsbete.fr';
const CACHE_TIMEOUT = 21600; // 6h
const DESCRIPTION = "Returns the newest anecdotes.";
const DESCRIPTION = 'Returns the newest anecdotes.';
public function collectData(){
$html = '';
@ -17,9 +17,12 @@ class ScmbBridge extends BridgeAbstract{
$item['uri'] = self::URI . $article->find('p.summary a', 0)->href;
$item['title'] = $article->find('header h1 a', 0)->innertext;
$article->find('span.read-more',0)->outertext=''; // remove text "En savoir plus" from anecdote content
// remove text "En savoir plus" from anecdote content
$article->find('span.read-more', 0)->outertext = '';
$content = $article->find('p.summary a', 0)->innertext;
$content =substr($content,0,strlen($content)-17); // remove superfluous spaces at the end
// remove superfluous spaces at the end
$content = substr($content, 0, strlen($content) - 17);
// get publication date
$str_date = $article->find('time', 0)->datetime;
@ -29,7 +32,6 @@ class ScmbBridge extends BridgeAbstract{
$timestamp = mktime($h, $i, 0, $m, $d, $y);
$item['timestamp'] = $timestamp;
$item['content'] = $content;
$this->items[] = $item;
}

View file

@ -1,11 +1,11 @@
<?php
class ScoopItBridge extends BridgeAbstract {
const MAINTAINER = "Pitchoule";
const NAME = "ScoopIt";
const URI = "http://www.scoop.it/";
const MAINTAINER = 'Pitchoule';
const NAME = 'ScoopIt';
const URI = 'http://www.scoop.it/';
const CACHE_TIMEOUT = 21600; // 6h
const DESCRIPTION = "Returns most recent results from ScoopIt.";
const DESCRIPTION = 'Returns most recent results from ScoopIt.';
const PARAMETERS = array( array(
'u' => array(
@ -24,10 +24,19 @@ class ScoopItBridge extends BridgeAbstract{
foreach($html->find('div.post-view') as $element){
$item = array();
$item['uri'] = $element->find('a', 0)->href;
$item['title'] = preg_replace('~[[:cntrl:]]~', '', $element->find('div.tCustomization_post_title',0)->plaintext);
$item['content'] = preg_replace('~[[:cntrl:]]~', '', $element->find('div.tCustomization_post_description', 0)->plaintext);
$item['title'] = preg_replace(
'~[[:cntrl:]]~',
'',
$element->find('div.tCustomization_post_title',0)->plaintext
);
$item['content'] = preg_replace(
'~[[:cntrl:]]~',
'',
$element->find('div.tCustomization_post_description', 0)->plaintext
);
$this->items[] = $item;
}
}
}

View file

@ -1,11 +1,11 @@
<?php
class SensCritiqueBridge extends BridgeAbstract {
const MAINTAINER = "kranack";
const NAME = "Sens Critique";
const URI = "http://www.senscritique.com/";
const MAINTAINER = 'kranack';
const NAME = 'Sens Critique';
const URI = 'http://www.senscritique.com/';
const CACHE_TIMEOUT = 21600; // 6h
const DESCRIPTION = "Sens Critique news";
const DESCRIPTION = 'Sens Critique news';
const PARAMETERS = array( array(
'm' => array(
@ -40,12 +40,18 @@ class SensCritiqueBridge extends BridgeAbstract {
if($this->getInput($category)){
$uri = self::URI;
switch($category){
case 'm': $uri.='films/cette-semaine'; break;
case 's': $uri.='series/actualite'; break;
case 'g': $uri.='jeuxvideo/actualite'; break;
case 'b': $uri.='livres/actualite'; break;
case 'bd': $uri.='bd/actualite'; break;
case 'mu': $uri.='musique/actualite'; break;
case 'm': $uri .= 'films/cette-semaine';
break;
case 's': $uri .= 'series/actualite';
break;
case 'g': $uri .= 'jeuxvideo/actualite';
break;
case 'b': $uri .= 'livres/actualite';
break;
case 'bd': $uri .= 'bd/actualite';
break;
case 'mu': $uri .= 'musique/actualite';
break;
}
$html = getSimpleHTMLDOM($uri)
or returnServerError('No results for this query.');
@ -63,13 +69,26 @@ class SensCritiqueBridge extends BridgeAbstract {
foreach($list->find('li') as $movie){
$item = array();
$item['author'] = htmlspecialchars_decode($movie->find('.elco-title a', 0)->plaintext, ENT_QUOTES) . ' ' . $movie->find('.elco-date', 0)->plaintext;
$item['title'] = $movie->find('.elco-title a', 0)->plaintext . ' ' . $movie->find('.elco-date', 0)->plaintext;
$item['content'] = '<em>' . $movie->find('.elco-original-title', 0)->plaintext . '</em><br><br>' .
$movie->find('.elco-baseline', 0)->plaintext . '<br>' .
$movie->find('.elco-baseline', 1)->plaintext . '<br><br>' .
$movie->find('.elco-description', 0)->plaintext . '<br><br>' .
trim($movie->find('.erra-ratings .erra-global', 0)->plaintext) . ' / 10';
$item['author'] = htmlspecialchars_decode($movie->find('.elco-title a', 0)->plaintext, ENT_QUOTES)
. ' '
. $movie->find('.elco-date', 0)->plaintext;
$item['title'] = $movie->find('.elco-title a', 0)->plaintext
. ' '
. $movie->find('.elco-date', 0)->plaintext;
$item['content'] = '<em>'
. $movie->find('.elco-original-title', 0)->plaintext
. '</em><br><br>'
. $movie->find('.elco-baseline', 0)->plaintext
. '<br>'
. $movie->find('.elco-baseline', 1)->plaintext
. '<br><br>'
. $movie->find('.elco-description', 0)->plaintext
. '<br><br>'
. trim($movie->find('.erra-ratings .erra-global', 0)->plaintext)
. ' / 10';
$item['id'] = $this->getURI() . $movie->find('.elco-title a', 0)->href;
$item['uri'] = $this->getURI() . $movie->find('.elco-title a', 0)->href;
$this->items[] = $item;

View file

@ -1,17 +1,44 @@
<?php
class SexactuBridge extends BridgeAbstract {
const MAINTAINER = "Riduidel";
const NAME = "Sexactu";
const URI = "https://www.gqmagazine.fr";
const MAINTAINER = 'Riduidel';
const NAME = 'Sexactu';
const URI = 'https://www.gqmagazine.fr';
const CACHE_TIMEOUT = 7200; // 2h
const DESCRIPTION = "Sexactu via rss-bridge";
const DESCRIPTION = 'Sexactu via rss-bridge';
public function collectData(){
$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');
$find = array(
'janvier',
'février',
'mars',
'avril',
'mai',
'juin',
'juillet',
'août',
'septembre',
'novembre',
'décembre'
);
$html = getSimpleHTMLDOM($this->getURI()) or returnServerError('Could not request '.$this->getURI());
$replace = array(
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December'
);
$html = getSimpleHTMLDOM($this->getURI())
or returnServerError('Could not request ' . $this->getURI());
foreach($html->find('.content-holder') as $contentHolder){
// only use first list as second one only contains pages numbers
@ -37,7 +64,7 @@ $replace = array('January', 'February', 'March', 'April', 'May', 'June', 'July',
$date = strtotime($dateText);
$item['timestamp'] = $date;
$item['author'] = "Maïa Mazaurette";
$item['author'] = 'Maïa Mazaurette';
$elementText = $element->find('.text-container', 0);
// don't forget to replace images server url with gq one
foreach($elementText->find('img') as $image){
@ -46,9 +73,7 @@ $replace = array('January', 'February', 'March', 'April', 'May', 'June', 'July',
$item['content'] = $elementText->innertext;
$this->items[] = $item;
}
}
}
}
}
@ -58,17 +83,16 @@ $replace = array('January', 'February', 'March', 'April', 'May', 'June', 'July',
}
private function correctCase($str){
$sentences=explode('.', mb_strtolower($str, "UTF-8"));
$str="";
$sep="";
foreach ($sentences as $sentence)
{
$sentences = explode('.', mb_strtolower($str, 'UTF-8'));
$str = '';
$sep = '';
foreach ($sentences as $sentence){
//upper case first char
$sentence = ucfirst(trim($sentence));
//append sentence to output
$str = $str . $sep . $sentence;
$sep=". ";
$sep = '. ';
}
return $str;
}

View file

@ -6,8 +6,9 @@ class ShanaprojectBridge extends BridgeAbstract {
const DESCRIPTION = 'Returns a list of anime from the current Season Anime List';
// Returns an html object for the Season Anime List (latest season)
private function LoadSeasonAnimeList(){
// First we need to find the URI to the latest season from the 'seasons' page searching for 'Season Anime List'
private function loadSeasonAnimeList(){
// First we need to find the URI to the latest season from the
// 'seasons' page searching for 'Season Anime List'
$html = getSimpleHTMLDOM($this->getURI() . '/seasons');
if(!$html)
returnServerError('Could not load \'seasons\' page!');
@ -18,13 +19,17 @@ class ShanaprojectBridge extends BridgeAbstract {
$html = getSimpleHTMLDOM($this->getURI() . $season->href);
if(!$html)
returnServerError('Could not load \'Season Anime List\' from \'' . $season->innertext . '\'!');
returnServerError(
'Could not load \'Season Anime List\' from \''
. $season->innertext
. '\'!'
);
return $html;
}
// Extracts the anime title
private function ExtractAnimeTitle($anime){
private function extractAnimeTitle($anime){
$title = $anime->find('a', 0);
if(!$title)
returnServerError('Could not find anime title!');
@ -32,7 +37,7 @@ class ShanaprojectBridge extends BridgeAbstract {
}
// Extracts the anime URI
private function ExtractAnimeURI($anime){
private function extractAnimeUri($anime){
$uri = $anime->find('a', 0);
if(!$uri)
returnServerError('Could not find anime URI!');
@ -40,7 +45,7 @@ class ShanaprojectBridge extends BridgeAbstract {
}
// Extracts the anime release date (timestamp)
private function ExtractAnimeTimestamp($anime){
private function extractAnimeTimestamp($anime){
$timestamp = $anime->find('span.header_info_block', 1);
if(!$timestamp)
returnServerError('Could not find anime timestamp!');
@ -48,7 +53,7 @@ class ShanaprojectBridge extends BridgeAbstract {
}
// Extracts the anime studio name (author)
private function ExtractAnimeAuthor($anime){
private function extractAnimeAuthor($anime){
$author = $anime->find('span.header_info_block', 2);
if(!$author)
return; // Sometimes the studio is unknown, so leave empty
@ -56,7 +61,7 @@ class ShanaprojectBridge extends BridgeAbstract {
}
// Extracts the episode information (x of y released)
private function ExtractAnimeEpisodeInformation($anime){
private function extractAnimeEpisodeInformation($anime){
$episode = $anime->find('div.header_info_episode', 0);
if(!$episode)
returnServerError('Could not find anime episode information!');
@ -64,7 +69,7 @@ class ShanaprojectBridge extends BridgeAbstract {
}
// Extracts the background image
private function ExtractAnimeBackgroundImage($anime){
private function extractAnimeBackgroundImage($anime){
// Getting the picture is a little bit tricky as it is part of the style.
// Luckily the style is part of the parent div :)
@ -75,22 +80,31 @@ class ShanaprojectBridge extends BridgeAbstract {
}
// Builds an URI to search for a specific anime (subber is left empty)
private function BuildAnimeSearchURI($anime){
return $this->getURI() . '/search/?title=' . urlencode($this->ExtractAnimeTitle($anime)) . '&subber=';
private function buildAnimeSearchUri($anime){
return $this->getURI()
. '/search/?title='
. urlencode($this->extractAnimeTitle($anime))
. '&subber=';
}
// Builds the content string for a given anime
private function BuildAnimeContent($anime){
private function buildAnimeContent($anime){
// We'll use a template string to place our contents
return '<a href="' . $this->ExtractAnimeURI($anime) . '">
<img src="http://' . $this->ExtractAnimeBackgroundImage($anime) . '" alt="' . htmlspecialchars($this->ExtractAnimeTitle($anime)) . '" style="border: 1px solid black">
</a><br>
<p>' . $this->ExtractAnimeEpisodeInformation($anime) . '</p><br>
<p><a href="' . $this->BuildAnimeSearchURI($anime) . '">Search episodes</a></p>';
return '<a href="'
. $this->extractAnimeUri($anime)
. '"><img src="http://'
. $this->extractAnimeBackgroundImage($anime)
. '" alt="'
. htmlspecialchars($this->extractAnimeTitle($anime))
. '" style="border: 1px solid black"></a><br><p>'
. $this->extractAnimeEpisodeInformation($anime)
. '</p><br><p><a href="'
. $this->buildAnimeSearchUri($anime)
. '">Search episodes</a></p>';
}
public function collectData(){
$html = $this->LoadSeasonAnimeList();
$html = $this->loadSeasonAnimeList();
$animes = $html->find('div.header_display_box_info');
if(!$animes)
@ -98,11 +112,11 @@ class ShanaprojectBridge extends BridgeAbstract {
foreach($animes as $anime){
$item = array();
$item['title'] = $this->ExtractAnimeTitle($anime);
$item['author'] = $this->ExtractAnimeAuthor($anime);
$item['uri'] = $this->ExtractAnimeURI($anime);
$item['timestamp'] = $this->ExtractAnimeTimestamp($anime);
$item['content'] = $this->BuildAnimeContent($anime);
$item['title'] = $this->extractAnimeTitle($anime);
$item['author'] = $this->extractAnimeAuthor($anime);
$item['uri'] = $this->extractAnimeUri($anime);
$item['timestamp'] = $this->extractAnimeTimestamp($anime);
$item['content'] = $this->buildAnimeContent($anime);
$this->items[] = $item;
}
}

View file

@ -3,16 +3,18 @@ require_once('DanbooruBridge.php');
class Shimmie2Bridge extends DanbooruBridge {
const NAME = "Shimmie v2";
const URI = "http://shimmie.shishnet.org/v2/";
const DESCRIPTION = "Returns images from given page";
const NAME = 'Shimmie v2';
const URI = 'http://shimmie.shishnet.org/v2/';
const DESCRIPTION = 'Returns images from given page';
const PATHTODATA = '.shm-thumb-link';
const IDATTRIBUTE = 'data-post-id';
protected function getFullURI(){
return $this->getURI().'post/list/'
.$this->getInput('t').'/'
return $this->getURI()
. 'post/list/'
. $this->getInput('t')
. '/'
. $this->getInput('p');
}
@ -24,7 +26,13 @@ class Shimmie2Bridge extends DanbooruBridge{
$thumbnailUri = $this->getURI() . $element->find('img', 0)->src;
$item['tags'] = $element->getAttribute('data-tags');
$item['title'] = $this->getName() . ' | ' . $item['id'];
$item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item['tags'];
$item['content'] = '<a href="'
. $item['uri']
. '"><img src="'
. $thumbnailUri
. '" /></a><br>Tags: '
. $item['tags'];
return $item;
}

View file

@ -1,11 +1,11 @@
<?php
class SoundCloudBridge extends BridgeAbstract {
const MAINTAINER = "kranack";
const NAME = "Soundcloud Bridge";
const URI = "https://soundcloud.com/";
const MAINTAINER = 'kranack';
const NAME = 'Soundcloud Bridge';
const URI = 'https://soundcloud.com/';
const CACHE_TIMEOUT = 600; // 10min
const DESCRIPTION = "Returns 10 newest music from user profile";
const DESCRIPTION = 'Returns 10 newest music from user profile';
const PARAMETERS = array( array(
'u' => array(
@ -21,24 +21,34 @@ class SoundCloudBridge extends BridgeAbstract{
$res = json_decode(getContents(
'https://api.soundcloud.com/resolve?url=http://www.soundcloud.com/'
. urlencode($this->getInput('u'))
.'&client_id=' . self::CLIENT_ID
. '&client_id='
. self::CLIENT_ID
)) or returnServerError('No results for this query');
$tracks = json_decode(getContents(
'https://api.soundcloud.com/users/'
. urlencode($res->id)
.'/tracks?client_id=' . self::CLIENT_ID
. '/tracks?client_id='
. self::CLIENT_ID
)) or returnServerError('No results for this user');
for($i = 0; $i < 10; $i++){
$item = array();
$item['author'] = $tracks[$i]->user->username . ' - ' . $tracks[$i]->title;
$item['title'] = $tracks[$i]->user->username . ' - ' . $tracks[$i]->title;
$item['content'] = '<audio src="'. $tracks[$i]->uri .'/stream?client_id='. self::CLIENT_ID .'">';
$item['content'] = '<audio src="'
. $tracks[$i]->uri
. '/stream?client_id='
. self::CLIENT_ID
. '">';
$item['id'] = self::URI
. urlencode($this->getInput('u')) .'/'
. urlencode($this->getInput('u'))
. '/'
. urlencode($tracks[$i]->permalink);
$item['uri'] = self::URI
. urlencode($this->getInput('u')) .'/'
. urlencode($this->getInput('u'))
. '/'
. urlencode($tracks[$i]->permalink);
$this->items[] = $item;
}

View file

@ -10,7 +10,6 @@ class StripeAPIChangeLogBridge extends BridgeAbstract{
$html = getSimpleHTMLDOM(self::URI)
or returnServerError('No results for Stripe API Changelog');
foreach($html->find('h3') as $change){
$item = array();
$item['title'] = trim($change->plaintext);

View file

@ -1,11 +1,11 @@
<?php
class SuperbWallpapersBridge extends BridgeAbstract {
const MAINTAINER = "nel50n";
const NAME = "Superb Wallpapers Bridge";
const URI = "http://www.superbwallpapers.com/";
const MAINTAINER = 'nel50n';
const NAME = 'Superb Wallpapers Bridge';
const URI = 'http://www.superbwallpapers.com/';
const CACHE_TIMEOUT = 43200; // 12h
const DESCRIPTION = "Returns the latests wallpapers from SuperbWallpapers";
const DESCRIPTION = 'Returns the latests wallpapers from SuperbWallpapers';
const PARAMETERS = array( array(
'c' => array(

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