Add extra bridges, first batch (So feed, Many RSS)

This commit is contained in:
Mitsukarenai 2014-05-26 00:30:46 +02:00
parent 96b9476d5a
commit 3b558e1c2a
34 changed files with 1911 additions and 0 deletions

52
bridges/AcrimedBridge.php Normal file
View file

@ -0,0 +1,52 @@
<?php
/**
* 2014-05-25
* @name Acrimed Bridge
* @homepage http://www.acrimed.org/
* @description Returns the newest articles.
* @maintainer qwertygc
*/
class AcrimedBridge extends BridgeAbstract{
public function collectData(array $param){
function StripCDATA($string) {
$string = str_replace('<![CDATA[', '', $string);
$string = str_replace(']]>', '', $string);
return $string;
}
function ExtractContent($url) {
$html2 = file_get_html($url);
$text = $html2->find('div.texte', 0)->innertext;
return $text;
}
$html = file_get_html('http://www.acrimed.org/spip.php?page=backend') or $this->returnError('Could not request Acrimed.', 404);
$limit = 0;
foreach($html->find('item') as $element) {
if($limit < 10) {
$item = new \Item();
$item->title = StripCDATA($element->find('title', 0)->innertext);
$item->uri = StripCDATA($element->find('guid', 0)->plaintext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = ExtractContent($item->uri);
$this->items[] = $item;
$limit++;
}
}
}
public function getName(){
return 'Acrimed Bridge';
}
public function getURI(){
return 'http://acrimed.org/';
}
public function getCacheDuration(){
return 3600*2; // 2 hours
// return 0; // 2 hours
}
}

View file

@ -0,0 +1,55 @@
<?php
/**
*
* @name Allo Cine : Faux Raccord
* @homepage http://www.allocine.fr/video/programme-12284/saison-22907/
* @description Allo Cine : Faux Raccord
* @update 07/11/2013
* initial maintainer: superbaillot.net
*/
class AllocineFRBridge extends BridgeAbstract{
private $_URL = "http://www.allocine.fr/video/programme-12284/saison-22907/";
private $_NOM = "Faux Raccord";
public function collectData(array $param){
$html = file_get_html($this->_URL) or $this->returnError('Could not request Allo cine.', 404);
foreach($html->find('figure.media-meta-fig') as $element)
{
$item = new Item();
$titre = $element->find('div.titlebar h3.title a', 0);
$content = trim($element->innertext);
$figCaption = strpos($content, $this->_NOM);
if($figCaption !== false)
{
$content = str_replace('src="/', 'src="http://www.allocine.fr/',$content);
$content = str_replace('href="/', 'href="http://www.allocine.fr/',$content);
$content = str_replace('src=\'/', 'src=\'http://www.allocine.fr/',$content);
$content = str_replace('href=\'/', 'href=\'http://www.allocine.fr/',$content);
$item->content = $content;
$item->title = trim($titre->innertext);
$item->uri = "http://www.allocine.fr" . $titre->href;
$this->items[] = $item;
}
}
}
public function getName(){
return 'Allo Cine : ' . $this->_NOM;
}
public function getURI(){
return $this->_URL;
}
public function getCacheDuration(){
return 25200; // 7 hours
}
public function getDescription(){
return "Allo Cine : " . $this->_NOM . " via rss-bridge";
}
}
?>

View file

@ -0,0 +1,55 @@
<?php
/**
*
* @name Allo Cine : Top 5
* @homepage http://www.allocine.fr/video/programme-12299/saison-22542/
* @description Allo Cine : Top 5 via rss-bridge
* @update 07/11/2013
* initial maintainer: superbaillot.net
*/
class AllocineT5Bridge extends BridgeAbstract{
private $_URL = "http://www.allocine.fr/video/programme-12299/saison-22542/";
private $_NOM = "Top 5";
public function collectData(array $param){
$html = file_get_html($this->_URL) or $this->returnError('Could not request Allo cine.', 404);
foreach($html->find('figure.media-meta-fig') as $element)
{
$item = new Item();
$titre = $element->find('div.titlebar h3.title a', 0);
$content = trim($element->innertext);
$figCaption = strpos($content, $this->_NOM);
if($figCaption !== false)
{
$content = str_replace('src="/', 'src="http://www.allocine.fr/',$content);
$content = str_replace('href="/', 'href="http://www.allocine.fr/',$content);
$content = str_replace('src=\'/', 'src=\'http://www.allocine.fr/',$content);
$content = str_replace('href=\'/', 'href=\'http://www.allocine.fr/',$content);
$item->content = $content;
$item->title = trim($titre->innertext);
$item->uri = "http://www.allocine.fr" . $titre->href;
$this->items[] = $item;
}
}
}
public function getName(){
return 'Allo Cine : ' . $this->_NOM;
}
public function getURI(){
return $this->_URL;
}
public function getCacheDuration(){
return 25200; // 7 hours
}
public function getDescription(){
return "Allo Cine : " . $this->_NOM . " via rss-bridge";
}
}
?>

View file

@ -0,0 +1,55 @@
<?php
/**
*
* @name Allo Cine : Tueurs En Serie
* @homepage http://www.allocine.fr/video/programme-12286/saison-22938/
* @description Allo Cine : Tueurs En Serie
* @update 12/11/2013
* initial maintainer: superbaillot.net
*/
class AllocineTueursEnSerieBridge extends BridgeAbstract{
private $_URL = "http://www.allocine.fr/video/programme-12286/saison-22938/";
private $_NOM = "Tueurs en Séries";
public function collectData(array $param){
$html = file_get_html($this->_URL) or $this->returnError('Could not request Allo cine.', 404);
foreach($html->find('figure.media-meta-fig') as $element)
{
$item = new Item();
$titre = $element->find('div.titlebar h3.title a', 0);
$content = trim($element->innertext);
$figCaption = strpos($content, $this->_NOM);
if($figCaption !== false)
{
$content = str_replace('src="/', 'src="http://www.allocine.fr/',$content);
$content = str_replace('href="/', 'href="http://www.allocine.fr/',$content);
$content = str_replace('src=\'/', 'src=\'http://www.allocine.fr/',$content);
$content = str_replace('href=\'/', 'href=\'http://www.allocine.fr/',$content);
$item->content = $content;
$item->title = trim($titre->innertext);
$item->uri = "http://www.allocine.fr" . $titre->href;
$this->items[] = $item;
}
}
}
public function getName(){
return 'Allo Cine : ' . $this->_NOM;
}
public function getURI(){
return $this->_URL;
}
public function getCacheDuration(){
return 25200; // 7 hours
}
public function getDescription(){
return "Allo Cine : " . $this->_NOM . " via rss-bridge";
}
}
?>

78
bridges/Arte7deBridge.php Normal file
View file

@ -0,0 +1,78 @@
<?php
/**
* RssBridgeArte7de
* Returns images from given page and tags
* 2014-05-25
*
* @name Arte +7 DE
* @homepage http://www.arte.tv/guide/de/
* @description Returns newest videos from ARTE +7 (german)
* @maintainer mitsukarenai
*/
class Arte7deBridge extends BridgeAbstract{
public function collectData(array $param){
$input_json = json_decode(file_get_contents('http://www.arte.tv/guide/de/plus7.json'), TRUE) or $this->returnError('Could not request ARTE.', 404);
foreach($input_json['videos'] as $element) {
$item = new \Item();
$item->uri = 'http://www.arte.tv'.$element['url'];
$item->postid = $item->uri;
$date = $element['airdate_long'];
$date = explode(' ', $date);
$day = (int)$date['1'];
$month=FALSE;
switch ($date['2']) {
case 'Januar':
$month=1;break;
case 'Februar':
$month=2;break;
case 'März':
$month=3;break;
case 'April':
$month=4;break;
case 'Mai':
$month=5;break;
case 'Juni':
$month=6;break;
case 'Juli':
$month=7;break;
case 'August':
$month=8;break;
case 'September':
$month=9;break;
case 'Oktober':
$month=10;break;
case 'November':
$month=11;break;
case 'Dezember':
$month=12;break;
}
$year=(int)date('Y');
$heure=explode(':', $date['4']);
$hour=(int)$heure['0'];
$minute=(int)$heure['1'];
$item->timestamp = mktime($hour, $minute, 0, $month, $day, $year);
$item->thumbnailUri = $element['image_url'];
$item->title = $element['title'];
$item->content = $element['desc'].'<br><br>'.$element['video_channels'].', '.$element['duration'].'min<br><img src="' . $item->thumbnailUri . '" />';
$this->items[] = $item;
}
}
public function getName(){
return 'Arte7de';
}
public function getURI(){
return 'http://www.arte.tv/';
}
public function getCacheDuration(){
return 1800; // 30 minutes
}
}

78
bridges/Arte7frBridge.php Normal file
View file

@ -0,0 +1,78 @@
<?php
/**
* RssBridgeArte7fr
* Returns images from given page and tags
* 2014-05-25
*
* @name Arte +7 FR
* @homepage http://www.arte.tv/guide/fr/
* @description Returns newest videos from ARTE +7 (french)
* @maintainer mitsukarenai
*/
class Arte7frBridge extends BridgeAbstract{
public function collectData(array $param){
$input_json = json_decode(file_get_contents('http://www.arte.tv/guide/fr/plus7.json'), TRUE) or $this->returnError('Could not request ARTE.', 404);
foreach($input_json['videos'] as $element) {
$item = new \Item();
$item->uri = 'http://www.arte.tv'.$element['url'];
$item->postid = $item->uri;
$date = $element['airdate_long'];
$date = explode(' ', $date);
$day = (int)$date['1'];
$month=FALSE;
switch ($date['2']) {
case 'janvier':
$month=1;break;
case 'février':
$month=2;break;
case 'mars':
$month=3;break;
case 'avril':
$month=4;break;
case 'mai':
$month=5;break;
case 'juin':
$month=6;break;
case 'juillet':
$month=7;break;
case 'août':
$month=8;break;
case 'septembre':
$month=9;break;
case 'octobre':
$month=10;break;
case 'novembre':
$month=11;break;
case 'décembre':
$month=12;break;
}
$year=(int)date('Y');
$heure=explode('h', $date['4']);
$hour=(int)$heure['0'];
$minute=(int)$heure['1'];
$item->timestamp = mktime($hour, $minute, 0, $month, $day, $year);
$item->thumbnailUri = $element['image_url'];
$item->title = $element['title'];
$item->content = $element['desc'].'<br><br>'.$element['video_channels'].', '.$element['duration'].'min<br><img src="' . $item->thumbnailUri . '" />';
$this->items[] = $item;
}
}
public function getName(){
return 'Arte7fr';
}
public function getURI(){
return 'http://www.arte.tv/';
}
public function getCacheDuration(){
return 1800; // 30 minutes
}
}

51
bridges/BastaBridge.php Normal file
View file

@ -0,0 +1,51 @@
<?php
/**
* RssBridgeBastabag
* Returns the newest articles
* 2014-05-25
*
* @name Bastamag Bridge
* @homepage http://www.bastamag.net/
* @description Returns the newest articles.
* @maintainer qwertygc
*/
class BastaBridge extends BridgeAbstract{
public function collectData(array $param){
function BastaExtractContent($url) {
$html2 = file_get_html($url);
$text = $html2->find('div.texte', 0)->innertext;
return $text;
}
$html = file_get_html('http://www.bastamag.net/spip.php?page=backend') or $this->returnError('Could not request Bastamag.', 404);
$limit = 0;
foreach($html->find('item') as $element) {
if($limit < 10) {
$item = new \Item();
$item->title = $element->find('title', 0)->innertext;
$item->uri = $element->find('guid', 0)->plaintext;
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = BastaExtractContent($item->uri);
$this->items[] = $item;
$limit++;
}
}
}
public function getName(){
return 'Bastamag Bridge';
}
public function getURI(){
return 'http://bastamag.net/';
}
public function getCacheDuration(){
return 3600*2; // 2 hours
// return 0; // 2 hours
}
}

View file

@ -0,0 +1,48 @@
<?php
/**
*
* @name Blagues De Merde
* @homepage http://www.blaguesdemerde.fr/
* @description Blagues De Merde
* @update 16/10/2013
* initial maintainer: superbaillot.net
*/
class BlaguesDeMerdeBridge extends BridgeAbstract{
public function collectData(array $param){
$html = file_get_html('http://www.blaguesdemerde.fr/') or $this->returnError('Could not request BDM.', 404);
foreach($html->find('article.joke_contener') as $element) {
$item = new Item();
$temp = $element->find('a');
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;
$time = mktime(0, 0, 0, substr($date, 3, 2), substr($date, 0, 2), substr($date, 6, 4));
$item->timestamp = $time;
$item->name = $element->find("li.bdm_pseudo",0)->innertext;;
$this->items[] = $item;
}
}
}
public function getName(){
return 'blaguesdemerde';
}
public function getURI(){
return 'http://www.blaguesdemerde.fr/';
}
public function getCacheDuration(){
return 7200; // 2h hours
}
public function getDescription(){
return "Blagues De Merde via rss-bridge";
}
}
?>

View file

@ -0,0 +1,55 @@
<?php
/**
* RssBridgeBooruproject
* Returns images from given page
* 2014-05-25
*
* @name Booruproject
* @homepage http://booru.org/
* @description Returns images from given page and booruproject instance (****.booru.org)
* @maintainer mitsukarenai
* @use1(i="instance (required)", p="page", t="tags")
*/
class BooruprojectBridge extends BridgeAbstract{
public function collectData(array $param){
$page = 0; $tags = '';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
$page = $page - 1;
$page = $page * 20;
}
if (isset($param['t'])) {
$tags = '&tags='.urlencode($param['t']);
}
if (empty($param['i'])) {
$this->returnError('Please enter a ***.booru.org instance.', 404);
}
$html = file_get_html("http://".$param['i'].".booru.org/index.php?page=post&s=list&pid=".$page.$tags) or $this->returnError('Could not request Booruproject.', 404);
foreach($html->find('div[class=content] span') as $element) {
$item = new \Item();
$item->uri = 'http://'.$param['i'].'.booru.org/'.$element->find('a', 0)->href;
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->find('a', 0)->getAttribute('id'));
$item->timestamp = time();
$item->thumbnailUri = $element->find('img', 0)->src;
$item->tags = $element->find('img', 0)->getAttribute('title');
$item->title = 'Booruproject '.$param['i'].' | '.$item->postid;
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$item->tags;
$this->items[] = $item;
}
}
public function getName(){
return 'Booruproject';
}
public function getURI(){
return 'http://booru.org/';
}
public function getCacheDuration(){
return 1800; // 30 minutes
}
}

View file

@ -0,0 +1,59 @@
<?php
/**
*
* @name CopieDouble
* @homepage http://www.copie-double.com/
* @description CopieDouble
* @update 12/12/2013
* initial maintainer: superbaillot.net
*/
class CopieDoubleBridge extends BridgeAbstract{
public function collectData(array $param){
$html = file_get_html('http://www.copie-double.com/') or $this->returnError('Could not request CopieDouble.', 404);
$table = $html->find('table table', 2);
foreach($table->find('tr') as $element)
{
$td = $element->find('td', 0);
$cpt++;
if($td->class == "couleur_1")
{
$item = new Item();
$title = $td->innertext;
$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);
$item->uri = "http://www.copie-double.com" . $a->href;
$content = str_replace('src="/', 'src="http://www.copie-double.com/',$element->find("td", 0)->innertext);
$content = str_replace('href="/', 'href="http://www.copie-double.com/',$content);
$item->content = $content;
$this->items[] = $item;
}
}
}
public function getName(){
return 'CopieDouble';
}
public function getURI(){
return 'http://www.copie-double.com';
}
public function getDescription(){
return 'CopieDouble via rss-bridge';
}
public function getCacheDuration(){
return 14400; // 4 hours
}
}
?>

View file

@ -0,0 +1,48 @@
<?php
/**
* RssBridgeDanbooru
* Returns images from given page
* 2014-05-25
*
* @name Danbooru
* @homepage http://donmai.us/
* @description Returns images from given page
* @maintainer mitsukarenai
* @use1(p="page", t="tags")
*/
class DanbooruBridge extends BridgeAbstract{
public function collectData(array $param){
$page = 1;$tags='';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
}
$html = file_get_html("http://donmai.us/posts?&page=$page&tags=$tags") or $this->returnError('Could not request Danbooru.', 404);
foreach($html->find('div[id=posts] article') as $element) {
$item = new \Item();
$item->uri = 'http://donmai.us'.$element->find('a', 0)->href;
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('data-id'));
$item->timestamp = time();
$item->thumbnailUri = 'http://donmai.us'.$element->find('img', 0)->src;
$item->tags = $element->find('img', 0)->getAttribute('alt');
$item->title = 'Danbooru | '.$item->postid;
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$item->tags;
$this->items[] = $item;
}
}
public function getName(){
return 'Danbooru';
}
public function getURI(){
return 'http://donmai.us/';
}
public function getCacheDuration(){
return 1800; // 30 minutes
}
}

45
bridges/DilbertBridge.php Normal file
View file

@ -0,0 +1,45 @@
<?php
/**
*
* @name Dilbert Daily Strip
* @homepage http://dilbert.com/strips/
* @description The Unofficial Dilbert Daily Comic Strip
* @update 16/10/2013
* initial maintainer: superbaillot.net
*/
class DilbertBridge extends BridgeAbstract{
public function collectData(array $param){
$html = file_get_html('http://dilbert.com/strips/') or $this->returnError('Could not request Dilbert.', 404);
foreach($html->find('div.STR_Image') as $element) {
$item = new Item();
$href = $element->find('a',0)->href;
$item->uri = 'http://dilbert.com' . $href;
$content = str_replace('src="/', 'src="http://dilbert.com/',$element->innertext);
$content = str_replace('href="/', 'href="http://dilbert.com/',$content);
$item->content = $content;
$time = strtotime(substr($href, (strrpos($href, "/", -10) + 1), 10));
$item->title = date("d/m/Y", $time);
$item->timestamp = $time;
$this->items[] = $item;
}
}
public function getName(){
return 'Dilbert';
}
public function getURI(){
return 'http://dilbert.com';
}
public function getDescription(){
return 'Dilbert via rss-bridge';
}
public function getCacheDuration(){
return 14400; // 4 hours
}
}
?>

View file

@ -0,0 +1,50 @@
<?php
/**
* RssBridgeDollbooru
* Returns images from given page
* 2014-05-25
*
* @name Dollbooru
* @homepage http://dollbooru.org/
* @description Returns images from given page
* @maintainer mitsukarenai
* @use1(p="page", t="tags")
*/
class DollbooruBridge extends BridgeAbstract{
public function collectData(array $param){
$page = 0;$tags='';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
}
$html = file_get_html("http://dollbooru.org/post/list/$tags/$page") or $this->returnError('Could not request Dollbooru.', 404);
foreach($html->find('div[class=shm-image-list] center[class=shm-thumb]') as $element) {
$item = new \Item();
$item->uri = 'http://dollbooru.org'.$element->find('a', 0)->href;
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('data-post-id'));
$item->timestamp = time();
$item->thumbnailUri = 'http://dollbooru.org'.$element->find('img', 0)->getAttribute('data-original');
$item->tags = $element->getAttribute('data-tags');
$item->title = 'Dollbooru | '.$item->postid;
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$item->tags;
$this->items[] = $item;
}
}
public function getName(){
return 'Dollbooru';
}
public function getURI(){
return 'http://dollbooru.org/';
}
public function getCacheDuration(){
return 1800; // 30 minutes
}
}

58
bridges/FootitoBridge.php Normal file
View file

@ -0,0 +1,58 @@
<?php
/**
*
* @name Footito
* @homepage http://www.footito.fr/
* @description Footito
* @update 21/11/2013
* initial maintainer: superbaillot.net
*/
class FootitoBridge extends BridgeAbstract{
public function collectData(array $param){
$html = file_get_html('http://www.footito.fr/') or $this->returnError('Could not request Footito.', 404);
foreach($html->find('div.post') as $element) {
$item = new Item();
$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 );
$item->content = $content;
$title = $element->find('.contenu .texte ', 0)->plaintext;
$item->title = $title;
$info = $element->find('div.infos', 0);
$item->timestamp = strtotime($info->find('time', 0)->datetime);
$item->name = $info->find('a.auteur', 0)->plaintext;
$this->items[] = $item;
}
}
public function getName(){
return 'footito';
}
public function getURI(){
return 'http://www.footito.fr/';
}
public function getCacheDuration(){
return 3600; // 1h hours
}
public function getDescription(){
return "Footito via rss-bridge";
}
}
?>

View file

@ -0,0 +1,52 @@
<?php
/**
* RssBridgeGelbooru
* Returns images from given page
* 2014-05-25
*
* @name Gelbooru
* @homepage http://gelbooru.com/
* @description Returns images from given page
* @maintainer mitsukarenai
* @use1(p="page", t="tags")
*/
class GelbooruBridge extends BridgeAbstract{
public function collectData(array $param){
$page = 0;
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
$page = $page - 1;
$page = $page * 63;
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
}
$html = file_get_html("http://gelbooru.com/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnError('Could not request Gelbooru.', 404);
foreach($html->find('div[class=content] span') as $element) {
$item = new \Item();
$item->uri = 'http://gelbooru.com/'.$element->find('a', 0)->href;
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
$item->timestamp = time();
$item->thumbnailUri = $element->find('img', 0)->src;
$item->tags = $element->find('img', 0)->getAttribute('alt');
$item->title = 'Gelbooru | '.$item->postid;
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$item->tags;
$this->items[] = $item;
}
}
public function getName(){
return 'Gelbooru';
}
public function getURI(){
return 'http://gelbooru.com/';
}
public function getCacheDuration(){
return 1800; // 30 minutes
}
}

View file

@ -0,0 +1,54 @@
<?php
/**
* RssBridgeKonachan
* Returns images from given page
* 2014-05-25
*
* @name Konachan
* @homepage http://konachan.com/
* @description Returns images from given page
* @maintainer mitsukarenai
* @use1(p="page",t="tags")
*/
class KonachanBridge extends BridgeAbstract{
public function collectData(array $param){
$page = 1;$tags='';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
}
$html = file_get_html("http://konachan.com/post?page=$page&tags=$tags") or $this->returnError('Could not request Konachan.', 404);
$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);
$item = new \Item();
$item->uri = 'http://konachan.com/post/show/'.$json['id'];
$item->postid = $json['id'];
$item->timestamp = $json['created_at'];
$item->imageUri = $json['file_url'];
$item->thumbnailUri = $json['preview_url'];
$item->title = 'Konachan | '.$json['id'];
$item->content = '<a href="' . $item->imageUri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$json['tags'];
$this->items[] = $item;
}
}
public function getName(){
return 'Konachan';
}
public function getURI(){
return 'http://konachan.com/post';
}
public function getCacheDuration(){
return 1800; // 30 minutes
}
}

View file

@ -0,0 +1,58 @@
<?php
/**
*
* @name Les Joies Du Code
* @homepage http://lesjoiesducode.fr/
* @description LesJoiesDuCode
* @update 30/01/2014
* initial maintainer: superbaillot.net
*/
class LesJoiesDuCodeBridge extends BridgeAbstract{
public function collectData(array $param){
$html = file_get_html('http://lesjoiesducode.fr/') or $this->returnError('Could not request LesJoiesDuCode.', 404);
foreach($html->find('div.post') as $element) {
$item = new Item();
$temp = $element->find('h3 a', 0);
$titre = $temp->innertext;
$url = $temp->href;
$temp = $element->find('div.bodytype', 0);
$content = $temp->innertext;
$auteur = $temp->find('.c1 em', 0);
$pos = strpos($auteur->innertext, "by");
if($pos > 0)
{
$auteur = trim(str_replace("*/", "", substr($auteur->innertext, ($pos + 2))));
$item->name = $auteur;
}
$item->content .= trim($content);
$item->uri = $url;
$item->title = trim($titre);
$this->items[] = $item;
}
}
public function getName(){
return 'Les Joies Du Code';
}
public function getURI(){
return 'http://lesjoiesducode.fr/';
}
public function getCacheDuration(){
return 7200; // 2h hours
}
public function getDescription(){
return "Les Joies Du Code via rss-bridge";
}
}
?>

42
bridges/MalikiBridge.php Normal file
View file

@ -0,0 +1,42 @@
<?php
/**
* RssBridgeMaliki
* Returns Maliki's strips from previous weeks
* 2014-05-25
*
* @name Maliki
* @homepage http://www.maliki.com/
* @description Returns Maliki's strips from previous weeks
* @maintainer mitsukarenai
*/
class MalikiBridge extends BridgeAbstract{
public function collectData(array $param){
$html = file_get_html('http://www.maliki.com/') or $this->returnError('Could not request Maliki.', 404);
$count=0;
foreach($html->find('div.boite_strip') as $element) {
if(!empty($element->find('a',0)->href) and $count < 20) {
$item = new \Item();
$item->uri = 'http://www.maliki.com/'.$element->find('a',0)->href;
$item->thumbnailUri = 'http://www.maliki.com/'.$element->find('img',0)->src;
$item->title = $element->find('img',0)->title;
$item->timestamp = strtotime(str_replace('/', '-', $element->find('span.stylepetit', 0)->innertext));
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a>';
$this->items[] = $item;
$count++;
}
}
}
public function getName(){
return 'Maliki';
}
public function getURI(){
return 'http://www.maliki.com/';
}
public function getCacheDuration(){
return 86400; // 24 hours
}
}

View file

@ -0,0 +1,50 @@
<?php
/**
* RssBridgeMilbooru
* Returns images from given page
* 2014-05-25
*
* @name Milbooru
* @homepage http://sheslostcontrol.net/moe/shimmie/
* @description Returns images from given page
* @maintainer mitsukarenai
* @use1(p="page",t="tags")
*/
class MilbooruBridge extends BridgeAbstract{
public function collectData(array $param){
$page = 0;$tags='';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
}
$html = file_get_html("http://sheslostcontrol.net/moe/shimmie/index.php?q=/post/list/$tags/$page") or $this->returnError('Could not request Milbooru.', 404);
foreach($html->find('div[class=shm-image-list] span[class=thumb]') as $element) {
$item = new \Item();
$item->uri = 'http://sheslostcontrol.net/moe/shimmie/'.$element->find('a', 0)->href;
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->find('a', 0)->getAttribute('data-post-id'));
$item->timestamp = time();
$item->thumbnailUri = 'http://sheslostcontrol.net/moe/shimmie/'.$element->find('img', 0)->src;
$item->tags = $element->find('a', 0)->getAttribute('data-tags');
$item->title = 'Milbooru | '.$item->postid;
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$item->tags;
$this->items[] = $item;
}
}
public function getName(){
return 'Milbooru';
}
public function getURI(){
return 'http://sheslostcontrol.net/moe/shimmie/';
}
public function getCacheDuration(){
return 1800; // 30 minutes
}
}

View file

@ -0,0 +1,52 @@
<?php
/**
* RssBridgeMspabooru
* Returns images from given page
* 2014-05-25
*
* @name Mspabooru
* @homepage http://mspabooru.com/
* @description Returns images from given page
* @maintainer mitsukarenai
* @use1(p="page",t="tags")
*/
class MspabooruBridge extends BridgeAbstract{
public function collectData(array $param){
$page = 0;$tags='';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
$page = $page - 1;
$page = $page * 50;
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
}
$html = file_get_html("http://mspabooru.com/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnError('Could not request Mspabooru.', 404);
foreach($html->find('div[class=content] span') as $element) {
$item = new \Item();
$item->uri = 'http://mspabooru.com/'.$element->find('a', 0)->href;
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
$item->timestamp = time();
$item->thumbnailUri = $element->find('img', 0)->src;
$item->tags = $element->find('img', 0)->getAttribute('alt');
$item->title = 'Mspabooru | '.$item->postid;
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$item->tags;
$this->items[] = $item;
}
}
public function getName(){
return 'Mspabooru';
}
public function getURI(){
return 'http://mspabooru.com/';
}
public function getCacheDuration(){
return 1800; // 30 minutes
}
}

View file

@ -0,0 +1,55 @@
<?php
/**
* RssBridgeNextinpact
* Returns the newest articles
* 2014-05-25
*
* @name Nextinpact Bridge
* @homepage http://www.nextinpact.com/
* @description Returns the newest articles.
* @maintainer qwertygc
*/
class NextInpactBridge extends BridgeAbstract{
public function collectData(array $param){
function StripCDATA($string) {
$string = str_replace('<![CDATA[', '', $string);
$string = str_replace(']]>', '', $string);
return $string;
}
function ExtractContent($url) {
$html2 = file_get_html($url);
$text = $html2->find('div[itemprop=articleBody]', 0)->innertext;
return $text;
}
$html = file_get_html('http://www.nextinpact.com/rss/news.xml') or $this->returnError('Could not request Nextinpact.', 404);
$limit = 0;
foreach($html->find('item') as $element) {
if($limit < 3) {
$item = new \Item();
$item->title = StripCDATA($element->find('title', 0)->innertext);
$item->uri = StripCDATA($element->find('guid', 0)->plaintext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = ExtractContent($item->uri);
$this->items[] = $item;
$limit++;
}
}
}
public function getName(){
return 'Nextinpact Bridge';
}
public function getURI(){
return 'http://www.nextinpact.com/';
}
public function getCacheDuration(){
return 3600; // 1 hour
// return 0;
}
}

View file

@ -0,0 +1,56 @@
<?php
/**
* RssBridgeNumerama
* Returns the 5 newest posts from http://www.numerama.com (full text)
* 2014-05-25
*
* @name Numerama
* @homepage http://www.numerama.com/
* @description Returns the 5 newest posts from Numerama (full text)
* @maintainer mitsukarenai
*/
class NumeramaBridge extends BridgeAbstract{
public function collectData(array $param){
function NumeramaStripCDATA($string) {
$string = str_replace('<![CDATA[', '', $string);
$string = str_replace(']]>', '', $string);
return $string;
}
function NumeramaExtractContent($url) {
$html2 = file_get_html($url);
$text = $html2->find('h2.intro', 0)->innertext;
$text = $text.$html2->find('div.content', 0)->innertext;
$text = preg_replace('/<script .*>/i','',$text); //Supression des balises script apparentes
return $text;
}
$html = file_get_html('http://www.numerama.com/rss/news.rss') or $this->returnError('Could not request Numerama.', 404);
$limit = 0;
foreach($html->find('item') as $element) {
if($limit < 5) {
$item = new \Item();
$item->title = NumeramaStripCDATA($element->find('title', 0)->innertext);
$item->uri = NumeramaStripCDATA($element->find('guid', 0)->plaintext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = NumeramaExtractContent($item->uri);
$this->items[] = $item;
$limit++;
}
}
}
public function getName(){
return 'Numerama';
}
public function getURI(){
return 'http://www.numerama.com/';
}
public function getCacheDuration(){
return 1800; // 30min
}
}

52
bridges/Rule34Bridge.php Normal file
View file

@ -0,0 +1,52 @@
<?php
/**
* RssBridgeRule34
* Returns images from given page
* 2014-05-25
*
* @name Rule34
* @homepage http://rule34.xxx/
* @description Returns images from given page
* @maintainer mitsukarenai
* @use1(p="page",t="tags")
*/
class Rule34Bridge extends BridgeAbstract{
public function collectData(array $param){
$page = 0;$tags='';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
$page = $page - 1;
$page = $page * 50;
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
}
$html = file_get_html("http://rule34.xxx/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnError('Could not request Rule34.', 404);
foreach($html->find('div[class=content] span') as $element) {
$item = new \Item();
$item->uri = 'http://rule34.xxx/'.$element->find('a', 0)->href;
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
$item->timestamp = time();
$item->thumbnailUri = $element->find('img', 0)->src;
$item->tags = $element->find('img', 0)->getAttribute('alt');
$item->title = 'Rule34 | '.$item->postid;
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$item->tags;
$this->items[] = $item;
}
}
public function getName(){
return 'Rule34';
}
public function getURI(){
return 'http://rule34.xxx/';
}
public function getCacheDuration(){
return 1800; // 30 minutes
}
}

View file

@ -0,0 +1,50 @@
<?php
/**
* RssBridgeRule34paheal
* Returns images from given page
* 2014-05-25
*
* @name Rule34paheal
* @homepage http://rule34.paheal.net/
* @description Returns images from given page
* @maintainer mitsukarenai
* @use1(p="page",t='tags")
*/
class Rule34pahealBridge extends BridgeAbstract{
public function collectData(array $param){
$page = 0;$tags='';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
}
$html = file_get_html("http://rule34.paheal.net/post/list/$tags/$page") or $this->returnError('Could not request Rule34paheal.', 404);
foreach($html->find('div[class=shm-image-list] div[class=shm-thumb]') as $element) {
$item = new \Item();
$item->uri = 'http://rule34.paheal.net'.$element->find('a', 0)->href;
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->find('img', 0)->getAttribute('id'));
$item->timestamp = time();
$item->thumbnailUri = $element->find('img', 0)->src;
$item->tags = $element->getAttribute('data-tags');
$item->title = 'Rule34paheal | '.$item->postid;
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$item->tags;
$this->items[] = $item;
}
}
public function getName(){
return 'Rule34paheal';
}
public function getURI(){
return 'http://rule34.paheal.net/';
}
public function getCacheDuration(){
return 1800; // 30 minutes
}
}

View file

@ -0,0 +1,52 @@
<?php
/**
* RssBridgeSafebooru
* Returns images from given page
* 2014-05-25
*
* @name Safebooru
* @homepage http://safebooru.org/
* @description Returns images from given page
* @maintainer mitsukarenai
* @use1(p="page",t="tags")
*/
class SafebooruBridge extends BridgeAbstract{
public function collectData(array $param){
$page = 0;$tags='';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
$page = $page - 1;
$page = $page * 40;
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
}
$html = file_get_html("http://safebooru.org/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnError('Could not request Safebooru.', 404);
foreach($html->find('div[class=content] span') as $element) {
$item = new \Item();
$item->uri = 'http://safebooru.org/'.$element->find('a', 0)->href;
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
$item->timestamp = time();
$item->thumbnailUri = $element->find('img', 0)->src;
$item->tags = $element->find('img', 0)->getAttribute('alt');
$item->title = 'Safebooru | '.$item->postid;
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$item->tags;
$this->items[] = $item;
}
}
public function getName(){
return 'Safebooru';
}
public function getURI(){
return 'http://safebooru.org/';
}
public function getCacheDuration(){
return 1800; // 30 minutes
}
}

View file

@ -0,0 +1,54 @@
<?php
/**
* RssBridgeSakugabooru
* Returns images from given page
* 2014-05-25
*
* @name Sakugabooru
* @homepage http://sakuga.yshi.org/
* @description Returns images from given page
* @maintainer mitsukarenai
* @use1(p="page",t="tags")
*/
class SakugabooruBridge extends BridgeAbstract{
public function collectData(array $param){
$page = 1;$tags='';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
}
$html = file_get_html("http://sakuga.yshi.org/post?page=$page&tags=$tags") or $this->returnError('Could not request Sakugabooru.', 404);
$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);
$item = new \Item();
$item->uri = 'http://sakuga.yshi.org/post/show/'.$json['id'];
$item->postid = $json['id'];
$item->timestamp = $json['created_at'];
$item->imageUri = $json['file_url'];
$item->thumbnailUri = $json['preview_url'];
$item->title = 'Sakugabooru | '.$json['id'];
$item->content = '<a href="' . $item->imageUri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$json['tags'];
$this->items[] = $item;
}
}
public function getName(){
return 'Sakugabooru';
}
public function getURI(){
return 'http://sakuga.yshi.org/post';
}
public function getCacheDuration(){
return 1800; // 30 minutes
}
}

54
bridges/ScilogsBridge.php Normal file
View file

@ -0,0 +1,54 @@
<?php
/**
* RssBridgeScilogs
* Returns the newest articles
* 2014-05-25
*
* @name Scilogs Bridge
* @homepage http://www.scilogs.fr/
* @description Returns the newest articles.
* @maintainer qwertygc
*/
class ScilogsBridge extends BridgeAbstract{
public function collectData(array $param){
function ScilogsStripCDATA($string) {
$string = str_replace('<![CDATA[', '', $string);
$string = str_replace(']]>', '', $string);
return $string;
}
function ScilogsExtractContent($url) {
$html2 = file_get_html($url);
$text = $html2->find('div.entrybody', 0)->innertext;
return $text;
}
$html = file_get_html('http://www.scilogs.fr/?wpmu-feed=posts') or $this->returnError('Could not request Scilogs.', 404);
$limit = 0;
foreach($html->find('item') as $element) {
if($limit < 10) {
$item = new \Item();
$item->title = ScilogsStripCDATA($element->find('title', 0)->innertext);
$item->uri = ScilogsStripCDATA($element->find('guid', 0)->plaintext);
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
$item->content = ScilogsExtractContent($item->uri);
$this->items[] = $item;
$limit++;
}
}
}
public function getName(){
return 'Scilogs Bridge';
}
public function getURI(){
return 'http://scilogs.fr/';
}
public function getCacheDuration(){
return 3600*2; // 2 hours
}
}

52
bridges/TbibBridge.php Normal file
View file

@ -0,0 +1,52 @@
<?php
/**
* RssBridgeTbib
* Returns images from given page
* 2014-05-25
*
* @name Tbib
* @homepage http://tbib.org/
* @description Returns images from given page
* @maintainer mitsukarenai
* @use1(p="page",t="tags")
*/
class TbibBridge extends BridgeAbstract{
public function collectData(array $param){
$page = 0;$tags='';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
$page = $page - 1;
$page = $page * 50;
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
}
$html = file_get_html("http://tbib.org/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnError('Could not request Tbib.', 404);
foreach($html->find('div[class=content] span') as $element) {
$item = new \Item();
$item->uri = 'http://tbib.org/'.$element->find('a', 0)->href;
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
$item->timestamp = time();
$item->thumbnailUri = $element->find('img', 0)->src;
$item->tags = $element->find('img', 0)->getAttribute('alt');
$item->title = 'Tbib | '.$item->postid;
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$item->tags;
$this->items[] = $item;
}
}
public function getName(){
return 'Tbib';
}
public function getURI(){
return 'http://tbib.org/';
}
public function getCacheDuration(){
return 1800; // 30 minutes
}
}

View file

@ -0,0 +1,58 @@
<?php
/**
*
* @name The Coding Love
* @homepage http://thecodinglove.com/
* @description The Coding Love
* @update 30/01/2014
* initial maintainer: superbaillot.net
*/
class TheCodingLoveBridge extends BridgeAbstract{
public function collectData(array $param){
$html = file_get_html('http://thecodinglove.com/') or $this->returnError('Could not request The Coding Love.', 404);
foreach($html->find('div.post') as $element) {
$item = new Item();
$temp = $element->find('h3 a', 0);
$titre = $temp->innertext;
$url = $temp->href;
$temp = $element->find('div.bodytype', 0);
$content = $temp->innertext;
$auteur = $temp->find('.c1 em', 0);
$pos = strpos($auteur->innertext, "by");
if($pos > 0)
{
$auteur = trim(str_replace("*/", "", substr($auteur->innertext, ($pos + 2))));
$item->name = $auteur;
}
$item->content .= trim($content);
$item->uri = $url;
$item->title = trim($titre);
$this->items[] = $item;
}
}
public function getName(){
return 'The Coding Love';
}
public function getURI(){
return 'http://thecodinglove.com/';
}
public function getCacheDuration(){
return 7200; // 2h hours
}
public function getDescription(){
return "The Coding Love via rss-bridge";
}
}
?>

View file

@ -0,0 +1,95 @@
<?php
/**
*
* @name Tuxboard
* @homepage http://www.tuxboard.com/
* @description Tuxboard
* @update 15/01/2014
* initial maintainer: superbaillot.net
*/
class TuxboardBridge extends BridgeAbstract{
public function collectData(array $param){
$html = file_get_html('http://www.tuxboard.com') or $this->returnError('Could not request Tuxboard.', 404);
foreach($html->find('div.posts') as $element) {
$a = $element->find("h2 a", 0);
$category = $element->find("div#category", 0);
$catTxt = $category->innertext;
$posFinDate = strpos(" -", $catTxt);
$list = explode(" ", trim(substr($catTxt, $posFinDate)));
$jour = $list[0];
$mois = 1;
$annee = $list[2];
switch (strtolower($list[1]))
{
case "janvier" :
$mois = 1;
break;
case "février" :
case "fevrier" :
$mois = 2;
break;
case "mars" :
$mois = 3;
break;
case "avril" :
$mois = 4;
break;
case "mai" :
$mois = 5;
break;
case "juin" :
$mois = 6;
break;
case "juillet" :
$mois = 7;
break;
case "aout" :
case "août" :
$mois = 8;
break;
case "septembre" :
$mois = 9;
break;
case "octobre" :
$mois = 10;
break;
case "novembre" :
$mois = 11;
break;
case "decembre" :
case "décembre" :
$mois = 12;
break;
}
$item = new Item();
$item->uri = $a->href;
$item->title = $a->innertext;
$item->content = trim($element->find("div.clear", 0)->innertext);
$item->timestamp = mktime(0, 0, 0, $mois, $jour, $annee);
$this->items[] = $item;
}
}
public function getName(){
return 'Tuxboard';
}
public function getURI(){
return 'http://www.tuxboard.com';
}
public function getDescription(){
return 'Tuxboard via rss-bridge';
}
public function getCacheDuration(){
return 14600; // 4 hours
}
}
?>

View file

@ -0,0 +1,78 @@
<?php
/**
* RssBridgeTwitter
* Based on https://github.com/mitsukarenai/twitterbridge-noapi
* 2014-05-25
*
* @name Twitter Bridge Extended
* @homepage https://twitter.com/
* @description (same as Twitter Bridge, but with avatar, replies and RTs)
* @maintainer mitsukarenai
* @use1(q="keyword or hashtag")
* @use2(u="username")
*/
class TwitterBridgeExtended extends BridgeAbstract{
public function collectData(array $param){
$html = '';
if (isset($param['q'])) { /* keyword search mode */
$html = file_get_html('http://twitter.com/search/realtime?q='.urlencode($param['q']).'+include:retweets&src=typd') or $this->returnError('No results for this query.', 404);
}
elseif (isset($param['u'])) { /* user timeline mode */
$html = file_get_html('http://twitter.com/'.urlencode($param['u']).'/with_replies') or $this->returnError('Requested username can\'t be found.', 404);
}
else {
$this->returnError('You must specify a keyword (?q=...) or a Twitter username (?u=...).', 400);
}
foreach($html->find('div.js-stream-tweet') as $tweet) {
$item = new \Item();
// extract username and sanitize
$item->username = $tweet->getAttribute('data-screen-name');
// extract fullname (pseudonym)
$item->fullname = $tweet->getAttribute('data-name');
// get avatar link
$item->avatar = $tweet->find('img', 0)->src;
// get TweetID
$item->id = $tweet->getAttribute('data-tweet-id');
// get tweet link
$item->uri = 'https://twitter.com'.$tweet->find('a.js-permalink', 0)->getAttribute('href');
// extract tweet timestamp
$item->timestamp = $tweet->find('span.js-short-timestamp', 0)->getAttribute('data-time');
// extract plaintext
$item->content_simple = str_replace('href="/', 'href="https://twitter.com/', html_entity_decode(strip_tags($tweet->find('p.js-tweet-text', 0)->innertext, '<a>')));
// processing content links
foreach($tweet->find('a') as $link) {
if($link->hasAttribute('data-expanded-url') ) {
$link->href = $link->getAttribute('data-expanded-url');
}
$link->removeAttribute('data-expanded-url');
$link->removeAttribute('data-query-source');
$link->removeAttribute('rel');
$link->removeAttribute('class');
$link->removeAttribute('target');
$link->removeAttribute('title');
}
// get tweet text
$item->content = '<a href="https://twitter.com/'.$item->username.'"><img align="top" alt="avatar" src="'.$item->avatar.'" />'.$item->username.'</a> '.$item->fullname.'<br/><blockquote>'.str_replace('href="/', 'href="https://twitter.com/', $tweet->find('p.js-tweet-text', 0)->innertext).'</blockquote>';
// generate the title
$item->title = $item->fullname . ' (@'. $item->username . ') | ' . $item->content_simple;
// put out
$this->items[] = $item;
}
}
public function getName(){
return 'Twitter Bridge Extended';
}
public function getURI(){
return 'http://twitter.com';
}
public function getCacheDuration(){
return 300; // 5 minutes
}
}

View file

@ -0,0 +1,54 @@
<?php
/**
* RssBridgeWakkuWakku
* Returns images from given page
* 2014-05-25
*
* @name WakkuWakku
* @homepage http://wakku.to/
* @description Returns images from given page
* @maintainer mitsukarenai
* @use1(p="page",t="tags")
*/
class WakkuWakkuBridge extends BridgeAbstract{
public function collectData(array $param){
$page = 1;$tags='';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
}
$html = file_get_html("http://wakku.to/post?page=$page&tags=$tags") or $this->returnError('Could not request WakkuWakku.', 404);
$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);
$item = new \Item();
$item->uri = 'http://wakku.to/post/show/'.$json['id'];
$item->postid = $json['id'];
$item->timestamp = strtotime($json['created_at']);
$item->imageUri = 'http://wakku.to/'.$json['file_url'];
$item->thumbnailUri = 'http://wakku.to/'.$json['preview_url'];
$item->title = 'WakkuWakku | '.$json['id'];
$item->content = '<a href="' . $item->imageUri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$json['tags'];
if(isset($json['id']) and !empty($json['id'])) $this->items[] = $item;
}
}
public function getName(){
return 'WakkuWakku';
}
public function getURI(){
return 'http://wakku.to/';
}
public function getCacheDuration(){
return 1800; // 30 minutes
}
}

52
bridges/XbooruBridge.php Normal file
View file

@ -0,0 +1,52 @@
<?php
/**
* RssBridgeXbooru
* Returns images from given page
* 2014-05-25
*
* @name Xbooru
* @homepage http://xbooru.com/
* @description Returns images from given page
* @maintainer mitsukarenai
* @use1(p="page",t="tags")
*/
class XbooruBridge extends BridgeAbstract{
public function collectData(array $param){
$page = 0;$tags='';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
$page = $page - 1;
$page = $page * 50;
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
}
$html = file_get_html("http://xbooru.com/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnError('Could not request Xbooru.', 404);
foreach($html->find('div[class=content] span') as $element) {
$item = new \Item();
$item->uri = 'http://xbooru.com/'.$element->find('a', 0)->href;
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
$item->timestamp = time();
$item->thumbnailUri = $element->find('img', 0)->src;
$item->tags = $element->find('img', 0)->getAttribute('alt');
$item->title = 'Xbooru | '.$item->postid;
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$item->tags;
$this->items[] = $item;
}
}
public function getName(){
return 'Xbooru';
}
public function getURI(){
return 'http://xbooru.com/';
}
public function getCacheDuration(){
return 1800; // 30 minutes
}
}

54
bridges/YandereBridge.php Normal file
View file

@ -0,0 +1,54 @@
<?php
/**
* RssBridgeYandere
* Returns images from given page and tags
* 2014-05-25
*
* @name Yande.re
* @homepage https://yande.re/
* @description Returns images from given page and tags
* @maintainer mitsukarenai
* @use1(p="page", t="tags")
*/
class YandereBridge extends BridgeAbstract{
public function collectData(array $param){
$page = 1; $tags = '';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
}
$html = file_get_html("https://yande.re/post?page=$page&tags=$tags") or $this->returnError('Could not request Yandere.', 404);
$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);
$item = new \Item();
$item->uri = 'http://yande.re/post/show/'.$json['id'];
$item->postid = $json['id'];
$item->timestamp = $json['created_at'];
$item->imageUri = $json['file_url'];
$item->thumbnailUri = $json['preview_url'];
$item->title = 'Yandere | '.$json['id'];
$item->content = '<a href="' . $item->imageUri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$json['tags'];
$this->items[] = $item;
}
}
public function getName(){
return 'Yande.re';
}
public function getURI(){
return 'http://yande.re/post';
}
public function getCacheDuration(){
return 1800; // 30 minutes
}
}