1
0
Fork 0
forked from blallo/rss-bridge
This commit is contained in:
logmanoriginal 2016-09-01 19:13:26 +02:00
commit 85a025a82b
38 changed files with 472 additions and 554 deletions

View file

@ -10,6 +10,7 @@ class OpenClassroomsBridge extends BridgeAbstract{
'u'=>array(
'name'=>'Catégorie',
'type'=>'list',
'required'=>true,
'values'=>array(
'Arts & Culture'=>'arts',
'Code'=>'code',
@ -24,21 +25,18 @@ class OpenClassroomsBridge extends BridgeAbstract{
)
));
public function collectData(){
if (empty($this->getInput('u')))
{
$this->returnServerError('Error: You must chose a category.');
public function getURI(){
return $this->uri.'/courses?categories='.$this->getInput('u').'&'
.'title=&sort=updatedAt+desc';
}
$html = '';
$link = 'https://openclassrooms.com/courses?categories='.$this->getInput('u').'&title=&sort=updatedAt+desc';
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request OpenClassrooms.');
public function collectData(){
$html = $this->getSimpleHTMLDOM($this->getURI())
or $this->returnServerError('Could not request OpenClassrooms.');
foreach($html->find('.courseListItem') as $element) {
$item = array();
$item['uri'] = 'https://openclassrooms.com'.$element->find('a', 0)->href;
$item['uri'] = $this->uri.$element->find('a', 0)->href;
$item['title'] = $element->find('h3', 0)->plaintext;
$item['content'] = $element->find('slidingItem__descriptionContent', 0)->plaintext;
$this->items[] = $item;

View file

@ -25,30 +25,8 @@ class ParuVenduImmoBridge extends BridgeAbstract
public function collectData()
{
$html = '';
$num = 20;
$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 = $this->uri.'/immobilier/annonceimmofo/liste/listeAnnonces?tt=1'.$appartment.$maison;
if ($this->getInput('minarea')) {
$link .= '&sur0='.urlencode($this->getInput('minarea'));
}
if ($this->getInput('maxprice')) {
$link .= '&px1='.urlencode($this->getInput('maxprice'));
}
if ($this->getInput('pa')) {
$link .= '&pa='.urlencode($this->getInput('pa'));
}
if ($this->getInput('lo')) {
$link .= '&lo='.urlencode($this->getInput('lo'));
}
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request paruvendu.');
$html = $this->getSimpleHTMLDOM($this->getURI())
or $this->returnServerError('Could not request paruvendu.');
foreach($html->find('div.annonce a') as $element) {
@ -79,16 +57,38 @@ class ParuVenduImmoBridge extends BridgeAbstract
}
}
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 = $this->uri.'/immobilier/annonceimmofo/liste/listeAnnonces?tt=1'.$appartment.$maison;
if ($this->getInput('minarea')) {
$link .= '&sur0='.urlencode($this->getInput('minarea'));
}
if ($this->getInput('maxprice')) {
$link .= '&px1='.urlencode($this->getInput('maxprice'));
}
if ($this->getInput('pa')) {
$link .= '&pa='.urlencode($this->getInput('pa'));
}
if ($this->getInput('lo')) {
$link .= '&lo='.urlencode($this->getInput('lo'));
}
return $link;
}
public function getName(){
$request='';
if($this->getInput('minarea') &&
!empty($this->getInput('minarea'))
){
$request .= ' '.$this->getInput('minarea').' m2';
$minarea=$this->getInput('minarea');
if(!empty($minarea)){
$request .= ' '.$minarea.' m2';
}
if($this->getInput('lo') &&
!empty($this->getInput('lo'))){
$request .= ' In: '.$this->getInput('lo');
$location=$this->getInput('lo');
if(!empty($location)){
$request .= ' In: '.$location;
}
return 'Paru Vendu Immobilier'.$request;
}

View file

@ -1,48 +1,40 @@
<?php
class PickyWallpapersBridge extends BridgeAbstract {
private $category;
private $subcategory;
private $resolution;
public $maintainer = "nel50n";
public $name = "PickyWallpapers Bridge";
public $uri = "http://www.pickywallpapers.com/";
public $description = "Returns the latests wallpapers from PickyWallpapers";
public $parameters = array( array(
'c'=>array('name'=>'category'),
'c'=>array(
'name'=>'category',
'required'=>true
),
's'=>array('name'=>'subcategory'),
'm'=>array(
'name'=>'Max number of wallpapers',
'defaultValue'=>12,
'type'=>'number'
),
'r'=>array(
'name'=>'resolution',
'exampleValue'=>'1920x1200, 1680x1050,…',
'defaultValue'=>'1920x1200',
'pattern'=>'[0-9]{3,4}x[0-9]{3,4}'
)
));
public function collectData(){
$html = '';
if (!$this->getInput('c')) {
$this->returnClientError('You must specify at least a category (?c=...).');
} else {
$baseUri = 'http://www.pickywallpapers.com';
$this->category = $this->getInput('c');
$this->subcategory = $this->getInput('s') ?: '';
$this->resolution = $this->getInput('r') ?: '1920x1200'; // Wide wallpaper default
$num = 0;
$max = $this->getInput('m') ?: 12;
$lastpage = 1;
$num = 0;
$max = $this->getInput('m');
$resolution = $this->getInput('r'); // Wide wallpaper default
for ($page = 1; $page <= $lastpage; $page++) {
$link = $baseUri.'/'.$this->resolution.'/'.$this->category.'/'.(!empty($this->subcategory)?$this->subcategory.'/':'').'page-'.$page.'/';
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('No results for this query.');
$html = $this->getSimpleHTMLDOM($this->getURI().'/page-'.$page.'/')
or $this->returnServerError('No results for this query.');
if ($page === 1) {
preg_match('/page-(\d+)\/$/', $html->find('.pages li a', -2)->href, $matches);
@ -52,7 +44,7 @@ class PickyWallpapersBridge extends BridgeAbstract {
foreach($html->find('.items li img') as $element) {
$item = array();
$item['uri'] = str_replace('www', 'wallpaper', $baseUri).'/'.$this->resolution.'/'.basename($element->src);
$item['uri'] = str_replace('www', 'wallpaper', $this->uri).'/'.$resolution.'/'.basename($element->src);
$item['timestamp'] = time();
$item['title'] = $element->alt;
$item['content'] = $item['title'].'<br><a href="'.$item['uri'].'">'.$element.'</a>';
@ -64,10 +56,18 @@ class PickyWallpapersBridge extends BridgeAbstract {
}
}
}
public function getURI(){
$subcategory = $this->getInput('s');
$link = $this->uri.$this->getInput('r').'/'.$this->getInput('c').'/'.$subcategory;
return $link;
}
public function getName(){
return 'PickyWallpapers - '.$this->category.(!empty($this->subcategory) ? ' > '.$this->subcategory : '').' ['.$this->resolution.']';
$subcategory = $this->getInput('s');
return 'PickyWallpapers - '.$this->getInput('c')
.($subcategory? ' > '.$subcategory : '')
.' ['.$this->getInput('r').']';
}
public function getCacheDuration(){

View file

@ -1,54 +1,42 @@
<?php
class PinterestBridge extends BridgeAbstract{
private $username;
private $board;
private $query;
public $maintainer = "pauder";
public $name = "Pinterest Bridge";
public $uri = "http://www.pinterest.com";
public $uri = "http://www.pinterest.com/";
public $description = "Returns the newest images on a board";
public $parameters = array(
'By username and board' => array(
'u'=>array('name'=>'username'),
'b'=>array('name'=>'board')
'u'=>array(
'name'=>'username',
'required'=>true
),
'b'=>array(
'name'=>'board',
'required'=>true
)
),
'From search' => array(
'q'=>array('name'=>'Keyword')
'q'=>array(
'name'=>'Keyword',
'required'=>true
)
)
);
public function collectData(){
$html = '';
if ($this->getInput('u') || $this->getInput('b')) {
if (empty($this->getInput('u')))
{
$this->returnClientError('You must specify a Pinterest username (?u=...).');
$html = $this->getSimpleHTMLDOM($this->getURI()) ;
if(!$html){
switch($this->queriedContext){
case 'By username and board':
$this->returnServerError('Username and/or board not found');
case 'From search':
$this->returnServerError('Could not request Pinterest.');
}
if (empty($this->getInput('b')))
{
$this->returnClientError('You must specify a Pinterest board for this username (?b=...).');
}
$this->username = $this->getInput('u');
$this->board = $this->getInput('b');
$html = $this->getSimpleHTMLDOM($this->getURI().'/'.urlencode($this->username).'/'.urlencode($this->board)) or $this->returnServerError('Username and/or board not found');
} else if ($this->getInput('q'))
{
$this->query = $this->getInput('q');
$html = $this->getSimpleHTMLDOM($this->getURI().'/search/?q='.urlencode($this->query)) or $this->returnServerError('Could not request Pinterest.');
}
else {
$this->returnClientError('You must specify a Pinterest username and a board name (?u=...&b=...).');
}
foreach($html->find('div.pinWrapper') as $div)
{
$a = $div->find('a.pinImageWrapper',0);
@ -60,7 +48,7 @@ class PinterestBridge extends BridgeAbstract{
$item['content'] = '<img src="' . htmlentities(str_replace('/236x/', '/736x/', $img->getAttribute('src'))) . '" alt="" />';
if (isset($this->query))
if ($this->queriedContext==='From search')
{
$avatar = $div->find('div.creditImg', 0)->find('img', 0);
$avatar = $avatar->getAttribute('data-src');
@ -86,13 +74,28 @@ class PinterestBridge extends BridgeAbstract{
}
}
public function getName(){
if (isset($this->query))
{
return $this->query .' - Pinterest';
} else {
return $this->username .' - '. $this->board.' - Pinterest';
public function getURI(){
switch($this->queriedContext){
case 'By username and board':
$uri = $this->uri.urlencode($this->getInput('u')).'/'.urlencode($this->getInput('b'));
break;
case 'From search':
$uri = $this->uri.'search/?q='.urlencode($this->getInput('q'));
break;
}
return $uri;
}
public function getName(){
switch($this->queriedContext){
case 'By username and board':
$specific = $this->getInput('u').'-'.$this->getInput('b');
break;
case 'From search':
$specific = $this->getInput('q');
break;
}
return $specific .' - '.$this->name;
}
}

View file

@ -13,7 +13,8 @@ class PlanetLibreBridge extends BridgeAbstract{
}
public function collectData(){
$html = $this->getSimpleHTMLDOM('http://www.planet-libre.org/') or $this->returnServerError('Could not request PlanetLibre.');
$html = $this->getSimpleHTMLDOM($this->uri)
or $this->returnServerError('Could not request PlanetLibre.');
$limit = 0;
foreach($html->find('div.post') as $element) {
if($limit < 5) {

View file

@ -8,12 +8,12 @@ class ProjectMGameBridge extends BridgeAbstract{
public function collectData(){
$html = '';
$html = $this->getSimpleHTMLDOM('http://projectmgame.com/en/') or $this->returnServerError('Error while downloading the Project M homepage');
$html = $this->getSimpleHTMLDOM($this->uri)
or $this->returnServerError('Error while downloading the Project M homepage');
foreach($html->find('article') as $article) {
$item = array();
$item['uri'] = 'http://projectmgame.com/en/'.$article->find('section div.info_block a',0)->href;
$item['uri'] = $this->uri.$article->find('section div.info_block a',0)->href;
$item['title'] = $article->find('h1 p',0)->innertext;
$p_list = $article->find('section p');

View file

@ -1,7 +1,7 @@
<?php
class RTBFBridge extends BridgeAbstract {
public $name = "RTBF Bridge";
public $uri = "http://www.rtbf.be/auvio/emissions";
public $uri = "http://www.rtbf.be/auvio/emissions/";
public $description = "Returns the newest RTBF videos by series ID";
public $maintainer = "Frenzie";
@ -18,14 +18,16 @@ class RTBFBridge extends BridgeAbstract {
$limit = 10;
$count = 0;
if ($this->getInput('c')) {
$html = $this->getSimpleHTMLDOM('http://www.rtbf.be/auvio/emissions/detail?id='.$this->getInput('c')) or $this->returnServerError('Could not request RTBF.');
$html = $this->getSimpleHTMLDOM($this->getURI())
or $this->returnServerError('Could not request RTBF.');
foreach($html->find('section[id!=widget-ml-avoiraussi-] .rtbf-media-grid article') as $element) {
if($count < $limit) {
if($count >= $limit) {
break;
}
$item = array();
$item['id'] = $element->getAttribute('data-id');
$item['uri'] = 'http://www.rtbf.be/auvio/detail?id='.$item['id'];
$item['uri'] = $this->uri.'detail?id='.$item['id'];
$thumbnailUriSrcSet = explode(',', $element->find('figure .www-img-16by9 img', 0)->getAttribute('data-srcset'));
$thumbnailUriLastSrc = end($thumbnailUriSrcSet);
$thumbnailUri = explode(' ', $thumbnailUriLastSrc)[0];
@ -36,14 +38,13 @@ class RTBFBridge extends BridgeAbstract {
$count++;
}
}
}
else {
$this->returnClientError('You must specify a series id.');
}
public function getURI(){
return $this->uri.'detail?id='.$this->getInput('c');
}
public function getName(){
return (!empty($this->request) ? $this->request .' - ' : '') .'RTBF Bridge';
return $this->getInput('c') .' - RTBF Bridge';
}
public function getCacheDuration(){

View file

@ -32,13 +32,23 @@ class Releases3DSBridge extends BridgeAbstract {
}
}
$dataUrl = 'http://3dsdb.com/xml.php';
$dataUrl = $this->uri.'xml.php';
$xml = $this->getContents($dataUrl) or $this->returnServerError('Could not request 3dsdb: '.$dataUrl);
$limit = 0;
foreach (array_reverse(explode('<release>', $xml)) as $element) {
if ($limit < 5) {
if (strpos($element, '</release>') !== false) {
if ($limit >= 5) {
break;
}
if (strpos($element, '</release>') === false) {
continue;
}
$releasename = ExtractFromDelimiters($element, '<releasename>', '</releasename>');
if (empty($releasename)) {
continue;
}
$id = ExtractFromDelimiters($element, '<id>', '</id>');
$name = ExtractFromDelimiters($element, '<name>', '</name>');
@ -50,14 +60,11 @@ class Releases3DSBridge extends BridgeAbstract {
$titleid = ExtractFromDelimiters($element, '<titleid>', '</titleid>');
$imgcrc = ExtractFromDelimiters($element, '<imgcrc>', '</imgcrc>');
$filename = ExtractFromDelimiters($element, '<filename>', '</filename>');
$releasename = ExtractFromDelimiters($element, '<releasename>', '</releasename>');
$trimmedsize = ExtractFromDelimiters($element, '<trimmedsize>', '</trimmedsize>');
$firmware = ExtractFromDelimiters($element, '<firmware>', '</firmware>');
$type = ExtractFromDelimiters($element, '<type>', '</type>');
$card = ExtractFromDelimiters($element, '<card>', '</card>');
if (!empty($releasename)) {
//Retrieve cover art and short desc from IGN?
$ignResult = false; $ignDescription = ''; $ignLink = ''; $ignDate = time(); $ignCoverArt = '';
$ignSearchUrl = 'http://www.ign.com/search?q='.urlencode($name);
@ -109,9 +116,6 @@ class Releases3DSBridge extends BridgeAbstract {
$limit++;
}
}
}
}
}
public function getCacheDuration() {
return 10800; //3 hours

View file

@ -24,7 +24,7 @@ class ReporterreBridge extends BridgeAbstract{
}
public function collectData(){
$html = $this->getSimpleHTMLDOM('http://www.reporterre.net/spip.php?page=backend') or $this->returnServerError('Could not request Reporterre.');
$html = $this->getSimpleHTMLDOM($this->uri.'spip.php?page=backend') or $this->returnServerError('Could not request Reporterre.');
$limit = 0;
foreach($html->find('item') as $element) {

View file

@ -15,21 +15,16 @@ class Rule34Bridge extends BridgeAbstract{
));
public function collectData(){
$page = 0;$tags='';
if ($this->getInput('p')) {
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
$page = $page - 1;
$page = $page * 50;
}
if ($this->getInput('t')) {
$tags = urlencode($this->getInput('t'));
}
$html = $this->getSimpleHTMLDOM("http://rule34.xxx/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Rule34.');
$html = $this->getSimpleHTMLDOM(
$this->uri.'index.php?page=post&s=list&'
.'&pid='.($this->getInput('p')?($this->getInput('p') -1)*50:'')
.'&tags='.urlencode($this->getInput('t'))
) or $this->returnServerError('Could not request Rule34.');
foreach($html->find('div[class=content] span') as $element) {
$item = array();
$item['uri'] = 'http://rule34.xxx/'.$element->find('a', 0)->href;
$item['uri'] = $this->uri.$element->find('a', 0)->href;
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
$item['timestamp'] = time();
$thumbnailUri = $element->find('img', 0)->src;

View file

@ -16,19 +16,13 @@ class Rule34pahealBridge extends BridgeAbstract{
public function collectData(){
$page = 0;$tags='';
if ($this->getInput('p')) {
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
}
if ($this->getInput('t')) {
$tags = urlencode($this->getInput('t'));
}
$html = $this->getSimpleHTMLDOM("http://rule34.paheal.net/post/list/$tags/$page") or $this->returnServerError('Could not request Rule34paheal.');
$html = $this->getSimpleHTMLDOM($this->uri.'post/list/'.$tags.'/'.$page)
or $this->returnServerError('Could not request Rule34paheal.');
foreach($html->find('div[class=shm-image-list] div[class=shm-thumb]') as $element) {
$item = array();
$item['uri'] = 'http://rule34.paheal.net'.$element->find('a', 0)->href;
$item['uri'] = $this->uri.$element->find('a', 0)->href;
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->find('img', 0)->getAttribute('id'));
$item['timestamp'] = time();
$thumbnailUri = $element->find('img', 0)->src;

View file

@ -15,21 +15,15 @@ class SafebooruBridge extends BridgeAbstract{
));
public function collectData(){
$page = 0;$tags='';
if ($this->getInput('p')) {
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
$page = $page - 1;
$page = $page * 40;
}
if ($this->getInput('t')) {
$tags = urlencode($this->getInput('t'));
}
$html = $this->getSimpleHTMLDOM("http://safebooru.org/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Safebooru.');
$html = $this->getSimpleHTMLDOM(
$this->uri.'index.php?page=post&s=list&'
.'&pid='.($this->getInput('p')?($this->getInput('p') -1)*40:'')
.'&tags='.urlencode($this->getInput('t'))
) or $this->returnServerError('Could not request Safebooru.');
foreach($html->find('div[class=content] span') as $element) {
$item = array();
$item['uri'] = 'http://safebooru.org/'.$element->find('a', 0)->href;
$item['uri'] = $this->uri.$element->find('a', 0)->href;
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
$item['timestamp'] = time();
$thumbnailUri = $element->find('img', 0)->src;

View file

@ -9,20 +9,19 @@ class SakugabooruBridge extends BridgeAbstract{
public $parameters = array( array(
'p'=>array(
'name'=>'page',
'defaultValue'=>1,
'type'=>'number'
),
't'=>array('name'=>'tags')
));
public function collectData(){
$page = 1;$tags='';
if ($this->getInput('p')) {
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
}
if ($this->getInput('t')) {
$tags = urlencode($this->getInput('t'));
}
$html = $this->getSimpleHTMLDOM("http://sakuga.yshi.org/post?page=$page&tags=$tags") or $this->returnServerError('Could not request Sakugabooru.');
$html = $this->getSimpleHTMLDOM(
$this->uri.'post?'
.'&page='.$this->getInput('p')
.'&tags='.urlencode($this->getInput('t'))
) or $this->returnServerError('Could not request Sakugabooru.');
$input_json = explode('Post.register(', $html);
foreach($input_json as $element)
$data[] = preg_replace('/}\)(.*)/', '}', $element);
@ -31,7 +30,7 @@ class SakugabooruBridge extends BridgeAbstract{
foreach($data as $datai) {
$json = json_decode($datai, TRUE);
$item = array();
$item['uri'] = 'http://sakuga.yshi.org/post/show/'.$json['id'];
$item['uri'] = $this->uri.'/post/show/'.$json['id'];
$item['postid'] = $json['id'];
$item['timestamp'] = $json['created_at'];
$item['imageUri'] = $json['file_url'];

View file

@ -8,11 +8,12 @@ class ScmbBridge extends BridgeAbstract{
public function collectData(){
$html = '';
$html = $this->getSimpleHTMLDOM('http://secouchermoinsbete.fr/') or $this->returnServerError('Could not request Se Coucher Moins Bete.');
$html = $this->getSimpleHTMLDOM($this->uri)
or $this->returnServerError('Could not request Se Coucher Moins Bete.');
foreach($html->find('article') as $article) {
$item = array();
$item['uri'] = 'http://secouchermoinsbete.fr'.$article->find('p.summary a',0)->href;
$item['uri'] = $this->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

View file

@ -3,7 +3,7 @@ class ScoopItBridge extends BridgeAbstract{
public $maintainer = "Pitchoule";
public $name = "ScoopIt";
public $uri = "http://www.scoop.it";
public $uri = "http://www.scoop.it/";
public $description = "Returns most recent results from ScoopIt.";
public $parameters = array( array(
@ -14,12 +14,11 @@ class ScoopItBridge extends BridgeAbstract{
));
public function collectData(){
$html = '';
if ($this->getInput('u') != '') {
$this->request = $this->getInput('u');
$link = 'http://scoop.it/search?q=' .urlencode($this->request);
$link = $this->uri.'search?q=' .urlencode($this->getInput('u'));
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request ScoopIt. for : ' . $link);
$html = $this->getSimpleHTMLDOM($link)
or $this->returnServerError('Could not request ScoopIt. for : ' . $link);
foreach($html->find('div.post-view') as $element) {
$item = array();
@ -28,9 +27,6 @@ class ScoopItBridge extends BridgeAbstract{
$item['content'] = preg_replace('~[[:cntrl:]]~', '', $element->find('div.tCustomization_post_description', 0)->plaintext);
$this->items[] = $item;
}
} else {
$this->returnServerError('You must specify a keyword');
}
}
public function getCacheDuration(){

View file

@ -3,7 +3,7 @@ class SensCritiqueBridge extends BridgeAbstract {
public $maintainer = "kranack";
public $name = "Sens Critique";
public $uri = "http://www.senscritique.com";
public $uri = "http://www.senscritique.com/";
public $description = "Sens Critique news";
public $parameters = array( array(
@ -34,69 +34,25 @@ class SensCritiqueBridge extends BridgeAbstract {
));
public function collectData(){
if (($this->getInput('m') && $this->getInput('m'))) {
$this->collectMoviesData();
} else if (($this->getInput('s') && $this->getInput('s'))) {
$this->collectSeriesData();
} else if (($this->getInput('g') && $this->getInput('g'))) {
$this->collectGamesData();
} else if (($this->getInput('b') && $this->getInput('b'))) {
$this->collectBooksData();
} else if (($this->getInput('bd') && $this->getInput('bd'))) {
$this->collectBDsData();
} else if (($this->getInput('mu') && $this->getInput('mu'))) {
$this->collectMusicsData();
} else {
$this->returnClientError('You must choose a category');
$categories=array();
foreach($this->parameters[$this->queriedContext] as $category=>$properties){
if($this->getInput($category)){
$uri=$this->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;
}
}
private function collectMoviesData() {
$html = '';
$html = $this->getSimpleHTMLDOM('http://www.senscritique.com/films/cette-semaine') or $this->returnServerError('No results for this query.');
$html = $this->getSimpleHTMLDOM($uri)
or $this->returnServerError('No results for this query.');
$list = $html->find('ul.elpr-list', 0);
$this->extractDataFromList($list);
}
private function collectSeriesData() {
$html = '';
$html = $this->getSimpleHTMLDOM('http://www.senscritique.com/series/actualite') or $this->returnServerError('No results for this query.');
$list = $html->find('ul.elpr-list', 0);
$this->extractDataFromList($list);
}
private function collectGamesData() {
$html = '';
$html = $this->getSimpleHTMLDOM('http://www.senscritique.com/jeuxvideo/actualite') or $this->returnServerError('No results for this query.');
$list = $html->find('ul.elpr-list', 0);
$this->extractDataFromList($list);
}
private function collectBooksData() {
$html = '';
$html = $this->getSimpleHTMLDOM('http://www.senscritique.com/livres/actualite') or $this->returnServerError('No results for this query.');
$list = $html->find('ul.elpr-list', 0);
$this->extractDataFromList($list);
}
private function collectBDsData() {
$html = '';
$html = $this->getSimpleHTMLDOM('http://www.senscritique.com/bd/actualite') or $this->returnServerError('No results for this query.');
$list = $html->find('ul.elpr-list', 0);
$this->extractDataFromList($list);
}
private function collectMusicsData() {
$html = '';
$html = $this->getSimpleHTMLDOM('http://www.senscritique.com/musique/actualite') or $this->returnServerError('No results for this query.');
$list = $html->find('ul.elpr-list', 0);
$this->extractDataFromList($list);
}
private function extractDataFromList($list) {

View file

@ -14,8 +14,9 @@ class SiliconBridge extends BridgeAbstract {
return $string;
}
$feedUrl = 'http://www.silicon.fr/feed';
$html = $this->getSimpleHTMLDOM($feedUrl) or $this->returnServerError('Could not request Silicon: '.$feedUrl);
$feedUrl = $this->uri.'feed';
$html = $this->getSimpleHTMLDOM($feedUrl)
or $this->returnServerError('Could not request Silicon: '.$feedUrl);
$limit = 0;
foreach($html->find('item') as $element) {
@ -25,7 +26,8 @@ class SiliconBridge extends BridgeAbstract {
$article_uri = $element->innertext;
$article_uri = substr($article_uri, strpos($article_uri, '<link>') + 6);
$article_uri = substr($article_uri, 0, strpos($article_uri, '</link>'));
$article_html = $this->getSimpleHTMLDOM($article_uri) or $this->returnServerError('Could not request Silicon: '.$article_uri);
$article_html = $this->getSimpleHTMLDOM($article_uri)
or $this->returnServerError('Could not request Silicon: '.$article_uri);
//Build article contents from corresponding elements
$thumbnailUri = $element->find('enclosure', 0)->url;

View file

@ -3,7 +3,7 @@ class SoundCloudBridge extends BridgeAbstract{
public $maintainer = "kranack";
public $name = "Soundcloud Bridge";
public $uri = "http://www.soundcloud.com/";
public $uri = "https://soundcloud.com/";
public $description = "Returns 10 newest music from user profile";
public $parameters = array( array(
@ -33,10 +33,10 @@ class SoundCloudBridge extends BridgeAbstract{
$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['id'] = 'https://soundcloud.com/'
$item['id'] = $this->uri
. urlencode($this->getInput('u')) .'/'
. urlencode($tracks[$i]->permalink);
$item['uri'] = 'https://soundcloud.com/'
$item['uri'] = $this->uri
. urlencode($this->getInput('u')) .'/'
. urlencode($tracks[$i]->permalink);
$this->items[] = $item;

View file

@ -6,14 +6,14 @@ class StripeAPIChangeLogBridge extends BridgeAbstract{
public $description = 'Returns the changes made to the stripe.com API';
public function collectData(){
$html = $this->getSimpleHTMLDOM('https://stripe.com/docs/upgrades')
$html = $this->getSimpleHTMLDOM($this->uri)
or $this->returnServerError('No results for Stripe API Changelog');
foreach($html->find('h3') as $change){
$item=array();
$item['title']=trim($change->plaintext);
$item['uri']='https://stripe.com/docs/upgrades#'.$item['title'];
$item['uri']=$this->uri.'#'.$item['title'];
$item['author']='stripe';
$item['content']=$change->nextSibling()->outertext;
$item['timestamp']=strtotime($item['title']);

View file

@ -1,45 +1,46 @@
<?php
class SuperbWallpapersBridge extends BridgeAbstract {
private $category;
private $resolution;
public $maintainer = "nel50n";
public $name = "Superb Wallpapers Bridge";
public $uri = "http://www.superbwallpapers.com/";
public $description = "Returns the latests wallpapers from SuperbWallpapers";
public $parameters = array( array(
'c'=>array('name'=>'category'),
'c'=>array(
'name'=>'category',
'required'=>true
),
'm'=>array(
'name'=>'Max number of wallpapers',
'type'=>'number'
),
'r'=>array(
'name'=>'resolution',
'exampleValue'=>'1920x1200, 1680x1050,…'
'exampleValue'=>'1920x1200, 1680x1050,…',
'defaultValue'=>'1920x1200'
)
));
public function collectData(){
$html = '';
$baseUri = 'http://www.superbwallpapers.com';
$this->category = $this->getInput('c') ?: ''; // All default
$this->resolution = $this->getInput('r') ?: '1920x1200'; // Wide wallpaper default
$category = $this->getInput('c');
$resolution = $this->getInput('r'); // Wide wallpaper default
$num = 0;
$max = $this->getInput('m') ?: 36;
$lastpage = 1;
// Get last page number
$link = $baseUri.'/'.$this->category.'/9999.html';
$html = $this->getSimpleHTMLDOM($link);
$link = $this->uri.'/'.$category.'/9999.html';
$html = $this->getSimpleHTMLDOM($link)
or $this->returnServerError('Could not load '.$link);
$lastpage = min($html->find('.paging .cpage', 0)->innertext(), ceil($max/36));
for ($page = 1; $page <= $lastpage; $page++) {
$link = $baseUri.'/'.$this->category.'/'.$page.'.html';
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('No results for this query.');
$link = $this->uri.'/'.$category.'/'.$page.'.html';
$html = $this->getSimpleHTMLDOM($link)
or $this->returnServerError('No results for this query.');
foreach($html->find('.wpl .i a') as $element) {
$thumbnail = $element->find('img', 0);
@ -59,7 +60,7 @@ class SuperbWallpapersBridge extends BridgeAbstract {
}
public function getName(){
return 'HDWallpapers - '.$this->category.' ['.$this->resolution.']';
return $this->name .'- '.$this->getInput('c').' ['.$this->getInput('r').']';
}
public function getCacheDuration(){

View file

@ -24,14 +24,11 @@ class T411Bridge extends BridgeAbstract {
} return false;
}
//Ensure proper parameters have been provided
if (empty($this->getInput('search'))) {
$this->returnClientError('You must specify a search criteria');
}
//Retrieve torrent listing from search results, which does not contain torrent description
$url = $this->uri.'torrents/search/?'.$this->getInput('search').'&order=added&type=desc';
$html = $this->getSimpleHTMLDOM($url) or $this->returnServerError('Could not request t411: '.$url);
$html = $this->getSimpleHTMLDOM($url)
or $this->returnServerError('Could not request t411: '.$url);
$results = $html->find('table.results', 0);
if (is_null($results))
$this->returnServerError('No results from t411: '.$url);
@ -41,7 +38,12 @@ class T411Bridge extends BridgeAbstract {
foreach ($results->find('tr') as $element) {
//Limit total amount of requests and ignore table header
if ($limit < 10 && !is_object($element->find('th', 0))) {
if ($limit >= 10){
break;
}
if(is_object($element->find('th', 0))){
continue;
}
//Requests are rate-limited
usleep(500000); //So we need to wait (500ms)
@ -52,7 +54,10 @@ class T411Bridge extends BridgeAbstract {
$item_date = strtotime($element->find('dd', 0)->plaintext);
//Retrieve full description from torrent page
if ($item_html = $this->getSimpleHTMLDOM($item_uri)) {
$item_html = $this->getSimpleHTMLDOM($item_uri);
if (!$item_html) {
continue;
}
//Retrieve data from page contents
$item_desc = $item_html->find('div.description', 0);
@ -77,7 +82,5 @@ class T411Bridge extends BridgeAbstract {
$limit++;
}
}
}
}
}

View file

@ -3,7 +3,7 @@ class TagBoardBridge extends BridgeAbstract{
public $maintainer = "Pitchoule";
public $name = "TagBoard";
public $uri = "http://www.TagBoard.com";
public $uri = "http://www.TagBoard.com/";
public $description = "Returns most recent results from TagBoard.";
public $parameters = array( array(
@ -14,11 +14,10 @@ class TagBoardBridge extends BridgeAbstract{
));
public function collectData(){
$html = '';
$this->request = $this->getInput('u');
$link = 'https://post-cache.tagboard.com/search/' .$this->request;
$link = 'https://post-cache.tagboard.com/search/' .$this->getInput('u');
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request TagBoard for : ' . $link);
$html = $this->getSimpleHTMLDOM($link)
or $this->returnServerError('Could not request TagBoard for : ' . $link);
$parsed_json = json_decode($html);
foreach($parsed_json->{'posts'} as $element) {
@ -36,7 +35,7 @@ class TagBoardBridge extends BridgeAbstract{
}
public function getName(){
return 'tagboard - ' .$this->request;
return 'tagboard - ' .$this->getInput('u');
}
public function getCacheDuration(){

View file

@ -15,21 +15,16 @@ class TbibBridge extends BridgeAbstract{
));
public function collectData(){
$page = 0;$tags='';
if ($this->getInput('p')) {
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
$page = $page - 1;
$page = $page * 50;
}
if ($this->getInput('t')) {
$tags = urlencode($this->getInput('t'));
}
$html = $this->getSimpleHTMLDOM("http://tbib.org/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Tbib.');
$html = $this->getSimpleHTMLDOM(
$this->uri.'index.php?page=post&s=list&'
.'&pid='.($this->getInput('p')?($this->getInput('p') -1)*50:'')
.'&tags='.urlencode($this->getInput('t'))
) or $this->returnServerError('Could not request Tbib.');
foreach($html->find('div[class=content] span') as $element) {
$item = array();
$item['uri'] = 'http://tbib.org/'.$element->find('a', 0)->href;
$item['uri'] = $this->uri.$element->find('a', 0)->href;
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
$item['timestamp'] = time();
$thumbnailUri = $element->find('img', 0)->src;

View file

@ -7,7 +7,8 @@ class TheCodingLoveBridge extends BridgeAbstract{
public $description = "The Coding Love";
public function collectData(){
$html = $this->getSimpleHTMLDOM('http://thecodinglove.com/') or $this->returnServerError('Could not request The Coding Love.');
$html = $this->getSimpleHTMLDOM($this->uri)
or $this->returnServerError('Could not request The Coding Love.');
foreach($html->find('div.post') as $element) {
$item = array();

View file

@ -1,7 +1,4 @@
<?php
define("THE_OATMEAL", "http://theoatmeal.com/");
define("THE_OATMEAL_RSS", "http://feeds.feedburner.com/oatmealfeed");
class TheOatmealBridge extends RssExpander{
public $maintainer = "Riduidel";
@ -10,7 +7,7 @@ class TheOatmealBridge extends RssExpander{
public $description = "Un petit site de dessins assez rigolos";
public function collectData(){
parent::collectExpandableDatas(THE_OATMEAL_RSS);
$this->collectExpandableDatas('http://feeds.feedburner.com/oatmealfeed');
}

View file

@ -9,7 +9,8 @@ class ThePirateBayBridge extends BridgeAbstract{
public $parameters = array( array(
'q'=>array(
'name'=>'keywords, separated by semicolons',
'exampleValue'=>'first list;second list;…'
'exampleValue'=>'first list;second list;…',
'required'=>true
)
));
@ -49,12 +50,10 @@ class ThePirateBayBridge extends BridgeAbstract{
}
if (!$this->getInput('q'))
$this->returnClientError('You must specify keywords (?q=...)');
$keywordsList = explode(";",$this->getInput('q'));
foreach($keywordsList as $keywords){
$html = $this->getSimpleHTMLDOM('https://thepiratebay.org/search/'.rawurlencode($keywords).'/0/3/0') or $this->returnServerError('Could not request TPB.');
$html = $this->getSimpleHTMLDOM($this->uri.'search/'.rawurlencode($keywords).'/0/3/0')
or $this->returnServerError('Could not request TPB.');
if ($html->find('table#searchResult', 0) == FALSE)
$this->returnServerError('No result for query '.$keywords);
@ -62,7 +61,7 @@ class ThePirateBayBridge extends BridgeAbstract{
foreach($html->find('tr') as $element) {
$item = array();
$item['uri'] = 'https://thepiratebay.org/'.$element->find('a.detLink',0)->href;
$item['uri'] = $this->uri.$element->find('a.detLink',0)->href;
$item['id'] = $item['uri'];
$item['timestamp'] = parseDateTimestamp($element);
$item['title'] = $element->find('a.detLink',0)->plaintext;

View file

@ -39,11 +39,9 @@ class TwitchApiBridge extends BridgeAbstract{
$context = stream_context_create($opts);
if(!$this->getInput('limit') ||
empty($this->getInput('limit'))){
$limit = $this->getInput('limit');
if(!$limit){
$limit = TWITCH_LIMIT;
}else{
$limit = (int)$this->getInput('limit');
}
// The Twitch API allows a limit between 1 .. 100. Therefore any value below must be set to 1, any greater must result in multiple requests.

View file

@ -86,7 +86,7 @@ class TwitterBridge extends BridgeAbstract{
// 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');
$item['uri'] = $this->uri.$tweet->find('a.js-permalink', 0)->getAttribute('href');
// extract tweet timestamp
$item['timestamp'] = $tweet->find('span.js-short-timestamp', 0)->getAttribute('data-time');
// generate the title
@ -111,7 +111,7 @@ class TwitterBridge extends BridgeAbstract{
}
// get tweet text
$cleanedTweet = str_replace('href="/', 'href="https://twitter.com/', $tweet->find('p.js-tweet-text', 0)->innertext);
$cleanedTweet = str_replace('href="/', 'href="'.$this->uri, $tweet->find('p.js-tweet-text', 0)->innertext);
// Add picture to content
$picture_html = '';

View file

@ -9,32 +9,32 @@ class UnsplashBridge extends BridgeAbstract {
public $parameters = array( array(
'm'=>array(
'name'=>'Max number of photos',
'type'=>'number'
'type'=>'number',
'defaultValue'=>20
),
'w'=>array(
'name'=>'Width',
'exampleValue'=>'1920, 1680, …'
'exampleValue'=>'1920, 1680, …',
'defaultValue'=>'1920'
),
'q'=>array(
'name'=>'JPEG quality',
'type'=>'number'
'type'=>'number',
'defaultValue'=>75
)
));
public function collectData(){
$html = '';
$baseUri = 'http://unsplash.com';
$width = $this->getInput('w') ?: '1920'; // Default width
$width = $this->getInput('w') ;
$num = 0;
$max = $this->getInput('m') ?: 20;
$quality = $this->getInput('q') ?: 75;
$max = $this->getInput('m');
$quality = $this->getInput('q');
$lastpage = 1;
for ($page = 1; $page <= $lastpage; $page++) {
$link = $baseUri.'/grid?page='.$page;
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('No results for this query.');
$link = $this->uri.'/grid?page='.$page;
$html = $this->getSimpleHTMLDOM($link)
or $this->returnServerError('No results for this query.');
if ($page === 1) {
preg_match('/=(\d+)$/', $html->find('.pagination > a[!class]', -1)->href, $matches);

View file

@ -1,5 +1,5 @@
<?php
class ViadeoCompany extends BridgeAbstract{
class ViadeoCompanyBridge extends BridgeAbstract{
public $maintainer = "regisenguehard";
public $name = "Viadeo Company";
@ -15,9 +15,10 @@ class ViadeoCompany extends BridgeAbstract{
public function collectData(){
$html = '';
$link = 'http://www.viadeo.com/fr/company/'.$this->getInput('c');
$link = $this->uri.'fr/company/'.$this->getInput('c');
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request Viadeo.');
$html = $this->getSimpleHTMLDOM($link)
or $this->returnServerError('Could not request Viadeo.');
foreach($html->find('//*[@id="company-newsfeed"]/ul/li') as $element) {
$title = $element->find('p', 0)->innertext;

View file

@ -15,9 +15,10 @@ class VineBridge extends BridgeAbstract {
public function collectData(){
$html = '';
$uri = 'http://vine.co/u/'.$this->getInput('u').'?mode=list';
$uri = $this->uri.'/u/'.$this->getInput('u').'?mode=list';
$html = $this->getSimpleHTMLDOM($uri) or $this->returnServerError('No results for this query.');
$html = $this->getSimpleHTMLDOM($uri)
or $this->returnServerError('No results for this query.');
foreach($html->find('.post') as $element) {
$a = $element->find('a', 0);

View file

@ -4,7 +4,7 @@ class VkBridge extends BridgeAbstract {
public $maintainer = "ahiles3005";
public $name = "VK.com";
public $uri = "http://www.vk.com/";
public $uri = "http://vk.com/";
public $description = "Working with open pages";
public $parameters=array(
'Url on page group or user' => array(
@ -16,13 +16,10 @@ class VkBridge extends BridgeAbstract {
);
public function collectData(){
$html = '';
if ($this->getInput('u')) {
$text_html = $this->getSimpleHTMLDOM(urldecode($this->getInput('u')))
$text_html = $this->getContents(urldecode($this->getInput('u')))
or $this->returnServerError('No results for this query.');
$text_html = iconv('windows-1251', 'utf-8', $text_html);
$html = str_get_html($text_html);
}
foreach ($html->find('div.post_table') as $post) {
if (is_object($post->find('a.wall_post_more', 0))) {
$post->find('a.wall_post_more', 0)->outertext = ''; //delete link "show full" in content
@ -36,20 +33,16 @@ class VkBridge extends BridgeAbstract {
//get video on post
if (is_object($post->find('span.post_video_title_content', 0))) {
$titleVideo = $post->find('span.post_video_title_content', 0)->plaintext;
$linkToVideo = 'https://vk.com' . $post->find('a.page_post_thumb_video', 0)->getAttribute('href');
$linkToVideo = $this->uri . $post->find('a.page_post_thumb_video', 0)->getAttribute('href');
$item['content'] .= "\n\r {$titleVideo}: {$linkToVideo}";
}
$item['uri'] = 'https://vk.com' . $post->find('.reply_link_wrap', 0)->find('a', 0)->getAttribute('href'); // get post link
$item['uri'] = $this->uri . $post->find('.reply_link_wrap', 0)->find('a', 0)->getAttribute('href'); // get post link
$item['date'] = $post->find('span.rel_date', 0)->plaintext;
$this->items[] = $item;
// var_dump($item['date']);
}
}
public function getName() {
return(isset($this->name) ? $this->name . ' - ' : '') . 'VK Bridge';
}
public function getCacheDuration() {
return 300; // 5 minutes
}

View file

@ -1,13 +1,9 @@
<?php
class WallpaperStopBridge extends BridgeAbstract {
private $category;
private $subcategory;
private $resolution;
public $maintainer = "nel50n";
public $name = "WallpaperStop Bridge";
public $uri = "http://www.wallpaperstop.com/";
public $uri = "http://www.wallpaperstop.com";
public $description = "Returns the latests wallpapers from WallpaperStop";
public $parameters = array( array(
@ -15,33 +11,30 @@ class WallpaperStopBridge extends BridgeAbstract {
's'=>array('name'=>'subcategory'),
'm'=>array(
'name'=>'Max number of wallpapers',
'type'=>'number'
'type'=>'number',
'defaultValue'=>20
),
'r'=>array(
'name'=>'resolution',
'exampleValue'=>'1920x1200, 1680x1050,…',
'defaultValue'=>'1920x1200'
)
));
public function collectData(){
$html = '';
if (!$this->getInput('c')) {
$this->returnClientError('You must specify at least a category (?c=...).');
} else {
$baseUri = 'http://www.wallpaperstop.com';
$this->category = $this->getInput('c');
$this->subcategory = $this->getInput('s') ?: '';
$this->resolution = $this->getInput('r') ?: '1920x1200'; // Wide wallpaper default
$category = $this->getInput('c');
$subcategory = $this->getInput('s');
$resolution = $this->getInput('r');
$num = 0;
$max = $this->getInput('m') ?: 20;
$max = $this->getInput('m');
$lastpage = 1;
for ($page = 1; $page <= $lastpage; $page++) {
$link = $baseUri.'/'.$this->category.'-wallpaper/'.(!empty($this->subcategory)?$this->subcategory.'-wallpaper/':'').'desktop-wallpaper-'.$page.'.html';
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('No results for this query.');
$link = $this->uri.'/'.$category.'-wallpaper/'.(!empty($subcategory)?$subcategory.'-wallpaper/':'').'desktop-wallpaper-'.$page.'.html';
$html = $this->getSimpleHTMLDOM($link)
or $this->returnServerError('No results for this query.');
if ($page === 1) {
preg_match('/-(\d+)\.html$/', $html->find('.pagination > .last', 0)->href, $matches);
@ -50,29 +43,27 @@ class WallpaperStopBridge extends BridgeAbstract {
foreach($html->find('article.item') as $element) {
$wplink = $element->getAttribute('data-permalink');
if (preg_match('%^http://www\.wallpaperstop\.com/(.+)/([^/]+)-(\d+)\.html$%', $wplink, $matches)) {
if (preg_match('%^'.$this->uri.'/(.+)/([^/]+)-(\d+)\.html$%', $wplink, $matches)) {
$thumbnail = $element->find('img', 0);
$item = array();
$item['uri'] = $baseUri.'/wallpapers/'.str_replace('wallpaper', 'wallpapers', $matches[1]).'/'.$matches[2].'-'.$this->resolution.'-'.$matches[3].'.jpg';
$item['uri'] = $this->uri.'/wallpapers/'.str_replace('wallpaper', 'wallpapers', $matches[1]).'/'.$matches[2].'-'.$resolution.'-'.$matches[3].'.jpg';
$item['id'] = $matches[3];
$item['timestamp'] = time();
$item['title'] = $thumbnail->title;
$item['content'] = $item['title'].'<br><a href="'.$wplink.'"><img src="'.$baseUri.$thumbnail->src.'" /></a>';
$item['content'] = $item['title'].'<br><a href="'.$wplink.'"><img src="'.$this->uri.$thumbnail->src.'" /></a>';
$this->items[] = $item;
$num++;
if ($num >= $max)
break 2;
}
}
}
}
}
public function getName(){
return 'WallpaperStop - '.$this->category.(!empty($this->subcategory) ? ' > '.$this->subcategory : '').' ['.$this->resolution.']';
return 'WallpaperStop - '.$this->getInput('c').(!empty($this->getInput('s')) ? ' > '.$this->getInput('s') : '').' ['.$this->getInput('r').']';
}
public function getCacheDuration(){

View file

@ -13,6 +13,8 @@ class WhydBridge extends BridgeAbstract{
)
));
private $userName='';
public function collectData(){
$html = '';
if (strlen(preg_replace("/[^0-9a-f]/",'', $this->getInput('u'))) == 24){
@ -34,7 +36,7 @@ class WhydBridge extends BridgeAbstract{
}
}
}
$this->name = $html->find('div#profileTop', 0)->find('h1', 0)->plaintext;
$this->userName = $html->find('div#profileTop', 0)->find('h1', 0)->plaintext;
for($i = 0; $i < 10; $i++) {
$track = $html->find('div.post', $i);
@ -42,13 +44,13 @@ class WhydBridge extends BridgeAbstract{
$item['author'] = $track->find('h2', 0)->plaintext;
$item['title'] = $track->find('h2', 0)->plaintext;
$item['content'] = $track->find('a.thumb',0) . '<br/>' . $track->find('h2', 0)->plaintext;
$item['id'] = 'http://www.whyd.com' . $track->find('a.no-ajaxy',0)->getAttribute('href');
$item['uri'] = 'http://www.whyd.com' . $track->find('a.no-ajaxy',0)->getAttribute('href');
$item['id'] = $this->uri . $track->find('a.no-ajaxy',0)->getAttribute('href');
$item['uri'] = $this->uri . $track->find('a.no-ajaxy',0)->getAttribute('href');
$this->items[] = $item;
}
}
public function getName(){
return (!empty($this->name) ? $this->name .' - ' : '') .'Whyd Bridge';
return (!empty($this->userName) ? $this->userName .' - ' : '') .'Whyd Bridge';
}
public function getCacheDuration(){

View file

@ -26,12 +26,10 @@ class WorldOfTanksBridge extends HttpCachingBridgeAbstract{
)
));
function getURI(){
$lang='fr';
if (!empty($this->getInput('lang'))) {
$lang = $this->getInput('lang');
}
private $title='';
function getURI(){
$lang = $this->getInput('lang');
$uri = $this->uri.$lang.'/news/';
if(!empty($this->getInput('category'))) {
$uri .= 'pc-browser/'.$this->getInput('category')."/";
@ -39,11 +37,16 @@ class WorldOfTanksBridge extends HttpCachingBridgeAbstract{
return $uri;
}
public function getName(){
return $this->title?:$this->name;
}
public function collectData(){
$html = $this->getSimpleHTMLDOM($this->getURI()) or $this->returnServerError('Could not request '.$this->getURI());
$html = $this->getSimpleHTMLDOM($this->getURI())
or $this->returnServerError('Could not request '.$this->getURI());
$this->debugMessage("loaded HTML from ".$this->getURI());
// customize name
$this->name = $html->find('title', 0)->innertext;
$this->title = $html->find('title', 0)->innertext;
foreach($html->find('.b-imgblock_ico') as $infoLink) {
$this->parseLine($infoLink);
}

View file

@ -15,21 +15,16 @@ class XbooruBridge extends BridgeAbstract{
));
public function collectData(){
$page = 0;$tags='';
if ($this->getInput('p')) {
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
$page = $page - 1;
$page = $page * 50;
}
if ($this->getInput('t')) {
$tags = urlencode($this->getInput('t'));
}
$html = $this->getSimpleHTMLDOM("http://xbooru.com/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Xbooru.');
$html = $this->getSimpleHTMLDOM(
$this->uri.'index.php?page=post&s=list&'
.'&pid='.($this->getInput('p')?($this->getInput('p') -1)*50:'')
.'&tags='.urlencode($this->getInput('t'))
) or $this->returnServerError('Could not request Xbooru.');
foreach($html->find('div[class=content] span') as $element) {
$item = array();
$item['uri'] = 'http://xbooru.com/'.$element->find('a', 0)->href;
$item['uri'] = $this->uri.$element->find('a', 0)->href;
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
$item['timestamp'] = time();
$thumbnailUri = $element->find('img', 0)->src;

View file

@ -9,20 +9,19 @@ class YandereBridge extends BridgeAbstract{
public $parameters = array( array(
'p'=>array(
'name'=>'page',
'type'=>'number'
'type'=>'number',
'defaultValue'=>1
),
't'=>array('name'=>'tags')
));
public function collectData(){
$page = 1; $tags = '';
if ($this->getInput('p')) {
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
}
if ($this->getInput('t')) {
$tags = urlencode($this->getInput('t'));
}
$html = $this->getSimpleHTMLDOM("https://yande.re/post?page=$page&tags=$tags") or $this->returnServerError('Could not request Yandere.');
$html = $this->getSimpleHTMLDOM(
$this->uri.'post?'
.'&page='.$this->getInput('p')
.'&tags='.urlencode($this->getInput('t'))
) or $this->returnServerError('Could not request Yander.');
$input_json = explode('Post.register(', $html);
foreach($input_json as $element)
$data[] = preg_replace('/}\)(.*)/', '}', $element);
@ -31,7 +30,7 @@ class YandereBridge extends BridgeAbstract{
foreach($data as $datai) {
$json = json_decode($datai, TRUE);
$item = array();
$item['uri'] = 'http://yande.re/post/show/'.$json['id'];
$item['uri'] = $this->uri.'post/show/'.$json['id'];
$item['postid'] = $json['id'];
$item['timestamp'] = $json['created_at'];
$item['imageUri'] = $json['file_url'];

View file

@ -207,16 +207,12 @@ class ZDNetBridge extends BridgeAbstract {
return $string;
}
$baseUri = $this->getURI();
$baseUri = $this->uri;
$feed = $this->getInput('feed');
if (empty($feed))
$this->returnClientError('Please select a feed to display.');
if (strpos($feed, 'downloads!') !== false) {
$feed = str_replace('downloads!', '', $feed);
$baseUri = str_replace('www.', 'downloads.', $baseUri);
}
if ($feed !== preg_replace('/[^a-zA-Z0-9-\/]+/', '', $feed) || substr_count($feed, '/') > 1 || strlen($feed > 64))
$this->returnClientError('Invalid "feed" parameter.');
$url = $baseUri.trim($feed, '/').'/rss.xml';
$html = $this->getSimpleHTMLDOM($url) or $this->returnServerError('Could not request ZDNet: '.$url);
$limit = 0;