Merge branch 'core' of https://framagit.org/peetah/rss-bridge
This commit is contained in:
commit
85a025a82b
38 changed files with 472 additions and 554 deletions
|
@ -10,6 +10,7 @@ class OpenClassroomsBridge extends BridgeAbstract{
|
||||||
'u'=>array(
|
'u'=>array(
|
||||||
'name'=>'Catégorie',
|
'name'=>'Catégorie',
|
||||||
'type'=>'list',
|
'type'=>'list',
|
||||||
|
'required'=>true,
|
||||||
'values'=>array(
|
'values'=>array(
|
||||||
'Arts & Culture'=>'arts',
|
'Arts & Culture'=>'arts',
|
||||||
'Code'=>'code',
|
'Code'=>'code',
|
||||||
|
@ -24,21 +25,18 @@ class OpenClassroomsBridge extends BridgeAbstract{
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
public function getURI(){
|
||||||
public function collectData(){
|
return $this->uri.'/courses?categories='.$this->getInput('u').'&'
|
||||||
if (empty($this->getInput('u')))
|
.'title=&sort=updatedAt+desc';
|
||||||
{
|
|
||||||
$this->returnServerError('Error: You must chose a category.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = '';
|
public function collectData(){
|
||||||
$link = 'https://openclassrooms.com/courses?categories='.$this->getInput('u').'&title=&sort=updatedAt+desc';
|
$html = $this->getSimpleHTMLDOM($this->getURI())
|
||||||
|
or $this->returnServerError('Could not request OpenClassrooms.');
|
||||||
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request OpenClassrooms.');
|
|
||||||
|
|
||||||
foreach($html->find('.courseListItem') as $element) {
|
foreach($html->find('.courseListItem') as $element) {
|
||||||
$item = array();
|
$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['title'] = $element->find('h3', 0)->plaintext;
|
||||||
$item['content'] = $element->find('slidingItem__descriptionContent', 0)->plaintext;
|
$item['content'] = $element->find('slidingItem__descriptionContent', 0)->plaintext;
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
|
|
|
@ -25,30 +25,8 @@ class ParuVenduImmoBridge extends BridgeAbstract
|
||||||
|
|
||||||
public function collectData()
|
public function collectData()
|
||||||
{
|
{
|
||||||
$html = '';
|
$html = $this->getSimpleHTMLDOM($this->getURI())
|
||||||
$num = 20;
|
or $this->returnServerError('Could not request paruvendu.');
|
||||||
$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.');
|
|
||||||
|
|
||||||
|
|
||||||
foreach($html->find('div.annonce a') as $element) {
|
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(){
|
public function getName(){
|
||||||
$request='';
|
$request='';
|
||||||
if($this->getInput('minarea') &&
|
$minarea=$this->getInput('minarea');
|
||||||
!empty($this->getInput('minarea'))
|
if(!empty($minarea)){
|
||||||
){
|
$request .= ' '.$minarea.' m2';
|
||||||
$request .= ' '.$this->getInput('minarea').' m2';
|
|
||||||
}
|
}
|
||||||
if($this->getInput('lo') &&
|
$location=$this->getInput('lo');
|
||||||
!empty($this->getInput('lo'))){
|
if(!empty($location)){
|
||||||
$request .= ' In: '.$this->getInput('lo');
|
$request .= ' In: '.$location;
|
||||||
}
|
}
|
||||||
return 'Paru Vendu Immobilier'.$request;
|
return 'Paru Vendu Immobilier'.$request;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,48 +1,40 @@
|
||||||
<?php
|
<?php
|
||||||
class PickyWallpapersBridge extends BridgeAbstract {
|
class PickyWallpapersBridge extends BridgeAbstract {
|
||||||
|
|
||||||
private $category;
|
|
||||||
private $subcategory;
|
|
||||||
private $resolution;
|
|
||||||
|
|
||||||
public $maintainer = "nel50n";
|
public $maintainer = "nel50n";
|
||||||
public $name = "PickyWallpapers Bridge";
|
public $name = "PickyWallpapers Bridge";
|
||||||
public $uri = "http://www.pickywallpapers.com/";
|
public $uri = "http://www.pickywallpapers.com/";
|
||||||
public $description = "Returns the latests wallpapers from PickyWallpapers";
|
public $description = "Returns the latests wallpapers from PickyWallpapers";
|
||||||
|
|
||||||
public $parameters = array( array(
|
public $parameters = array( array(
|
||||||
'c'=>array('name'=>'category'),
|
'c'=>array(
|
||||||
|
'name'=>'category',
|
||||||
|
'required'=>true
|
||||||
|
),
|
||||||
's'=>array('name'=>'subcategory'),
|
's'=>array('name'=>'subcategory'),
|
||||||
'm'=>array(
|
'm'=>array(
|
||||||
'name'=>'Max number of wallpapers',
|
'name'=>'Max number of wallpapers',
|
||||||
|
'defaultValue'=>12,
|
||||||
'type'=>'number'
|
'type'=>'number'
|
||||||
),
|
),
|
||||||
'r'=>array(
|
'r'=>array(
|
||||||
'name'=>'resolution',
|
'name'=>'resolution',
|
||||||
'exampleValue'=>'1920x1200, 1680x1050,…',
|
'exampleValue'=>'1920x1200, 1680x1050,…',
|
||||||
|
'defaultValue'=>'1920x1200',
|
||||||
'pattern'=>'[0-9]{3,4}x[0-9]{3,4}'
|
'pattern'=>'[0-9]{3,4}x[0-9]{3,4}'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
public function collectData(){
|
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;
|
$lastpage = 1;
|
||||||
|
$num = 0;
|
||||||
|
$max = $this->getInput('m');
|
||||||
|
$resolution = $this->getInput('r'); // Wide wallpaper default
|
||||||
|
|
||||||
for ($page = 1; $page <= $lastpage; $page++) {
|
for ($page = 1; $page <= $lastpage; $page++) {
|
||||||
$link = $baseUri.'/'.$this->resolution.'/'.$this->category.'/'.(!empty($this->subcategory)?$this->subcategory.'/':'').'page-'.$page.'/';
|
$html = $this->getSimpleHTMLDOM($this->getURI().'/page-'.$page.'/')
|
||||||
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('No results for this query.');
|
or $this->returnServerError('No results for this query.');
|
||||||
|
|
||||||
if ($page === 1) {
|
if ($page === 1) {
|
||||||
preg_match('/page-(\d+)\/$/', $html->find('.pages li a', -2)->href, $matches);
|
preg_match('/page-(\d+)\/$/', $html->find('.pages li a', -2)->href, $matches);
|
||||||
|
@ -52,7 +44,7 @@ class PickyWallpapersBridge extends BridgeAbstract {
|
||||||
foreach($html->find('.items li img') as $element) {
|
foreach($html->find('.items li img') as $element) {
|
||||||
|
|
||||||
$item = array();
|
$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['timestamp'] = time();
|
||||||
$item['title'] = $element->alt;
|
$item['title'] = $element->alt;
|
||||||
$item['content'] = $item['title'].'<br><a href="'.$item['uri'].'">'.$element.'</a>';
|
$item['content'] = $item['title'].'<br><a href="'.$item['uri'].'">'.$element.'</a>';
|
||||||
|
@ -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(){
|
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(){
|
public function getCacheDuration(){
|
||||||
|
|
|
@ -1,54 +1,42 @@
|
||||||
<?php
|
<?php
|
||||||
class PinterestBridge extends BridgeAbstract{
|
class PinterestBridge extends BridgeAbstract{
|
||||||
|
|
||||||
private $username;
|
|
||||||
private $board;
|
|
||||||
private $query;
|
|
||||||
|
|
||||||
public $maintainer = "pauder";
|
public $maintainer = "pauder";
|
||||||
public $name = "Pinterest Bridge";
|
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 $description = "Returns the newest images on a board";
|
||||||
|
|
||||||
public $parameters = array(
|
public $parameters = array(
|
||||||
'By username and board' => array(
|
'By username and board' => array(
|
||||||
'u'=>array('name'=>'username'),
|
'u'=>array(
|
||||||
'b'=>array('name'=>'board')
|
'name'=>'username',
|
||||||
|
'required'=>true
|
||||||
|
),
|
||||||
|
'b'=>array(
|
||||||
|
'name'=>'board',
|
||||||
|
'required'=>true
|
||||||
|
)
|
||||||
),
|
),
|
||||||
'From search' => array(
|
'From search' => array(
|
||||||
'q'=>array('name'=>'Keyword')
|
'q'=>array(
|
||||||
|
'name'=>'Keyword',
|
||||||
|
'required'=>true
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$html = '';
|
$html = $this->getSimpleHTMLDOM($this->getURI()) ;
|
||||||
if ($this->getInput('u') || $this->getInput('b')) {
|
if(!$html){
|
||||||
|
switch($this->queriedContext){
|
||||||
if (empty($this->getInput('u')))
|
case 'By username and board':
|
||||||
{
|
$this->returnServerError('Username and/or board not found');
|
||||||
$this->returnClientError('You must specify a Pinterest username (?u=...).');
|
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)
|
foreach($html->find('div.pinWrapper') as $div)
|
||||||
{
|
{
|
||||||
$a = $div->find('a.pinImageWrapper',0);
|
$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="" />';
|
$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 = $div->find('div.creditImg', 0)->find('img', 0);
|
||||||
$avatar = $avatar->getAttribute('data-src');
|
$avatar = $avatar->getAttribute('data-src');
|
||||||
|
@ -86,13 +74,28 @@ class PinterestBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($this->query))
|
return $uri;
|
||||||
{
|
}
|
||||||
return $this->query .' - Pinterest';
|
|
||||||
} else {
|
public function getName(){
|
||||||
return $this->username .' - '. $this->board.' - Pinterest';
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,8 @@ class PlanetLibreBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(){
|
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;
|
$limit = 0;
|
||||||
foreach($html->find('div.post') as $element) {
|
foreach($html->find('div.post') as $element) {
|
||||||
if($limit < 5) {
|
if($limit < 5) {
|
||||||
|
|
|
@ -8,12 +8,12 @@ class ProjectMGameBridge extends BridgeAbstract{
|
||||||
|
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$html = '';
|
$html = $this->getSimpleHTMLDOM($this->uri)
|
||||||
$html = $this->getSimpleHTMLDOM('http://projectmgame.com/en/') or $this->returnServerError('Error while downloading the Project M homepage');
|
or $this->returnServerError('Error while downloading the Project M homepage');
|
||||||
|
|
||||||
foreach($html->find('article') as $article) {
|
foreach($html->find('article') as $article) {
|
||||||
$item = array();
|
$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;
|
$item['title'] = $article->find('h1 p',0)->innertext;
|
||||||
|
|
||||||
$p_list = $article->find('section p');
|
$p_list = $article->find('section p');
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
class RTBFBridge extends BridgeAbstract {
|
class RTBFBridge extends BridgeAbstract {
|
||||||
public $name = "RTBF Bridge";
|
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 $description = "Returns the newest RTBF videos by series ID";
|
||||||
public $maintainer = "Frenzie";
|
public $maintainer = "Frenzie";
|
||||||
|
|
||||||
|
@ -18,14 +18,16 @@ class RTBFBridge extends BridgeAbstract {
|
||||||
$limit = 10;
|
$limit = 10;
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
|
||||||
if ($this->getInput('c')) {
|
$html = $this->getSimpleHTMLDOM($this->getURI())
|
||||||
$html = $this->getSimpleHTMLDOM('http://www.rtbf.be/auvio/emissions/detail?id='.$this->getInput('c')) or $this->returnServerError('Could not request RTBF.');
|
or $this->returnServerError('Could not request RTBF.');
|
||||||
|
|
||||||
foreach($html->find('section[id!=widget-ml-avoiraussi-] .rtbf-media-grid article') as $element) {
|
foreach($html->find('section[id!=widget-ml-avoiraussi-] .rtbf-media-grid article') as $element) {
|
||||||
if($count < $limit) {
|
if($count >= $limit) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
$item = array();
|
$item = array();
|
||||||
$item['id'] = $element->getAttribute('data-id');
|
$item['id'] = $element->getAttribute('data-id');
|
||||||
$item['uri'] = 'http://www.rtbf.be/auvio/detail?id='.$item['id'];
|
$item['uri'] = $this->uri.'detail?id='.$item['id'];
|
||||||
$thumbnailUriSrcSet = explode(',', $element->find('figure .www-img-16by9 img', 0)->getAttribute('data-srcset'));
|
$thumbnailUriSrcSet = explode(',', $element->find('figure .www-img-16by9 img', 0)->getAttribute('data-srcset'));
|
||||||
$thumbnailUriLastSrc = end($thumbnailUriSrcSet);
|
$thumbnailUriLastSrc = end($thumbnailUriSrcSet);
|
||||||
$thumbnailUri = explode(' ', $thumbnailUriLastSrc)[0];
|
$thumbnailUri = explode(' ', $thumbnailUriLastSrc)[0];
|
||||||
|
@ -36,14 +38,13 @@ class RTBFBridge extends BridgeAbstract {
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
public function getURI(){
|
||||||
$this->returnClientError('You must specify a series id.');
|
return $this->uri.'detail?id='.$this->getInput('c');
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName(){
|
||||||
return (!empty($this->request) ? $this->request .' - ' : '') .'RTBF Bridge';
|
return $this->getInput('c') .' - RTBF Bridge';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCacheDuration(){
|
public function getCacheDuration(){
|
||||||
|
|
|
@ -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);
|
$xml = $this->getContents($dataUrl) or $this->returnServerError('Could not request 3dsdb: '.$dataUrl);
|
||||||
$limit = 0;
|
$limit = 0;
|
||||||
|
|
||||||
foreach (array_reverse(explode('<release>', $xml)) as $element) {
|
foreach (array_reverse(explode('<release>', $xml)) as $element) {
|
||||||
if ($limit < 5) {
|
if ($limit >= 5) {
|
||||||
if (strpos($element, '</release>') !== false) {
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strpos($element, '</release>') === false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$releasename = ExtractFromDelimiters($element, '<releasename>', '</releasename>');
|
||||||
|
if (empty($releasename)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$id = ExtractFromDelimiters($element, '<id>', '</id>');
|
$id = ExtractFromDelimiters($element, '<id>', '</id>');
|
||||||
$name = ExtractFromDelimiters($element, '<name>', '</name>');
|
$name = ExtractFromDelimiters($element, '<name>', '</name>');
|
||||||
|
@ -50,14 +60,11 @@ class Releases3DSBridge extends BridgeAbstract {
|
||||||
$titleid = ExtractFromDelimiters($element, '<titleid>', '</titleid>');
|
$titleid = ExtractFromDelimiters($element, '<titleid>', '</titleid>');
|
||||||
$imgcrc = ExtractFromDelimiters($element, '<imgcrc>', '</imgcrc>');
|
$imgcrc = ExtractFromDelimiters($element, '<imgcrc>', '</imgcrc>');
|
||||||
$filename = ExtractFromDelimiters($element, '<filename>', '</filename>');
|
$filename = ExtractFromDelimiters($element, '<filename>', '</filename>');
|
||||||
$releasename = ExtractFromDelimiters($element, '<releasename>', '</releasename>');
|
|
||||||
$trimmedsize = ExtractFromDelimiters($element, '<trimmedsize>', '</trimmedsize>');
|
$trimmedsize = ExtractFromDelimiters($element, '<trimmedsize>', '</trimmedsize>');
|
||||||
$firmware = ExtractFromDelimiters($element, '<firmware>', '</firmware>');
|
$firmware = ExtractFromDelimiters($element, '<firmware>', '</firmware>');
|
||||||
$type = ExtractFromDelimiters($element, '<type>', '</type>');
|
$type = ExtractFromDelimiters($element, '<type>', '</type>');
|
||||||
$card = ExtractFromDelimiters($element, '<card>', '</card>');
|
$card = ExtractFromDelimiters($element, '<card>', '</card>');
|
||||||
|
|
||||||
if (!empty($releasename)) {
|
|
||||||
|
|
||||||
//Retrieve cover art and short desc from IGN?
|
//Retrieve cover art and short desc from IGN?
|
||||||
$ignResult = false; $ignDescription = ''; $ignLink = ''; $ignDate = time(); $ignCoverArt = '';
|
$ignResult = false; $ignDescription = ''; $ignLink = ''; $ignDate = time(); $ignCoverArt = '';
|
||||||
$ignSearchUrl = 'http://www.ign.com/search?q='.urlencode($name);
|
$ignSearchUrl = 'http://www.ign.com/search?q='.urlencode($name);
|
||||||
|
@ -109,9 +116,6 @@ class Releases3DSBridge extends BridgeAbstract {
|
||||||
$limit++;
|
$limit++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCacheDuration() {
|
public function getCacheDuration() {
|
||||||
return 10800; //3 hours
|
return 10800; //3 hours
|
||||||
|
|
|
@ -24,7 +24,7 @@ class ReporterreBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(){
|
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;
|
$limit = 0;
|
||||||
|
|
||||||
foreach($html->find('item') as $element) {
|
foreach($html->find('item') as $element) {
|
||||||
|
|
|
@ -15,21 +15,16 @@ class Rule34Bridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$page = 0;$tags='';
|
$html = $this->getSimpleHTMLDOM(
|
||||||
if ($this->getInput('p')) {
|
$this->uri.'index.php?page=post&s=list&'
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
|
.'&pid='.($this->getInput('p')?($this->getInput('p') -1)*50:'')
|
||||||
$page = $page - 1;
|
.'&tags='.urlencode($this->getInput('t'))
|
||||||
$page = $page * 50;
|
) or $this->returnServerError('Could not request Rule34.');
|
||||||
}
|
|
||||||
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.');
|
|
||||||
|
|
||||||
|
|
||||||
foreach($html->find('div[class=content] span') as $element) {
|
foreach($html->find('div[class=content] span') as $element) {
|
||||||
$item = array();
|
$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['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
|
||||||
$item['timestamp'] = time();
|
$item['timestamp'] = time();
|
||||||
$thumbnailUri = $element->find('img', 0)->src;
|
$thumbnailUri = $element->find('img', 0)->src;
|
||||||
|
|
|
@ -16,19 +16,13 @@ class Rule34pahealBridge extends BridgeAbstract{
|
||||||
|
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$page = 0;$tags='';
|
$html = $this->getSimpleHTMLDOM($this->uri.'post/list/'.$tags.'/'.$page)
|
||||||
if ($this->getInput('p')) {
|
or $this->returnServerError('Could not request Rule34paheal.');
|
||||||
$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.');
|
|
||||||
|
|
||||||
|
|
||||||
foreach($html->find('div[class=shm-image-list] div[class=shm-thumb]') as $element) {
|
foreach($html->find('div[class=shm-image-list] div[class=shm-thumb]') as $element) {
|
||||||
$item = array();
|
$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['postid'] = (int)preg_replace("/[^0-9]/",'', $element->find('img', 0)->getAttribute('id'));
|
||||||
$item['timestamp'] = time();
|
$item['timestamp'] = time();
|
||||||
$thumbnailUri = $element->find('img', 0)->src;
|
$thumbnailUri = $element->find('img', 0)->src;
|
||||||
|
|
|
@ -15,21 +15,15 @@ class SafebooruBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$page = 0;$tags='';
|
$html = $this->getSimpleHTMLDOM(
|
||||||
if ($this->getInput('p')) {
|
$this->uri.'index.php?page=post&s=list&'
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
|
.'&pid='.($this->getInput('p')?($this->getInput('p') -1)*40:'')
|
||||||
$page = $page - 1;
|
.'&tags='.urlencode($this->getInput('t'))
|
||||||
$page = $page * 40;
|
) or $this->returnServerError('Could not request Safebooru.');
|
||||||
}
|
|
||||||
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.');
|
|
||||||
|
|
||||||
|
|
||||||
foreach($html->find('div[class=content] span') as $element) {
|
foreach($html->find('div[class=content] span') as $element) {
|
||||||
$item = array();
|
$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['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
|
||||||
$item['timestamp'] = time();
|
$item['timestamp'] = time();
|
||||||
$thumbnailUri = $element->find('img', 0)->src;
|
$thumbnailUri = $element->find('img', 0)->src;
|
||||||
|
|
|
@ -9,20 +9,19 @@ class SakugabooruBridge extends BridgeAbstract{
|
||||||
public $parameters = array( array(
|
public $parameters = array( array(
|
||||||
'p'=>array(
|
'p'=>array(
|
||||||
'name'=>'page',
|
'name'=>'page',
|
||||||
|
'defaultValue'=>1,
|
||||||
'type'=>'number'
|
'type'=>'number'
|
||||||
),
|
),
|
||||||
't'=>array('name'=>'tags')
|
't'=>array('name'=>'tags')
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$page = 1;$tags='';
|
$html = $this->getSimpleHTMLDOM(
|
||||||
if ($this->getInput('p')) {
|
$this->uri.'post?'
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
|
.'&page='.$this->getInput('p')
|
||||||
}
|
.'&tags='.urlencode($this->getInput('t'))
|
||||||
if ($this->getInput('t')) {
|
) or $this->returnServerError('Could not request Sakugabooru.');
|
||||||
$tags = urlencode($this->getInput('t'));
|
|
||||||
}
|
|
||||||
$html = $this->getSimpleHTMLDOM("http://sakuga.yshi.org/post?page=$page&tags=$tags") or $this->returnServerError('Could not request Sakugabooru.');
|
|
||||||
$input_json = explode('Post.register(', $html);
|
$input_json = explode('Post.register(', $html);
|
||||||
foreach($input_json as $element)
|
foreach($input_json as $element)
|
||||||
$data[] = preg_replace('/}\)(.*)/', '}', $element);
|
$data[] = preg_replace('/}\)(.*)/', '}', $element);
|
||||||
|
@ -31,7 +30,7 @@ class SakugabooruBridge extends BridgeAbstract{
|
||||||
foreach($data as $datai) {
|
foreach($data as $datai) {
|
||||||
$json = json_decode($datai, TRUE);
|
$json = json_decode($datai, TRUE);
|
||||||
$item = array();
|
$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['postid'] = $json['id'];
|
||||||
$item['timestamp'] = $json['created_at'];
|
$item['timestamp'] = $json['created_at'];
|
||||||
$item['imageUri'] = $json['file_url'];
|
$item['imageUri'] = $json['file_url'];
|
||||||
|
|
|
@ -8,11 +8,12 @@ class ScmbBridge extends BridgeAbstract{
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$html = '';
|
$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) {
|
foreach($html->find('article') as $article) {
|
||||||
$item = array();
|
$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;
|
$item['title'] = $article->find('header h1 a',0)->innertext;
|
||||||
|
|
||||||
$article->find('span.read-more',0)->outertext=''; // remove text "En savoir plus" from anecdote content
|
$article->find('span.read-more',0)->outertext=''; // remove text "En savoir plus" from anecdote content
|
||||||
|
|
|
@ -3,7 +3,7 @@ class ScoopItBridge extends BridgeAbstract{
|
||||||
|
|
||||||
public $maintainer = "Pitchoule";
|
public $maintainer = "Pitchoule";
|
||||||
public $name = "ScoopIt";
|
public $name = "ScoopIt";
|
||||||
public $uri = "http://www.scoop.it";
|
public $uri = "http://www.scoop.it/";
|
||||||
public $description = "Returns most recent results from ScoopIt.";
|
public $description = "Returns most recent results from ScoopIt.";
|
||||||
|
|
||||||
public $parameters = array( array(
|
public $parameters = array( array(
|
||||||
|
@ -14,12 +14,11 @@ class ScoopItBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$html = '';
|
|
||||||
if ($this->getInput('u') != '') {
|
|
||||||
$this->request = $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) {
|
foreach($html->find('div.post-view') as $element) {
|
||||||
$item = array();
|
$item = array();
|
||||||
|
@ -28,9 +27,6 @@ class ScoopItBridge extends BridgeAbstract{
|
||||||
$item['content'] = preg_replace('~[[:cntrl:]]~', '', $element->find('div.tCustomization_post_description', 0)->plaintext);
|
$item['content'] = preg_replace('~[[:cntrl:]]~', '', $element->find('div.tCustomization_post_description', 0)->plaintext);
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$this->returnServerError('You must specify a keyword');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCacheDuration(){
|
public function getCacheDuration(){
|
||||||
|
|
|
@ -3,7 +3,7 @@ class SensCritiqueBridge extends BridgeAbstract {
|
||||||
|
|
||||||
public $maintainer = "kranack";
|
public $maintainer = "kranack";
|
||||||
public $name = "Sens Critique";
|
public $name = "Sens Critique";
|
||||||
public $uri = "http://www.senscritique.com";
|
public $uri = "http://www.senscritique.com/";
|
||||||
public $description = "Sens Critique news";
|
public $description = "Sens Critique news";
|
||||||
|
|
||||||
public $parameters = array( array(
|
public $parameters = array( array(
|
||||||
|
@ -34,69 +34,25 @@ class SensCritiqueBridge extends BridgeAbstract {
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
if (($this->getInput('m') && $this->getInput('m'))) {
|
$categories=array();
|
||||||
$this->collectMoviesData();
|
foreach($this->parameters[$this->queriedContext] as $category=>$properties){
|
||||||
} else if (($this->getInput('s') && $this->getInput('s'))) {
|
if($this->getInput($category)){
|
||||||
$this->collectSeriesData();
|
$uri=$this->uri;
|
||||||
} else if (($this->getInput('g') && $this->getInput('g'))) {
|
switch($category){
|
||||||
$this->collectGamesData();
|
case 'm': $uri.='films/cette-semaine'; break;
|
||||||
} else if (($this->getInput('b') && $this->getInput('b'))) {
|
case 's': $uri.='series/actualite'; break;
|
||||||
$this->collectBooksData();
|
case 'g': $uri.='jeuxvideo/actualite'; break;
|
||||||
} else if (($this->getInput('bd') && $this->getInput('bd'))) {
|
case 'b': $uri.='livres/actualite'; break;
|
||||||
$this->collectBDsData();
|
case 'bd': $uri.='bd/actualite'; break;
|
||||||
} else if (($this->getInput('mu') && $this->getInput('mu'))) {
|
case 'mu': $uri.='musique/actualite'; break;
|
||||||
$this->collectMusicsData();
|
|
||||||
} else {
|
|
||||||
$this->returnClientError('You must choose a category');
|
|
||||||
}
|
}
|
||||||
}
|
$html = $this->getSimpleHTMLDOM($uri)
|
||||||
|
or $this->returnServerError('No results for this query.');
|
||||||
private function collectMoviesData() {
|
|
||||||
$html = '';
|
|
||||||
$html = $this->getSimpleHTMLDOM('http://www.senscritique.com/films/cette-semaine') or $this->returnServerError('No results for this query.');
|
|
||||||
$list = $html->find('ul.elpr-list', 0);
|
$list = $html->find('ul.elpr-list', 0);
|
||||||
|
|
||||||
$this->extractDataFromList($list);
|
$this->extractDataFromList($list);
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
private function extractDataFromList($list) {
|
||||||
|
|
|
@ -14,8 +14,9 @@ class SiliconBridge extends BridgeAbstract {
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
$feedUrl = 'http://www.silicon.fr/feed';
|
$feedUrl = $this->uri.'feed';
|
||||||
$html = $this->getSimpleHTMLDOM($feedUrl) or $this->returnServerError('Could not request Silicon: '.$feedUrl);
|
$html = $this->getSimpleHTMLDOM($feedUrl)
|
||||||
|
or $this->returnServerError('Could not request Silicon: '.$feedUrl);
|
||||||
$limit = 0;
|
$limit = 0;
|
||||||
|
|
||||||
foreach($html->find('item') as $element) {
|
foreach($html->find('item') as $element) {
|
||||||
|
@ -25,7 +26,8 @@ class SiliconBridge extends BridgeAbstract {
|
||||||
$article_uri = $element->innertext;
|
$article_uri = $element->innertext;
|
||||||
$article_uri = substr($article_uri, strpos($article_uri, '<link>') + 6);
|
$article_uri = substr($article_uri, strpos($article_uri, '<link>') + 6);
|
||||||
$article_uri = substr($article_uri, 0, strpos($article_uri, '</link>'));
|
$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
|
//Build article contents from corresponding elements
|
||||||
$thumbnailUri = $element->find('enclosure', 0)->url;
|
$thumbnailUri = $element->find('enclosure', 0)->url;
|
||||||
|
|
|
@ -3,7 +3,7 @@ class SoundCloudBridge extends BridgeAbstract{
|
||||||
|
|
||||||
public $maintainer = "kranack";
|
public $maintainer = "kranack";
|
||||||
public $name = "Soundcloud Bridge";
|
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 $description = "Returns 10 newest music from user profile";
|
||||||
|
|
||||||
public $parameters = array( array(
|
public $parameters = array( array(
|
||||||
|
@ -33,10 +33,10 @@ class SoundCloudBridge extends BridgeAbstract{
|
||||||
$item['author'] = $tracks[$i]->user->username .' - '. $tracks[$i]->title;
|
$item['author'] = $tracks[$i]->user->username .' - '. $tracks[$i]->title;
|
||||||
$item['title'] = $tracks[$i]->user->username .' - '. $tracks[$i]->title;
|
$item['title'] = $tracks[$i]->user->username .' - '. $tracks[$i]->title;
|
||||||
$item['content'] = '<audio src="'. $tracks[$i]->uri .'/stream?client_id='. self::CLIENT_ID .'">';
|
$item['content'] = '<audio src="'. $tracks[$i]->uri .'/stream?client_id='. self::CLIENT_ID .'">';
|
||||||
$item['id'] = 'https://soundcloud.com/'
|
$item['id'] = $this->uri
|
||||||
. urlencode($this->getInput('u')) .'/'
|
. urlencode($this->getInput('u')) .'/'
|
||||||
. urlencode($tracks[$i]->permalink);
|
. urlencode($tracks[$i]->permalink);
|
||||||
$item['uri'] = 'https://soundcloud.com/'
|
$item['uri'] = $this->uri
|
||||||
. urlencode($this->getInput('u')) .'/'
|
. urlencode($this->getInput('u')) .'/'
|
||||||
. urlencode($tracks[$i]->permalink);
|
. urlencode($tracks[$i]->permalink);
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
|
|
|
@ -6,14 +6,14 @@ class StripeAPIChangeLogBridge extends BridgeAbstract{
|
||||||
public $description = 'Returns the changes made to the stripe.com API';
|
public $description = 'Returns the changes made to the stripe.com API';
|
||||||
|
|
||||||
public function collectData(){
|
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');
|
or $this->returnServerError('No results for Stripe API Changelog');
|
||||||
|
|
||||||
|
|
||||||
foreach($html->find('h3') as $change){
|
foreach($html->find('h3') as $change){
|
||||||
$item=array();
|
$item=array();
|
||||||
$item['title']=trim($change->plaintext);
|
$item['title']=trim($change->plaintext);
|
||||||
$item['uri']='https://stripe.com/docs/upgrades#'.$item['title'];
|
$item['uri']=$this->uri.'#'.$item['title'];
|
||||||
$item['author']='stripe';
|
$item['author']='stripe';
|
||||||
$item['content']=$change->nextSibling()->outertext;
|
$item['content']=$change->nextSibling()->outertext;
|
||||||
$item['timestamp']=strtotime($item['title']);
|
$item['timestamp']=strtotime($item['title']);
|
||||||
|
|
|
@ -1,45 +1,46 @@
|
||||||
<?php
|
<?php
|
||||||
class SuperbWallpapersBridge extends BridgeAbstract {
|
class SuperbWallpapersBridge extends BridgeAbstract {
|
||||||
|
|
||||||
private $category;
|
|
||||||
private $resolution;
|
|
||||||
|
|
||||||
public $maintainer = "nel50n";
|
public $maintainer = "nel50n";
|
||||||
public $name = "Superb Wallpapers Bridge";
|
public $name = "Superb Wallpapers Bridge";
|
||||||
public $uri = "http://www.superbwallpapers.com/";
|
public $uri = "http://www.superbwallpapers.com/";
|
||||||
public $description = "Returns the latests wallpapers from SuperbWallpapers";
|
public $description = "Returns the latests wallpapers from SuperbWallpapers";
|
||||||
|
|
||||||
public $parameters = array( array(
|
public $parameters = array( array(
|
||||||
'c'=>array('name'=>'category'),
|
'c'=>array(
|
||||||
|
'name'=>'category',
|
||||||
|
'required'=>true
|
||||||
|
),
|
||||||
'm'=>array(
|
'm'=>array(
|
||||||
'name'=>'Max number of wallpapers',
|
'name'=>'Max number of wallpapers',
|
||||||
'type'=>'number'
|
'type'=>'number'
|
||||||
),
|
),
|
||||||
'r'=>array(
|
'r'=>array(
|
||||||
'name'=>'resolution',
|
'name'=>'resolution',
|
||||||
'exampleValue'=>'1920x1200, 1680x1050,…'
|
'exampleValue'=>'1920x1200, 1680x1050,…',
|
||||||
|
'defaultValue'=>'1920x1200'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$html = '';
|
$category = $this->getInput('c');
|
||||||
$baseUri = 'http://www.superbwallpapers.com';
|
$resolution = $this->getInput('r'); // Wide wallpaper default
|
||||||
|
|
||||||
$this->category = $this->getInput('c') ?: ''; // All default
|
|
||||||
$this->resolution = $this->getInput('r') ?: '1920x1200'; // Wide wallpaper default
|
|
||||||
|
|
||||||
$num = 0;
|
$num = 0;
|
||||||
$max = $this->getInput('m') ?: 36;
|
$max = $this->getInput('m') ?: 36;
|
||||||
$lastpage = 1;
|
$lastpage = 1;
|
||||||
|
|
||||||
// Get last page number
|
// Get last page number
|
||||||
$link = $baseUri.'/'.$this->category.'/9999.html';
|
$link = $this->uri.'/'.$category.'/9999.html';
|
||||||
$html = $this->getSimpleHTMLDOM($link);
|
$html = $this->getSimpleHTMLDOM($link)
|
||||||
|
or $this->returnServerError('Could not load '.$link);
|
||||||
|
|
||||||
$lastpage = min($html->find('.paging .cpage', 0)->innertext(), ceil($max/36));
|
$lastpage = min($html->find('.paging .cpage', 0)->innertext(), ceil($max/36));
|
||||||
|
|
||||||
for ($page = 1; $page <= $lastpage; $page++) {
|
for ($page = 1; $page <= $lastpage; $page++) {
|
||||||
$link = $baseUri.'/'.$this->category.'/'.$page.'.html';
|
$link = $this->uri.'/'.$category.'/'.$page.'.html';
|
||||||
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM($link)
|
||||||
|
or $this->returnServerError('No results for this query.');
|
||||||
|
|
||||||
foreach($html->find('.wpl .i a') as $element) {
|
foreach($html->find('.wpl .i a') as $element) {
|
||||||
$thumbnail = $element->find('img', 0);
|
$thumbnail = $element->find('img', 0);
|
||||||
|
@ -59,7 +60,7 @@ class SuperbWallpapersBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName(){
|
||||||
return 'HDWallpapers - '.$this->category.' ['.$this->resolution.']';
|
return $this->name .'- '.$this->getInput('c').' ['.$this->getInput('r').']';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCacheDuration(){
|
public function getCacheDuration(){
|
||||||
|
|
|
@ -24,14 +24,11 @@ class T411Bridge extends BridgeAbstract {
|
||||||
} return false;
|
} 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
|
//Retrieve torrent listing from search results, which does not contain torrent description
|
||||||
$url = $this->uri.'torrents/search/?'.$this->getInput('search').'&order=added&type=desc';
|
$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);
|
$results = $html->find('table.results', 0);
|
||||||
if (is_null($results))
|
if (is_null($results))
|
||||||
$this->returnServerError('No results from t411: '.$url);
|
$this->returnServerError('No results from t411: '.$url);
|
||||||
|
@ -41,7 +38,12 @@ class T411Bridge extends BridgeAbstract {
|
||||||
foreach ($results->find('tr') as $element) {
|
foreach ($results->find('tr') as $element) {
|
||||||
|
|
||||||
//Limit total amount of requests and ignore table header
|
//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
|
//Requests are rate-limited
|
||||||
usleep(500000); //So we need to wait (500ms)
|
usleep(500000); //So we need to wait (500ms)
|
||||||
|
@ -52,7 +54,10 @@ class T411Bridge extends BridgeAbstract {
|
||||||
$item_date = strtotime($element->find('dd', 0)->plaintext);
|
$item_date = strtotime($element->find('dd', 0)->plaintext);
|
||||||
|
|
||||||
//Retrieve full description from torrent page
|
//Retrieve full description from torrent page
|
||||||
if ($item_html = $this->getSimpleHTMLDOM($item_uri)) {
|
$item_html = $this->getSimpleHTMLDOM($item_uri);
|
||||||
|
if (!$item_html) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//Retrieve data from page contents
|
//Retrieve data from page contents
|
||||||
$item_desc = $item_html->find('div.description', 0);
|
$item_desc = $item_html->find('div.description', 0);
|
||||||
|
@ -78,6 +83,4 @@ class T411Bridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ class TagBoardBridge extends BridgeAbstract{
|
||||||
|
|
||||||
public $maintainer = "Pitchoule";
|
public $maintainer = "Pitchoule";
|
||||||
public $name = "TagBoard";
|
public $name = "TagBoard";
|
||||||
public $uri = "http://www.TagBoard.com";
|
public $uri = "http://www.TagBoard.com/";
|
||||||
public $description = "Returns most recent results from TagBoard.";
|
public $description = "Returns most recent results from TagBoard.";
|
||||||
|
|
||||||
public $parameters = array( array(
|
public $parameters = array( array(
|
||||||
|
@ -14,11 +14,10 @@ class TagBoardBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$html = '';
|
$link = 'https://post-cache.tagboard.com/search/' .$this->getInput('u');
|
||||||
$this->request = $this->getInput('u');
|
|
||||||
$link = 'https://post-cache.tagboard.com/search/' .$this->request;
|
|
||||||
|
|
||||||
$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);
|
$parsed_json = json_decode($html);
|
||||||
|
|
||||||
foreach($parsed_json->{'posts'} as $element) {
|
foreach($parsed_json->{'posts'} as $element) {
|
||||||
|
@ -36,7 +35,7 @@ class TagBoardBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName(){
|
||||||
return 'tagboard - ' .$this->request;
|
return 'tagboard - ' .$this->getInput('u');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCacheDuration(){
|
public function getCacheDuration(){
|
||||||
|
|
|
@ -15,21 +15,16 @@ class TbibBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$page = 0;$tags='';
|
$html = $this->getSimpleHTMLDOM(
|
||||||
if ($this->getInput('p')) {
|
$this->uri.'index.php?page=post&s=list&'
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
|
.'&pid='.($this->getInput('p')?($this->getInput('p') -1)*50:'')
|
||||||
$page = $page - 1;
|
.'&tags='.urlencode($this->getInput('t'))
|
||||||
$page = $page * 50;
|
) or $this->returnServerError('Could not request Tbib.');
|
||||||
}
|
|
||||||
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.');
|
|
||||||
|
|
||||||
|
|
||||||
foreach($html->find('div[class=content] span') as $element) {
|
foreach($html->find('div[class=content] span') as $element) {
|
||||||
$item = array();
|
$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['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
|
||||||
$item['timestamp'] = time();
|
$item['timestamp'] = time();
|
||||||
$thumbnailUri = $element->find('img', 0)->src;
|
$thumbnailUri = $element->find('img', 0)->src;
|
||||||
|
|
|
@ -7,7 +7,8 @@ class TheCodingLoveBridge extends BridgeAbstract{
|
||||||
public $description = "The Coding Love";
|
public $description = "The Coding Love";
|
||||||
|
|
||||||
public function collectData(){
|
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) {
|
foreach($html->find('div.post') as $element) {
|
||||||
$item = array();
|
$item = array();
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
define("THE_OATMEAL", "http://theoatmeal.com/");
|
|
||||||
define("THE_OATMEAL_RSS", "http://feeds.feedburner.com/oatmealfeed");
|
|
||||||
|
|
||||||
class TheOatmealBridge extends RssExpander{
|
class TheOatmealBridge extends RssExpander{
|
||||||
|
|
||||||
public $maintainer = "Riduidel";
|
public $maintainer = "Riduidel";
|
||||||
|
@ -10,7 +7,7 @@ class TheOatmealBridge extends RssExpander{
|
||||||
public $description = "Un petit site de dessins assez rigolos";
|
public $description = "Un petit site de dessins assez rigolos";
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
parent::collectExpandableDatas(THE_OATMEAL_RSS);
|
$this->collectExpandableDatas('http://feeds.feedburner.com/oatmealfeed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,8 @@ class ThePirateBayBridge extends BridgeAbstract{
|
||||||
public $parameters = array( array(
|
public $parameters = array( array(
|
||||||
'q'=>array(
|
'q'=>array(
|
||||||
'name'=>'keywords, separated by semicolons',
|
'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'));
|
$keywordsList = explode(";",$this->getInput('q'));
|
||||||
foreach($keywordsList as $keywords){
|
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)
|
if ($html->find('table#searchResult', 0) == FALSE)
|
||||||
$this->returnServerError('No result for query '.$keywords);
|
$this->returnServerError('No result for query '.$keywords);
|
||||||
|
@ -62,7 +61,7 @@ class ThePirateBayBridge extends BridgeAbstract{
|
||||||
|
|
||||||
foreach($html->find('tr') as $element) {
|
foreach($html->find('tr') as $element) {
|
||||||
$item = array();
|
$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['id'] = $item['uri'];
|
||||||
$item['timestamp'] = parseDateTimestamp($element);
|
$item['timestamp'] = parseDateTimestamp($element);
|
||||||
$item['title'] = $element->find('a.detLink',0)->plaintext;
|
$item['title'] = $element->find('a.detLink',0)->plaintext;
|
||||||
|
|
|
@ -39,11 +39,9 @@ class TwitchApiBridge extends BridgeAbstract{
|
||||||
|
|
||||||
$context = stream_context_create($opts);
|
$context = stream_context_create($opts);
|
||||||
|
|
||||||
if(!$this->getInput('limit') ||
|
$limit = $this->getInput('limit');
|
||||||
empty($this->getInput('limit'))){
|
if(!$limit){
|
||||||
$limit = TWITCH_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.
|
// 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.
|
||||||
|
|
|
@ -86,7 +86,7 @@ class TwitterBridge extends BridgeAbstract{
|
||||||
// get TweetID
|
// get TweetID
|
||||||
$item['id'] = $tweet->getAttribute('data-tweet-id');
|
$item['id'] = $tweet->getAttribute('data-tweet-id');
|
||||||
// get tweet link
|
// 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
|
// extract tweet timestamp
|
||||||
$item['timestamp'] = $tweet->find('span.js-short-timestamp', 0)->getAttribute('data-time');
|
$item['timestamp'] = $tweet->find('span.js-short-timestamp', 0)->getAttribute('data-time');
|
||||||
// generate the title
|
// generate the title
|
||||||
|
@ -111,7 +111,7 @@ class TwitterBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
// get tweet text
|
// 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
|
// Add picture to content
|
||||||
$picture_html = '';
|
$picture_html = '';
|
||||||
|
|
|
@ -9,32 +9,32 @@ class UnsplashBridge extends BridgeAbstract {
|
||||||
public $parameters = array( array(
|
public $parameters = array( array(
|
||||||
'm'=>array(
|
'm'=>array(
|
||||||
'name'=>'Max number of photos',
|
'name'=>'Max number of photos',
|
||||||
'type'=>'number'
|
'type'=>'number',
|
||||||
|
'defaultValue'=>20
|
||||||
),
|
),
|
||||||
'w'=>array(
|
'w'=>array(
|
||||||
'name'=>'Width',
|
'name'=>'Width',
|
||||||
'exampleValue'=>'1920, 1680, …'
|
'exampleValue'=>'1920, 1680, …',
|
||||||
|
'defaultValue'=>'1920'
|
||||||
),
|
),
|
||||||
'q'=>array(
|
'q'=>array(
|
||||||
'name'=>'JPEG quality',
|
'name'=>'JPEG quality',
|
||||||
'type'=>'number'
|
'type'=>'number',
|
||||||
|
'defaultValue'=>75
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$html = '';
|
$width = $this->getInput('w') ;
|
||||||
$baseUri = 'http://unsplash.com';
|
|
||||||
|
|
||||||
$width = $this->getInput('w') ?: '1920'; // Default width
|
|
||||||
|
|
||||||
$num = 0;
|
$num = 0;
|
||||||
$max = $this->getInput('m') ?: 20;
|
$max = $this->getInput('m');
|
||||||
$quality = $this->getInput('q') ?: 75;
|
$quality = $this->getInput('q');
|
||||||
$lastpage = 1;
|
$lastpage = 1;
|
||||||
|
|
||||||
for ($page = 1; $page <= $lastpage; $page++) {
|
for ($page = 1; $page <= $lastpage; $page++) {
|
||||||
$link = $baseUri.'/grid?page='.$page;
|
$link = $this->uri.'/grid?page='.$page;
|
||||||
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM($link)
|
||||||
|
or $this->returnServerError('No results for this query.');
|
||||||
|
|
||||||
if ($page === 1) {
|
if ($page === 1) {
|
||||||
preg_match('/=(\d+)$/', $html->find('.pagination > a[!class]', -1)->href, $matches);
|
preg_match('/=(\d+)$/', $html->find('.pagination > a[!class]', -1)->href, $matches);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
class ViadeoCompany extends BridgeAbstract{
|
class ViadeoCompanyBridge extends BridgeAbstract{
|
||||||
|
|
||||||
public $maintainer = "regisenguehard";
|
public $maintainer = "regisenguehard";
|
||||||
public $name = "Viadeo Company";
|
public $name = "Viadeo Company";
|
||||||
|
@ -15,9 +15,10 @@ class ViadeoCompany extends BridgeAbstract{
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$html = '';
|
$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) {
|
foreach($html->find('//*[@id="company-newsfeed"]/ul/li') as $element) {
|
||||||
$title = $element->find('p', 0)->innertext;
|
$title = $element->find('p', 0)->innertext;
|
|
@ -15,9 +15,10 @@ class VineBridge extends BridgeAbstract {
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$html = '';
|
$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) {
|
foreach($html->find('.post') as $element) {
|
||||||
$a = $element->find('a', 0);
|
$a = $element->find('a', 0);
|
||||||
|
|
|
@ -4,7 +4,7 @@ class VkBridge extends BridgeAbstract {
|
||||||
|
|
||||||
public $maintainer = "ahiles3005";
|
public $maintainer = "ahiles3005";
|
||||||
public $name = "VK.com";
|
public $name = "VK.com";
|
||||||
public $uri = "http://www.vk.com/";
|
public $uri = "http://vk.com/";
|
||||||
public $description = "Working with open pages";
|
public $description = "Working with open pages";
|
||||||
public $parameters=array(
|
public $parameters=array(
|
||||||
'Url on page group or user' => array(
|
'Url on page group or user' => array(
|
||||||
|
@ -16,13 +16,10 @@ class VkBridge extends BridgeAbstract {
|
||||||
);
|
);
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$html = '';
|
$text_html = $this->getContents(urldecode($this->getInput('u')))
|
||||||
if ($this->getInput('u')) {
|
|
||||||
$text_html = $this->getSimpleHTMLDOM(urldecode($this->getInput('u')))
|
|
||||||
or $this->returnServerError('No results for this query.');
|
or $this->returnServerError('No results for this query.');
|
||||||
$text_html = iconv('windows-1251', 'utf-8', $text_html);
|
$text_html = iconv('windows-1251', 'utf-8', $text_html);
|
||||||
$html = str_get_html($text_html);
|
$html = str_get_html($text_html);
|
||||||
}
|
|
||||||
foreach ($html->find('div.post_table') as $post) {
|
foreach ($html->find('div.post_table') as $post) {
|
||||||
if (is_object($post->find('a.wall_post_more', 0))) {
|
if (is_object($post->find('a.wall_post_more', 0))) {
|
||||||
$post->find('a.wall_post_more', 0)->outertext = ''; //delete link "show full" in content
|
$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
|
//get video on post
|
||||||
if (is_object($post->find('span.post_video_title_content', 0))) {
|
if (is_object($post->find('span.post_video_title_content', 0))) {
|
||||||
$titleVideo = $post->find('span.post_video_title_content', 0)->plaintext;
|
$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['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;
|
$item['date'] = $post->find('span.rel_date', 0)->plaintext;
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
// var_dump($item['date']);
|
// var_dump($item['date']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName() {
|
|
||||||
return(isset($this->name) ? $this->name . ' - ' : '') . 'VK Bridge';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCacheDuration() {
|
public function getCacheDuration() {
|
||||||
return 300; // 5 minutes
|
return 300; // 5 minutes
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
class WallpaperStopBridge extends BridgeAbstract {
|
class WallpaperStopBridge extends BridgeAbstract {
|
||||||
|
|
||||||
private $category;
|
|
||||||
private $subcategory;
|
|
||||||
private $resolution;
|
|
||||||
|
|
||||||
public $maintainer = "nel50n";
|
public $maintainer = "nel50n";
|
||||||
public $name = "WallpaperStop Bridge";
|
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 $description = "Returns the latests wallpapers from WallpaperStop";
|
||||||
|
|
||||||
public $parameters = array( array(
|
public $parameters = array( array(
|
||||||
|
@ -15,33 +11,30 @@ class WallpaperStopBridge extends BridgeAbstract {
|
||||||
's'=>array('name'=>'subcategory'),
|
's'=>array('name'=>'subcategory'),
|
||||||
'm'=>array(
|
'm'=>array(
|
||||||
'name'=>'Max number of wallpapers',
|
'name'=>'Max number of wallpapers',
|
||||||
'type'=>'number'
|
'type'=>'number',
|
||||||
|
'defaultValue'=>20
|
||||||
),
|
),
|
||||||
'r'=>array(
|
'r'=>array(
|
||||||
'name'=>'resolution',
|
'name'=>'resolution',
|
||||||
'exampleValue'=>'1920x1200, 1680x1050,…',
|
'exampleValue'=>'1920x1200, 1680x1050,…',
|
||||||
|
'defaultValue'=>'1920x1200'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$html = '';
|
$category = $this->getInput('c');
|
||||||
if (!$this->getInput('c')) {
|
$subcategory = $this->getInput('s');
|
||||||
$this->returnClientError('You must specify at least a category (?c=...).');
|
$resolution = $this->getInput('r');
|
||||||
} 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
|
|
||||||
|
|
||||||
$num = 0;
|
$num = 0;
|
||||||
$max = $this->getInput('m') ?: 20;
|
$max = $this->getInput('m');
|
||||||
$lastpage = 1;
|
$lastpage = 1;
|
||||||
|
|
||||||
for ($page = 1; $page <= $lastpage; $page++) {
|
for ($page = 1; $page <= $lastpage; $page++) {
|
||||||
$link = $baseUri.'/'.$this->category.'-wallpaper/'.(!empty($this->subcategory)?$this->subcategory.'-wallpaper/':'').'desktop-wallpaper-'.$page.'.html';
|
$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.');
|
$html = $this->getSimpleHTMLDOM($link)
|
||||||
|
or $this->returnServerError('No results for this query.');
|
||||||
|
|
||||||
if ($page === 1) {
|
if ($page === 1) {
|
||||||
preg_match('/-(\d+)\.html$/', $html->find('.pagination > .last', 0)->href, $matches);
|
preg_match('/-(\d+)\.html$/', $html->find('.pagination > .last', 0)->href, $matches);
|
||||||
|
@ -50,29 +43,27 @@ class WallpaperStopBridge extends BridgeAbstract {
|
||||||
|
|
||||||
foreach($html->find('article.item') as $element) {
|
foreach($html->find('article.item') as $element) {
|
||||||
$wplink = $element->getAttribute('data-permalink');
|
$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);
|
$thumbnail = $element->find('img', 0);
|
||||||
|
|
||||||
$item = array();
|
$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['id'] = $matches[3];
|
||||||
$item['timestamp'] = time();
|
$item['timestamp'] = time();
|
||||||
$item['title'] = $thumbnail->title;
|
$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;
|
$this->items[] = $item;
|
||||||
|
|
||||||
$num++;
|
$num++;
|
||||||
if ($num >= $max)
|
if ($num >= $max)
|
||||||
break 2;
|
break 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
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(){
|
public function getCacheDuration(){
|
||||||
|
|
|
@ -13,6 +13,8 @@ class WhydBridge extends BridgeAbstract{
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
private $userName='';
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$html = '';
|
$html = '';
|
||||||
if (strlen(preg_replace("/[^0-9a-f]/",'', $this->getInput('u'))) == 24){
|
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++) {
|
for($i = 0; $i < 10; $i++) {
|
||||||
$track = $html->find('div.post', $i);
|
$track = $html->find('div.post', $i);
|
||||||
|
@ -42,13 +44,13 @@ class WhydBridge extends BridgeAbstract{
|
||||||
$item['author'] = $track->find('h2', 0)->plaintext;
|
$item['author'] = $track->find('h2', 0)->plaintext;
|
||||||
$item['title'] = $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['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['id'] = $this->uri . $track->find('a.no-ajaxy',0)->getAttribute('href');
|
||||||
$item['uri'] = 'http://www.whyd.com' . $track->find('a.no-ajaxy',0)->getAttribute('href');
|
$item['uri'] = $this->uri . $track->find('a.no-ajaxy',0)->getAttribute('href');
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public function getName(){
|
public function getName(){
|
||||||
return (!empty($this->name) ? $this->name .' - ' : '') .'Whyd Bridge';
|
return (!empty($this->userName) ? $this->userName .' - ' : '') .'Whyd Bridge';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCacheDuration(){
|
public function getCacheDuration(){
|
||||||
|
|
|
@ -26,12 +26,10 @@ class WorldOfTanksBridge extends HttpCachingBridgeAbstract{
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
function getURI(){
|
private $title='';
|
||||||
$lang='fr';
|
|
||||||
if (!empty($this->getInput('lang'))) {
|
|
||||||
$lang = $this->getInput('lang');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
function getURI(){
|
||||||
|
$lang = $this->getInput('lang');
|
||||||
$uri = $this->uri.$lang.'/news/';
|
$uri = $this->uri.$lang.'/news/';
|
||||||
if(!empty($this->getInput('category'))) {
|
if(!empty($this->getInput('category'))) {
|
||||||
$uri .= 'pc-browser/'.$this->getInput('category')."/";
|
$uri .= 'pc-browser/'.$this->getInput('category')."/";
|
||||||
|
@ -39,11 +37,16 @@ class WorldOfTanksBridge extends HttpCachingBridgeAbstract{
|
||||||
return $uri;
|
return $uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getName(){
|
||||||
|
return $this->title?:$this->name;
|
||||||
|
}
|
||||||
|
|
||||||
public function collectData(){
|
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());
|
$this->debugMessage("loaded HTML from ".$this->getURI());
|
||||||
// customize name
|
// customize name
|
||||||
$this->name = $html->find('title', 0)->innertext;
|
$this->title = $html->find('title', 0)->innertext;
|
||||||
foreach($html->find('.b-imgblock_ico') as $infoLink) {
|
foreach($html->find('.b-imgblock_ico') as $infoLink) {
|
||||||
$this->parseLine($infoLink);
|
$this->parseLine($infoLink);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,21 +15,16 @@ class XbooruBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$page = 0;$tags='';
|
$html = $this->getSimpleHTMLDOM(
|
||||||
if ($this->getInput('p')) {
|
$this->uri.'index.php?page=post&s=list&'
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
|
.'&pid='.($this->getInput('p')?($this->getInput('p') -1)*50:'')
|
||||||
$page = $page - 1;
|
.'&tags='.urlencode($this->getInput('t'))
|
||||||
$page = $page * 50;
|
) or $this->returnServerError('Could not request Xbooru.');
|
||||||
}
|
|
||||||
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.');
|
|
||||||
|
|
||||||
|
|
||||||
foreach($html->find('div[class=content] span') as $element) {
|
foreach($html->find('div[class=content] span') as $element) {
|
||||||
$item = array();
|
$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['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
|
||||||
$item['timestamp'] = time();
|
$item['timestamp'] = time();
|
||||||
$thumbnailUri = $element->find('img', 0)->src;
|
$thumbnailUri = $element->find('img', 0)->src;
|
||||||
|
|
|
@ -9,20 +9,19 @@ class YandereBridge extends BridgeAbstract{
|
||||||
public $parameters = array( array(
|
public $parameters = array( array(
|
||||||
'p'=>array(
|
'p'=>array(
|
||||||
'name'=>'page',
|
'name'=>'page',
|
||||||
'type'=>'number'
|
'type'=>'number',
|
||||||
|
'defaultValue'=>1
|
||||||
),
|
),
|
||||||
't'=>array('name'=>'tags')
|
't'=>array('name'=>'tags')
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$page = 1; $tags = '';
|
$html = $this->getSimpleHTMLDOM(
|
||||||
if ($this->getInput('p')) {
|
$this->uri.'post?'
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
|
.'&page='.$this->getInput('p')
|
||||||
}
|
.'&tags='.urlencode($this->getInput('t'))
|
||||||
if ($this->getInput('t')) {
|
) or $this->returnServerError('Could not request Yander.');
|
||||||
$tags = urlencode($this->getInput('t'));
|
|
||||||
}
|
|
||||||
$html = $this->getSimpleHTMLDOM("https://yande.re/post?page=$page&tags=$tags") or $this->returnServerError('Could not request Yandere.');
|
|
||||||
$input_json = explode('Post.register(', $html);
|
$input_json = explode('Post.register(', $html);
|
||||||
foreach($input_json as $element)
|
foreach($input_json as $element)
|
||||||
$data[] = preg_replace('/}\)(.*)/', '}', $element);
|
$data[] = preg_replace('/}\)(.*)/', '}', $element);
|
||||||
|
@ -31,7 +30,7 @@ class YandereBridge extends BridgeAbstract{
|
||||||
foreach($data as $datai) {
|
foreach($data as $datai) {
|
||||||
$json = json_decode($datai, TRUE);
|
$json = json_decode($datai, TRUE);
|
||||||
$item = array();
|
$item = array();
|
||||||
$item['uri'] = 'http://yande.re/post/show/'.$json['id'];
|
$item['uri'] = $this->uri.'post/show/'.$json['id'];
|
||||||
$item['postid'] = $json['id'];
|
$item['postid'] = $json['id'];
|
||||||
$item['timestamp'] = $json['created_at'];
|
$item['timestamp'] = $json['created_at'];
|
||||||
$item['imageUri'] = $json['file_url'];
|
$item['imageUri'] = $json['file_url'];
|
||||||
|
|
|
@ -207,16 +207,12 @@ class ZDNetBridge extends BridgeAbstract {
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
$baseUri = $this->getURI();
|
$baseUri = $this->uri;
|
||||||
$feed = $this->getInput('feed');
|
$feed = $this->getInput('feed');
|
||||||
if (empty($feed))
|
|
||||||
$this->returnClientError('Please select a feed to display.');
|
|
||||||
if (strpos($feed, 'downloads!') !== false) {
|
if (strpos($feed, 'downloads!') !== false) {
|
||||||
$feed = str_replace('downloads!', '', $feed);
|
$feed = str_replace('downloads!', '', $feed);
|
||||||
$baseUri = str_replace('www.', 'downloads.', $baseUri);
|
$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';
|
$url = $baseUri.trim($feed, '/').'/rss.xml';
|
||||||
$html = $this->getSimpleHTMLDOM($url) or $this->returnServerError('Could not request ZDNet: '.$url);
|
$html = $this->getSimpleHTMLDOM($url) or $this->returnServerError('Could not request ZDNet: '.$url);
|
||||||
$limit = 0;
|
$limit = 0;
|
||||||
|
|
Loading…
Reference in a new issue