[core + bridges] add BridgeAbstract::$inputs and BridgeAbstract::getInput()
Inputs are not stored in BridgeAbstract::$parameters anymore to separate static data from dynamic data. The getInput method allows for more readable code. Also fix an "undefined index 'global'" notice Probability of breaking bridges: high ! Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
a4fd7b8b98
commit
1b3c8a8aeb
78 changed files with 303 additions and 385 deletions
|
@ -22,14 +22,8 @@ class AllocineFRBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$params=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
// Check all parameters
|
|
||||||
if(!isset($params['category']['value']))
|
|
||||||
$this->returnClientError('You must specify a valid category (&category= )!');
|
|
||||||
|
|
||||||
$category = '';
|
$category = '';
|
||||||
switch($params['category']['value']){
|
switch($this->getInput('category')){
|
||||||
case 'faux-raccord':
|
case 'faux-raccord':
|
||||||
$this->uri = 'http://www.allocine.fr/video/programme-12284/saison-24580/';
|
$this->uri = 'http://www.allocine.fr/video/programme-12284/saison-24580/';
|
||||||
$category = 'Faux Raccord';
|
$category = 'Faux Raccord';
|
||||||
|
|
|
@ -21,13 +21,12 @@ class AnimeUltimeBridge extends BridgeAbstract {
|
||||||
private $filter = 'Releases';
|
private $filter = 'Releases';
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
//Add type filter if provided
|
//Add type filter if provided
|
||||||
$typeFilter = '';
|
$typeFilter = '';
|
||||||
if (!empty($param['type']['value'])) {
|
if (!empty($this->getInput('type'))) {
|
||||||
if ($param['type']['value'] == 'A' || $param['type']['value'] == 'D' || $param['type']['value'] == 'T') {
|
if ($this->getInput('type') == 'A' || $this->getInput('type') == 'D' || $this->getInput('type') == 'T') {
|
||||||
$typeFilter = $param['type']['value'];
|
$typeFilter = $this->getInput('type');
|
||||||
if ($typeFilter == 'A') { $this->filter = 'Anime'; }
|
if ($typeFilter == 'A') { $this->filter = 'Anime'; }
|
||||||
if ($typeFilter == 'D') { $this->filter = 'Drama'; }
|
if ($typeFilter == 'D') { $this->filter = 'Drama'; }
|
||||||
if ($typeFilter == 'T') { $this->filter = 'Tokusatsu'; }
|
if ($typeFilter == 'T') { $this->filter = 'Tokusatsu'; }
|
||||||
|
|
|
@ -60,13 +60,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
$category='toutes-les-videos'; $lang='fr';
|
$category='toutes-les-videos'; $lang='fr';
|
||||||
if (!empty($param['catfr']['value']))
|
if (!empty($this->getInput('catfr')))
|
||||||
$category=$param['catfr']['value'];
|
$category=$this->getInput('catfr');
|
||||||
if (!empty($param['catde']['value']))
|
if (!empty($this->getInput('catde')))
|
||||||
{ $category=$param['catde']['value']; $lang='de'; }
|
{ $category=$this->getInput('catde'); $lang='de'; }
|
||||||
$input_json = $this->extractVideoset($category, $lang);
|
$input_json = $this->extractVideoset($category, $lang);
|
||||||
|
|
||||||
foreach($input_json['videos'] as $element) {
|
foreach($input_json['videos'] as $element) {
|
||||||
|
|
|
@ -15,10 +15,9 @@ class AskfmBridge extends BridgeAbstract{
|
||||||
);
|
);
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = '';
|
$html = '';
|
||||||
if (isset($param['u']['value'])) {
|
if (isset($this->getInput('u'))) {
|
||||||
$this->request = $param['u']['value'];
|
$this->request = $this->getInput('u');
|
||||||
$html = $this->getSimpleHTMLDOM('http://ask.fm/'.urlencode($this->request).'/answers/more?page=0') or $this->returnServerError('Requested username can\'t be found.');
|
$html = $this->getSimpleHTMLDOM('http://ask.fm/'.urlencode($this->request).'/answers/more?page=0') or $this->returnServerError('Requested username can\'t be found.');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -13,10 +13,9 @@ class BandcampBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = '';
|
$html = '';
|
||||||
if (isset($param['tag']['value'])) {
|
if (isset($this->getInput('tag'))) {
|
||||||
$html = $this->getSimpleHTMLDOM('http://bandcamp.com/tag/'.urlencode($param['tag']['value']).'?sort_field=date') or $this->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM('http://bandcamp.com/tag/'.urlencode($this->getInput('tag')).'?sort_field=date') or $this->returnServerError('No results for this query.');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->returnClientError('You must specify tag (/tag/...)');
|
$this->returnClientError('You must specify tag (/tag/...)');
|
||||||
|
@ -38,9 +37,8 @@ class BandcampBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
return (!empty($param['tag']['value']) ? $param['tag']['value'] .' - ' : '') .'Bandcamp Tag';
|
return (!empty($this->getInput('tag')) ? $this->getInput('tag') .' - ' : '') .'Bandcamp Tag';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCacheDuration(){
|
public function getCacheDuration(){
|
||||||
|
|
|
@ -17,29 +17,28 @@ class BooruprojectBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$page = 0; $tags = '';
|
$page = 0; $tags = '';
|
||||||
if (!empty($param['p']['value'])) {
|
if (!empty($this->getInput('p'))) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
|
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
|
||||||
$page = $page - 1;
|
$page = $page - 1;
|
||||||
$page = $page * 20;
|
$page = $page * 20;
|
||||||
}
|
}
|
||||||
if (!empty($param['t']['value'])) {
|
if (!empty($this->getInput('t'))) {
|
||||||
$tags = '&tags='.urlencode($param['t']['value']);
|
$tags = '&tags='.urlencode($this->getInput('t'));
|
||||||
}
|
}
|
||||||
if (empty($param['i']['value'])) {
|
if (empty($this->getInput('i'))) {
|
||||||
$this->returnServerError('Please enter a ***.booru.org instance.');
|
$this->returnServerError('Please enter a ***.booru.org instance.');
|
||||||
}
|
}
|
||||||
$html = $this->getSimpleHTMLDOM("http://".$param['i']['value'].".booru.org/index.php?page=post&s=list&pid=".$page.$tags) or $this->returnServerError('Could not request Booruproject.');
|
$html = $this->getSimpleHTMLDOM("http://".$this->getInput('i').".booru.org/index.php?page=post&s=list&pid=".$page.$tags) or $this->returnServerError('Could not request Booruproject.');
|
||||||
|
|
||||||
|
|
||||||
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://'.$param['i']['value'].'.booru.org/'.$element->find('a', 0)->href;
|
$item['uri'] = 'http://'.$this->getInput('i').'.booru.org/'.$element->find('a', 0)->href;
|
||||||
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->find('a', 0)->getAttribute('id'));
|
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->find('a', 0)->getAttribute('id'));
|
||||||
$item['timestamp'] = time();
|
$item['timestamp'] = time();
|
||||||
$item['tags'] = $element->find('img', 0)->getAttribute('title');
|
$item['tags'] = $element->find('img', 0)->getAttribute('title');
|
||||||
$item['title'] = 'Booruproject '.$param['i']['value'].' | '.$item['postid'];
|
$item['title'] = 'Booruproject '.$this->getInput('i').' | '.$item['postid'];
|
||||||
$item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $element->find('img', 0)->src . '" /></a><br>Tags: '.$item['tags'];
|
$item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $element->find('img', 0)->src . '" /></a><br>Tags: '.$item['tags'];
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ class CNETBridge extends BridgeAbstract {
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
function ExtractFromDelimiters($string, $start, $end) {
|
function ExtractFromDelimiters($string, $start, $end) {
|
||||||
if (strpos($string, $start) !== false) {
|
if (strpos($string, $start) !== false) {
|
||||||
|
@ -38,7 +37,7 @@ class CNETBridge extends BridgeAbstract {
|
||||||
return $article_html;
|
return $article_html;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pageUrl = 'http://www.cnet.com/'.(empty($param['topic']['value']) ? '' : 'topics/'.$param['topic']['value'].'/');
|
$pageUrl = 'http://www.cnet.com/'.(empty($this->getInput('topic')) ? '' : 'topics/'.$this->getInput('topic').'/');
|
||||||
$html = $this->getSimpleHTMLDOM($pageUrl) or $this->returnServerError('Could not request CNET: '.$pageUrl);
|
$html = $this->getSimpleHTMLDOM($pageUrl) or $this->returnServerError('Could not request CNET: '.$pageUrl);
|
||||||
$limit = 0;
|
$limit = 0;
|
||||||
|
|
||||||
|
@ -70,8 +69,7 @@ class CNETBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName() {
|
public function getName() {
|
||||||
$param=$this->parameters[$this->queriedContext];
|
return 'CNET News Bridge'.(empty($this->getInput('topic')) ? '' : ' - '.$this->param['topic']['value']);
|
||||||
return 'CNET News Bridge'.(empty($param['topic']['value']) ? '' : ' - '.$this->param['topic']['value']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCacheDuration() {
|
public function getCacheDuration() {
|
||||||
|
|
|
@ -74,12 +74,11 @@ class CastorusBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$params=$this->parameters[$this->queriedContext];
|
if(isset($this->getInput('zip')))
|
||||||
if(isset($params['zip']['value']))
|
$zip_filter = trim($this->getInput('zip'));
|
||||||
$zip_filter = trim($params['zip']['value']);
|
|
||||||
|
|
||||||
if(isset($params['city']['value']))
|
if(isset($this->getInput('city')))
|
||||||
$city_filter = trim($params['city']['value']);
|
$city_filter = trim($this->getInput('city'));
|
||||||
|
|
||||||
$html = $this->getSimpleHTMLDOM($this->uri);
|
$html = $this->getSimpleHTMLDOM($this->uri);
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,9 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = '';
|
$html = '';
|
||||||
if (isset($param['q']['value'])) { /* keyword search mode */
|
if (isset($this->getInput('q'))) { /* keyword search mode */
|
||||||
$request = str_replace(" ","-",trim($param['q']['value']));
|
$request = str_replace(" ","-",trim($this->getInput('q')));
|
||||||
$html = $this->getSimpleHTMLDOM($this->uri.'/recherche/'.urlencode($request).'.html') or $this->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM($this->uri.'/recherche/'.urlencode($request).'.html') or $this->returnServerError('No results for this query.');
|
||||||
} else {
|
} else {
|
||||||
$this->returnClientError('You must specify a keyword (?q=...).');
|
$this->returnClientError('You must specify a keyword (?q=...).');
|
||||||
|
|
|
@ -15,7 +15,6 @@ class CryptomeBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = '';
|
$html = '';
|
||||||
$num = 20;
|
$num = 20;
|
||||||
$link = 'http://cryptome.org/';
|
$link = 'http://cryptome.org/';
|
||||||
|
@ -23,8 +22,8 @@ class CryptomeBridge extends BridgeAbstract{
|
||||||
//$link = 'https://secure.netsolhost.com/cryptome.org/';
|
//$link = 'https://secure.netsolhost.com/cryptome.org/';
|
||||||
|
|
||||||
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request Cryptome.');
|
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request Cryptome.');
|
||||||
if (!empty($param['n']['value'])) { /* number of documents */
|
if (!empty($this->getInput('n'))) { /* number of documents */
|
||||||
$num = min(max(1, $param['n']['value']+0), $num);
|
$num = min(max(1, $this->getInput('n')+0), $num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -68,16 +68,15 @@ class DailymotionBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
switch($this->queriedContext){
|
switch($this->queriedContext){
|
||||||
case 'By username':
|
case 'By username':
|
||||||
$specific=$param['u']['value'];
|
$specific=$this->getInput('u');
|
||||||
break;
|
break;
|
||||||
case 'By playlist id':
|
case 'By playlist id':
|
||||||
$specific=strtok($param['p']['value'], '_');
|
$specific=strtok($this->getInput('p'), '_');
|
||||||
break;
|
break;
|
||||||
case 'From search results':
|
case 'From search results':
|
||||||
$specific=$param['s']['value'];
|
$specific=$this->getInput('s');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,21 +84,20 @@ class DailymotionBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getURI(){
|
public function getURI(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
switch($this->queriedContext){
|
switch($this->queriedContext){
|
||||||
case 'By username':
|
case 'By username':
|
||||||
$uri='http://www.dailymotion.com/user/'
|
$uri='http://www.dailymotion.com/user/'
|
||||||
.urlencode($param['u']['value']).'/1';
|
.urlencode($this->getInput('u')).'/1';
|
||||||
break;
|
break;
|
||||||
case 'By playlist id':
|
case 'By playlist id':
|
||||||
$uri='http://www.dailymotion.com/playlist/'
|
$uri='http://www.dailymotion.com/playlist/'
|
||||||
.urlencode(strtok($param['p']['value'], '_'));
|
.urlencode(strtok($this->getInput('p'), '_'));
|
||||||
break;
|
break;
|
||||||
case 'From search results':
|
case 'From search results':
|
||||||
$uri='http://www.dailymotion.com/search/'
|
$uri='http://www.dailymotion.com/search/'
|
||||||
.urlencode($param['s']['value']);
|
.urlencode($this->getInput('s'));
|
||||||
if(isset($param['pa']['value'])){
|
if(isset($this->getInput('pa'))){
|
||||||
$uri.='/'.$param['pa']['value'];
|
$uri.='/'.$this->getInput('pa');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,13 +12,12 @@ class DanbooruBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$page = 1;$tags='';
|
$page = 1;$tags='';
|
||||||
if (isset($param['p']['value'])) {
|
if (isset($this->getInput('p'))) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
|
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
|
||||||
}
|
}
|
||||||
if (isset($param['t']['value'])) {
|
if (isset($this->getInput('t'))) {
|
||||||
$tags = urlencode($param['t']['value']);
|
$tags = urlencode($this->getInput('t'));
|
||||||
}
|
}
|
||||||
$html = $this->getSimpleHTMLDOM("http://donmai.us/posts?&page=$page&tags=$tags") or $this->returnServerError('Could not request Danbooru.');
|
$html = $this->getSimpleHTMLDOM("http://donmai.us/posts?&page=$page&tags=$tags") or $this->returnServerError('Could not request Danbooru.');
|
||||||
foreach($html->find('div[id=posts] article') as $element) {
|
foreach($html->find('div[id=posts] article') as $element) {
|
||||||
|
|
|
@ -38,7 +38,6 @@ class DauphineLibereBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
// Simulate Mozilla user-agent to fix error 403 (Forbidden)
|
// Simulate Mozilla user-agent to fix error 403 (Forbidden)
|
||||||
$opts = array('http' =>
|
$opts = array('http' =>
|
||||||
|
@ -50,8 +49,8 @@ class DauphineLibereBridge extends BridgeAbstract {
|
||||||
|
|
||||||
$context = stream_context_create($opts);
|
$context = stream_context_create($opts);
|
||||||
|
|
||||||
if (isset($param['u']['value'])) { /* user timeline mode */
|
if (isset($this->getInput('u'))) { /* user timeline mode */
|
||||||
$this->request = $param['u']['value'];
|
$this->request = $this->getInput('u');
|
||||||
$html = $this->getSimpleHTMLDOM('http://www.ledauphine.com/'.$this->request.'/rss',false,$context) or $this->returnServerError('Could not request DauphineLibere.');
|
$html = $this->getSimpleHTMLDOM('http://www.ledauphine.com/'.$this->request.'/rss',false,$context) or $this->returnServerError('Could not request DauphineLibere.');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -16,13 +16,12 @@ class DollbooruBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$page = 0;$tags='';
|
$page = 0;$tags='';
|
||||||
if (isset($param['p']['value'])) {
|
if (isset($this->getInput('p'))) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
|
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
|
||||||
}
|
}
|
||||||
if (isset($param['t']['value'])) {
|
if (isset($this->getInput('t'))) {
|
||||||
$tags = urlencode($param['t']['value']);
|
$tags = urlencode($this->getInput('t'));
|
||||||
}
|
}
|
||||||
$html = $this->getSimpleHTMLDOM("http://dollbooru.org/post/list/$tags/$page") or $this->returnServerError('Could not request Dollbooru.');
|
$html = $this->getSimpleHTMLDOM("http://dollbooru.org/post/list/$tags/$page") or $this->returnServerError('Could not request Dollbooru.');
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,8 @@ class DuckDuckGoBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = '';
|
$html = '';
|
||||||
$link = 'http://duckduckgo.com/html/?q='.$param['u']['value'].'+sort:date';
|
$link = 'http://duckduckgo.com/html/?q='.$this->getInput('u').'+sort:date';
|
||||||
|
|
||||||
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request DuckDuckGo.');
|
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request DuckDuckGo.');
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ class EZTVBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
// Make timestamp from relative released time in table
|
// Make timestamp from relative released time in table
|
||||||
function makeTimestamp($relativeReleaseTime){
|
function makeTimestamp($relativeReleaseTime){
|
||||||
|
@ -31,11 +30,11 @@ class EZTVBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for ID provided
|
// Check for ID provided
|
||||||
if (!isset($param['i']['value']))
|
if (!isset($this->getInput('i')))
|
||||||
$this->returnClientError('You must provide a list of ID (?i=showID1,showID2,...)');
|
$this->returnClientError('You must provide a list of ID (?i=showID1,showID2,...)');
|
||||||
|
|
||||||
// Loop on show ids
|
// Loop on show ids
|
||||||
$showList = explode(",",$param['i']['value']);
|
$showList = explode(",",$this->getInput('i'));
|
||||||
foreach($showList as $showID){
|
foreach($showList as $showID){
|
||||||
|
|
||||||
// Get show page
|
// Get show page
|
||||||
|
|
|
@ -56,9 +56,8 @@ class ElsevierBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
$uri = 'http://www.journals.elsevier.com/' . $this->getInput('j') . '/recent-articles/';
|
||||||
$uri = 'http://www.journals.elsevier.com/' . $param['j']['value'] . '/recent-articles/';
|
$html = $this->getSimpleHTMLDOM($uri) or $this->returnServerError('No results for Elsevier journal '.$this->getInput('j'));
|
||||||
$html = $this->getSimpleHTMLDOM($uri) or $this->returnServerError('No results for Elsevier journal '.$param['j']['value']);
|
|
||||||
|
|
||||||
foreach($html->find('.pod-listing') as $article){
|
foreach($html->find('.pod-listing') as $article){
|
||||||
$item = array();
|
$item = array();
|
||||||
|
|
|
@ -14,7 +14,6 @@ class FacebookBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
//Extract a string using start and end delimiters
|
//Extract a string using start and end delimiters
|
||||||
function ExtractFromDelimiters($string, $start, $end) {
|
function ExtractFromDelimiters($string, $start, $end) {
|
||||||
|
@ -102,11 +101,11 @@ class FacebookBridge extends BridgeAbstract{
|
||||||
|
|
||||||
//Retrieve page contents
|
//Retrieve page contents
|
||||||
if (is_null($html)) {
|
if (is_null($html)) {
|
||||||
if (isset($param['u']['value'])) {
|
if (isset($this->getInput('u'))) {
|
||||||
if (!strpos($param['u']['value'], "/")) {
|
if (!strpos($this->getInput('u'), "/")) {
|
||||||
$html = $this->getSimpleHTMLDOM('https://www.facebook.com/'.urlencode($param['u']['value']).'?_fb_noscript=1') or $this->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM('https://www.facebook.com/'.urlencode($this->getInput('u')).'?_fb_noscript=1') or $this->returnServerError('No results for this query.');
|
||||||
} else {
|
} else {
|
||||||
$html = $this->getSimpleHTMLDOM('https://www.facebook.com/pages/'.$param['u']['value'].'?_fb_noscript=1') or $this->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM('https://www.facebook.com/pages/'.$this->getInput('u').'?_fb_noscript=1') or $this->returnServerError('No results for this query.');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->returnClientError('You must specify a Facebook username.');
|
$this->returnClientError('You must specify a Facebook username.');
|
||||||
|
@ -146,7 +145,7 @@ class FacebookBridge extends BridgeAbstract{
|
||||||
if(isset($element)) {
|
if(isset($element)) {
|
||||||
|
|
||||||
$author = str_replace(' | Facebook', '', $html->find('title#pageTitle', 0)->innertext);
|
$author = str_replace(' | Facebook', '', $html->find('title#pageTitle', 0)->innertext);
|
||||||
$profilePic = 'https://graph.facebook.com/'.$param['u']['value'].'/picture?width=200&height=200';
|
$profilePic = 'https://graph.facebook.com/'.$this->getInput('u').'/picture?width=200&height=200';
|
||||||
$this->name = $author;
|
$this->name = $author;
|
||||||
|
|
||||||
foreach($element->children() as $post) {
|
foreach($element->children() as $post) {
|
||||||
|
@ -205,8 +204,8 @@ class FacebookBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setDatas(array $param){
|
public function setDatas(array $param){
|
||||||
if (isset($param['captcha_response']['value']))
|
if (isset($this->getInput('captcha_response')))
|
||||||
unset($param['captcha_response']['value']);
|
unset($this->getInput('captcha_response'));
|
||||||
parent::setDatas($param);
|
parent::setDatas($param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,14 +17,13 @@ class FlickrTagBridge extends BridgeAbstract{
|
||||||
);
|
);
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = $this->getSimpleHTMLDOM('http://www.flickr.com/search/?q=vendee&s=rec') or $this->returnServerError('Could not request Flickr.');
|
$html = $this->getSimpleHTMLDOM('http://www.flickr.com/search/?q=vendee&s=rec') or $this->returnServerError('Could not request Flickr.');
|
||||||
if (isset($param['q']['value'])) { /* keyword search mode */
|
if (isset($this->getInput('q'))) { /* keyword search mode */
|
||||||
$this->request = $param['q']['value'];
|
$this->request = $this->getInput('q');
|
||||||
$html = $this->getSimpleHTMLDOM('http://www.flickr.com/search/?q='.urlencode($this->request).'&s=rec') or $this->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM('http://www.flickr.com/search/?q='.urlencode($this->request).'&s=rec') or $this->returnServerError('No results for this query.');
|
||||||
}
|
}
|
||||||
elseif (isset($param['u']['value'])) { /* user timeline mode */
|
elseif (isset($this->getInput('u'))) { /* user timeline mode */
|
||||||
$this->request = $param['u']['value'];
|
$this->request = $this->getInput('u');
|
||||||
$html = $this->getSimpleHTMLDOM('http://www.flickr.com/photos/'.urlencode($this->request).'/') or $this->returnServerError('Requested username can\'t be found.');
|
$html = $this->getSimpleHTMLDOM('http://www.flickr.com/photos/'.urlencode($this->request).'/') or $this->returnServerError('Requested username can\'t be found.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,11 @@ class FourchanBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
if (!isset($param['t']['value']))
|
if (!isset($this->getInput('t')))
|
||||||
$this->returnClientError('You must specify the thread URL (?t=...)');
|
$this->returnClientError('You must specify the thread URL (?t=...)');
|
||||||
|
|
||||||
$thread = parse_url($param['t']['value']) or $this->returnClientError('This URL seems malformed, please check it.');
|
$thread = parse_url($this->getInput('t')) or $this->returnClientError('This URL seems malformed, please check it.');
|
||||||
if($thread['host'] !== 'boards.4chan.org')
|
if($thread['host'] !== 'boards.4chan.org')
|
||||||
$this->returnClientError('4chan thread URL only.');
|
$this->returnClientError('4chan thread URL only.');
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,6 @@ class FuturaSciencesBridge extends BridgeAbstract {
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
function StripCDATA($string) {
|
function StripCDATA($string) {
|
||||||
$string = str_replace('<![CDATA[', '', $string);
|
$string = str_replace('<![CDATA[', '', $string);
|
||||||
|
@ -136,10 +135,10 @@ class FuturaSciencesBridge extends BridgeAbstract {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = $this->getURI().'rss/'.$param['feed']['value'].'.xml';
|
$url = $this->getURI().'rss/'.$this->getInput('feed').'.xml';
|
||||||
if (empty($param['feed']['value']))
|
if (empty($this->getInput('feed')))
|
||||||
$this->returnClientError('Please select a feed to display.'.$url);
|
$this->returnClientError('Please select a feed to display.'.$url);
|
||||||
if ($param['feed']['value'] !== preg_replace('/[^a-zA-Z-\/]+/', '', $param['feed']['value']) || substr_count($param['feed']['value'], '/') > 1 || strlen($param['feed']['value'] > 64))
|
if ($this->getInput('feed') !== preg_replace('/[^a-zA-Z-\/]+/', '', $this->getInput('feed')) || substr_count($this->getInput('feed'), '/') > 1 || strlen($this->getInput('feed') > 64))
|
||||||
$this->returnClientError('Invalid "feed" parameter.'.$url);
|
$this->returnClientError('Invalid "feed" parameter.'.$url);
|
||||||
|
|
||||||
$html = $this->getSimpleHTMLDOM($url) or $this->returnServerError('Could not request Futura-Sciences: '.$url);
|
$html = $this->getSimpleHTMLDOM($url) or $this->returnServerError('Could not request Futura-Sciences: '.$url);
|
||||||
|
|
|
@ -60,11 +60,10 @@ class GBAtempBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
$html = $this->getSimpleHTMLDOM($this->uri) or $this->returnServerError('Could not request GBAtemp.');
|
$html = $this->getSimpleHTMLDOM($this->uri) or $this->returnServerError('Could not request GBAtemp.');
|
||||||
|
|
||||||
switch($param['type']['value']){
|
switch($this->getInput('type')){
|
||||||
case 'N':
|
case 'N':
|
||||||
foreach ($html->find('li[class=news_item full]') as $newsItem) {
|
foreach ($html->find('li[class=news_item full]') as $newsItem) {
|
||||||
$url = $this->uri.$newsItem->find('a', 0)->href;
|
$url = $this->uri.$newsItem->find('a', 0)->href;
|
||||||
|
@ -111,8 +110,7 @@ class GBAtempBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName() {
|
public function getName() {
|
||||||
$param=$this->parameters[$this->queriedContext];
|
$type=array_search($this->getInput('type'),$param['type']['values']);
|
||||||
$type=array_search($param['type']['value'],$param['type']['values']);
|
|
||||||
return 'GBAtemp '.$type.' Bridge';
|
return 'GBAtemp '.$type.' Bridge';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,11 @@ class GawkerBridge extends RssExpander{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
if (empty($this->getInput('site'))) {
|
||||||
if (empty($param['site']['value'])) {
|
|
||||||
trigger_error("If no site is provided, nothing is gonna happen", E_USER_ERROR);
|
trigger_error("If no site is provided, nothing is gonna happen", E_USER_ERROR);
|
||||||
} else {
|
} else {
|
||||||
$this->name = $param['site']['value'];
|
$this->name = $this->getInput('site');
|
||||||
$url = $this->toURI(strtolower($param['site']['value']));
|
$url = $this->toURI(strtolower($this->getInput('site')));
|
||||||
}
|
}
|
||||||
$this->debugMessage("loading feed from ".$this->getURI());
|
$this->debugMessage("loading feed from ".$this->getURI());
|
||||||
parent::collectExpandableDatas($url);
|
parent::collectExpandableDatas($url);
|
||||||
|
|
|
@ -15,15 +15,14 @@ class GelbooruBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$page = 0;
|
$page = 0;
|
||||||
if (isset($param['p']['value'])) {
|
if (isset($this->getInput('p'))) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
|
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
|
||||||
$page = $page - 1;
|
$page = $page - 1;
|
||||||
$page = $page * 63;
|
$page = $page * 63;
|
||||||
}
|
}
|
||||||
if (isset($param['t']['value'])) {
|
if (isset($this->getInput('t'))) {
|
||||||
$tags = urlencode($param['t']['value']);
|
$tags = urlencode($this->getInput('t'));
|
||||||
}
|
}
|
||||||
$html = $this->getSimpleHTMLDOM("http://gelbooru.com/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Gelbooru.');
|
$html = $this->getSimpleHTMLDOM("http://gelbooru.com/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Gelbooru.');
|
||||||
|
|
||||||
|
|
|
@ -17,23 +17,22 @@ class GiphyBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = '';
|
$html = '';
|
||||||
$base_url = 'http://giphy.com';
|
$base_url = 'http://giphy.com';
|
||||||
if (isset($param['s']['value'])) { /* keyword search mode */
|
if (isset($this->getInput('s'))) { /* keyword search mode */
|
||||||
$html = $this->getSimpleHTMLDOM($base_url.'/search/'.urlencode($param['s']['value'].'/')) or $this->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM($base_url.'/search/'.urlencode($this->getInput('s').'/')) or $this->returnServerError('No results for this query.');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->returnClientError('You must specify a search worf (?s=...).');
|
$this->returnClientError('You must specify a search worf (?s=...).');
|
||||||
}
|
}
|
||||||
|
|
||||||
$max = GIPHY_LIMIT;
|
$max = GIPHY_LIMIT;
|
||||||
if (isset($param['n']['value'])) {
|
if (isset($this->getInput('n'))) {
|
||||||
$max = (integer) $param['n']['value'];
|
$max = (integer) $this->getInput('n');
|
||||||
}
|
}
|
||||||
|
|
||||||
$limit = 0;
|
$limit = 0;
|
||||||
$kw = urlencode($param['s']['value']);
|
$kw = urlencode($this->getInput('s'));
|
||||||
foreach($html->find('div.hoverable-gif') as $entry) {
|
foreach($html->find('div.hoverable-gif') as $entry) {
|
||||||
if($limit < $max) {
|
if($limit < $max) {
|
||||||
$node = $entry->first_child();
|
$node = $entry->first_child();
|
||||||
|
|
|
@ -29,12 +29,11 @@ class GithubIssueBridge extends BridgeAbstract{
|
||||||
);
|
);
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
$uri = 'https://github.com/'.$this->getInput('u').'/'.$this->getInput('p').'/issues/'.(isset($this->getInput('i'))?$this->getInput('i'):'');
|
||||||
$uri = 'https://github.com/'.$param['u']['value'].'/'.$param['p']['value'].'/issues/'.(isset($param['i']['value'])?$param['i']['value']:'');
|
|
||||||
$html = $this->getSimpleHTMLDOM($uri)
|
$html = $this->getSimpleHTMLDOM($uri)
|
||||||
or $this->returnServerError('No results for Github Issue '.$param['i']['value'].' in project '.$param['u']['value'].'/'.$param['p']['value']);
|
or $this->returnServerError('No results for Github Issue '.$this->getInput('i').' in project '.$this->getInput('u').'/'.$this->getInput('p'));
|
||||||
|
|
||||||
if(isset($param['i']['value'])){
|
if(isset($this->getInput('i'))){
|
||||||
foreach($html->find('.js-comment-container') as $comment){
|
foreach($html->find('.js-comment-container') as $comment){
|
||||||
|
|
||||||
$item = array();
|
$item = array();
|
||||||
|
|
|
@ -26,29 +26,28 @@ class GitlabCommitsBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
$uri = $this->getInput('uri').'/'.$this->getInput('u').'/'.$this->getInput('p').'/commits/';
|
||||||
$uri = $param['uri']['value'].'/'.$param['u']['value'].'/'.$param['p']['value'].'/commits/';
|
if(isset($this->getInput('b'))){
|
||||||
if(isset($param['b']['value'])){
|
$uri.=$this->getInput('b');
|
||||||
$uri.=$param['b']['value'];
|
|
||||||
}else{
|
}else{
|
||||||
$uri.='master';
|
$uri.='master';
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = $this->getSimpleHTMLDOM($uri)
|
$html = $this->getSimpleHTMLDOM($uri)
|
||||||
or $this->returnServerError('No results for Gitlab Commits of project '.$param['uri']['value'].'/'.$param['u']['value'].'/'.$param['p']['value']);
|
or $this->returnServerError('No results for Gitlab Commits of project '.$this->getInput('uri').'/'.$this->getInput('u').'/'.$this->getInput('p'));
|
||||||
|
|
||||||
|
|
||||||
foreach($html->find('li.commit') as $commit){
|
foreach($html->find('li.commit') as $commit){
|
||||||
|
|
||||||
$item = array();
|
$item = array();
|
||||||
$item['uri']=$param['uri']['value'];
|
$item['uri']=$this->getInput('uri');
|
||||||
|
|
||||||
foreach($commit->getElementsByTagName('a') as $a){
|
foreach($commit->getElementsByTagName('a') as $a){
|
||||||
$classes=explode(' ',$a->getAttribute("class"));
|
$classes=explode(' ',$a->getAttribute("class"));
|
||||||
if(in_array('commit-short-id',$classes) ||
|
if(in_array('commit-short-id',$classes) ||
|
||||||
in_array('commit_short_id',$classes)){
|
in_array('commit_short_id',$classes)){
|
||||||
$href=$a->getAttribute('href');
|
$href=$a->getAttribute('href');
|
||||||
$item['uri'].=substr($href,strpos($href,'/'.$param['u']['value'].'/'.$param['p']['value']));
|
$item['uri'].=substr($href,strpos($href,'/'.$this->getInput('u').'/'.$this->getInput('p')));
|
||||||
}
|
}
|
||||||
if(in_array('commit-row-message',$classes)){
|
if(in_array('commit-row-message',$classes)){
|
||||||
$item['title']=$a->plaintext;
|
$item['title']=$a->plaintext;
|
||||||
|
|
|
@ -21,12 +21,12 @@ class GooglePlusPostBridge extends BridgeAbstract
|
||||||
public function collectData()
|
public function collectData()
|
||||||
{
|
{
|
||||||
$param=$this->parameters[$queriedContext];
|
$param=$this->parameters[$queriedContext];
|
||||||
if (!isset($param['username']['value']))
|
if (!isset($this->getInput('username')))
|
||||||
{
|
{
|
||||||
$this->returnClientError('You must specify a username (?username=...).');
|
$this->returnClientError('You must specify a username (?username=...).');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->request = $param['username']['value'];
|
$this->request = $this->getInput('username');
|
||||||
// get content parsed
|
// get content parsed
|
||||||
// $html = $this->getSimpleHTMLDOM(__DIR__ . '/../posts2.html'
|
// $html = $this->getSimpleHTMLDOM(__DIR__ . '/../posts2.html'
|
||||||
$html = $this->getSimpleHTMLDOM(self::GOOGLE_PLUS_BASE_URL . urlencode($this->request) . '/posts'
|
$html = $this->getSimpleHTMLDOM(self::GOOGLE_PLUS_BASE_URL . urlencode($this->request) . '/posts'
|
||||||
|
|
|
@ -24,10 +24,9 @@ class GoogleSearchBridge extends BridgeAbstract{
|
||||||
|
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = '';
|
$html = '';
|
||||||
|
|
||||||
$html = $this->getSimpleHTMLDOM('https://www.google.com/search?q=' . urlencode($param['q']['value']) . '&num=100&complete=0&tbs=qdr:y,sbd:1') or $this->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM('https://www.google.com/search?q=' . urlencode($this->getInput('q')) . '&num=100&complete=0&tbs=qdr:y,sbd:1') or $this->returnServerError('No results for this query.');
|
||||||
|
|
||||||
$emIsRes = $html->find('div[id=ires]',0);
|
$emIsRes = $html->find('div[id=ires]',0);
|
||||||
if( !is_null($emIsRes) ){
|
if( !is_null($emIsRes) ){
|
||||||
|
@ -47,8 +46,7 @@ class GoogleSearchBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
return $this->getInput('q') .' - Google search';
|
||||||
return $param['q']['value'] .' - Google search';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCacheDuration(){
|
public function getCacheDuration(){
|
||||||
|
|
|
@ -20,12 +20,11 @@ class HDWallpapersBridge extends BridgeAbstract {
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = '';
|
$html = '';
|
||||||
$baseUri = 'http://www.hdwallpapers.in';
|
$baseUri = 'http://www.hdwallpapers.in';
|
||||||
|
|
||||||
$this->category = $param['c']['value'] ?: 'latest_wallpapers'; // Latest default
|
$this->category = $this->getInput('c') ?: 'latest_wallpapers'; // Latest default
|
||||||
$this->resolution = $param['r']['value'] ?: '1920x1200'; // Wide wallpaper default
|
$this->resolution = $this->getInput('r') ?: '1920x1200'; // Wide wallpaper default
|
||||||
|
|
||||||
$category = $this->category;
|
$category = $this->category;
|
||||||
if (strrpos($category, 'wallpapers') !== strlen($category)-strlen('wallpapers')) {
|
if (strrpos($category, 'wallpapers') !== strlen($category)-strlen('wallpapers')) {
|
||||||
|
@ -33,7 +32,7 @@ class HDWallpapersBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
$num = 0;
|
$num = 0;
|
||||||
$max = $param['m']['value'] ?: 14;
|
$max = $this->getInput('m') ?: 14;
|
||||||
$lastpage = 1;
|
$lastpage = 1;
|
||||||
|
|
||||||
for ($page = 1; $page <= $lastpage; $page++) {
|
for ($page = 1; $page <= $lastpage; $page++) {
|
||||||
|
|
|
@ -23,19 +23,17 @@ class IdenticaBridge extends BridgeAbstract{
|
||||||
$item['uri'] = html_entity_decode($dent->find('a', 0)->href); // get dent link
|
$item['uri'] = html_entity_decode($dent->find('a', 0)->href); // get dent link
|
||||||
$item['timestamp'] = strtotime($dent->find('abbr.easydate', 0)->plaintext); // extract dent timestamp
|
$item['timestamp'] = strtotime($dent->find('abbr.easydate', 0)->plaintext); // extract dent timestamp
|
||||||
$item['content'] = trim($dent->find('div.activity-content', 0)->innertext); // extract dent text
|
$item['content'] = trim($dent->find('div.activity-content', 0)->innertext); // extract dent text
|
||||||
$item['title'] = $param['u']['value'] . ' | ' . $item['content'];
|
$item['title'] = $this->getInput('u') . ' | ' . $item['content'];
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
return $this->getInput('u') .' - Identica Bridge';
|
||||||
return $param['u']['value'] .' - Identica Bridge';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getURI(){
|
public function getURI(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
return $this->uri.urlencode($this->getInput('u'));
|
||||||
return $this->uri.urlencode($param['u']['value']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCacheDuration(){
|
public function getCacheDuration(){
|
||||||
|
|
|
@ -61,13 +61,11 @@ class InstagramBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
return $this->param['u']['value'] .' - Instagram Bridge';
|
return $this->param['u']['value'] .' - Instagram Bridge';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getURI(){
|
public function getURI(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
return $this->uri.urlencode($this->getInput('u'));
|
||||||
return $this->uri.urlencode($param['u']['value']);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,23 +90,22 @@ class IsoHuntBridge extends BridgeAbstract{
|
||||||
);
|
);
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$params=$this->parameters[$this->queriedContext];
|
|
||||||
$request_path = '/'; // We'll request the main page by default
|
$request_path = '/'; // We'll request the main page by default
|
||||||
|
|
||||||
if(isset($params['latest_category']['value'])){ // Requesting one of the latest categories
|
if(isset($this->getInput('latest_category'))){ // Requesting one of the latest categories
|
||||||
$this->request_latest_category($params['latest_category']['value']);
|
$this->request_latest_category($this->getInput('latest_category'));
|
||||||
} elseif(isset($params['torrent_category']['value'])){ // Requesting one of the torrent categories
|
} elseif(isset($this->getInput('torrent_category'))){ // Requesting one of the torrent categories
|
||||||
$order_popularity = false;
|
$order_popularity = false;
|
||||||
|
|
||||||
if(isset($params['torrent_popularity']['value']))
|
if(isset($this->getInput('torrent_popularity')))
|
||||||
$order_popularity = $params['torrent_popularity']['value'];
|
$order_popularity = $this->getInput('torrent_popularity');
|
||||||
|
|
||||||
$this->request_torrent_category($params['torrent_category']['value'], $order_popularity);
|
$this->request_torrent_category($this->getInput('torrent_category'), $order_popularity);
|
||||||
} else if(isset($params['search_name']['value'])){ // Requesting search
|
} else if(isset($this->getInput('search_name'))){ // Requesting search
|
||||||
if(isset($params['search_category']['value']))
|
if(isset($this->getInput('search_category')))
|
||||||
$this->request_search($params['search_name']['value'], $params['search_category']['value']);
|
$this->request_search($this->getInput('search_name'), $this->getInput('search_category'));
|
||||||
else
|
else
|
||||||
$this->request_search($params['search_name']['value']);
|
$this->request_search($this->getInput('search_name'));
|
||||||
} else {
|
} else {
|
||||||
$this->returnClientError('Unknown request!');
|
$this->returnClientError('Unknown request!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ class JapanExpoBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
function french_pubdate_to_timestamp($date_to_parse) {
|
function french_pubdate_to_timestamp($date_to_parse) {
|
||||||
return strtotime(
|
return strtotime(
|
||||||
|
@ -49,7 +48,7 @@ class JapanExpoBridge extends BridgeAbstract{
|
||||||
|
|
||||||
$link = 'http://www.japan-expo-paris.com/fr/actualites';
|
$link = 'http://www.japan-expo-paris.com/fr/actualites';
|
||||||
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request JapanExpo: '.$link);
|
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request JapanExpo: '.$link);
|
||||||
$fullcontent = (!empty($param['mode']['value']) && $param['mode']['value'] == 'full');
|
$fullcontent = (!empty($this->getInput('mode')) && $this->getInput('mode') == 'full');
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
|
||||||
foreach ($html->find('a._tile2') as $element) {
|
foreach ($html->find('a._tile2') as $element) {
|
||||||
|
|
|
@ -15,13 +15,12 @@ class KonachanBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$page = 1;$tags='';
|
$page = 1;$tags='';
|
||||||
if (isset($param['p']['value'])) {
|
if (isset($this->getInput('p'))) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
|
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
|
||||||
}
|
}
|
||||||
if (isset($param['t']['value'])) {
|
if (isset($this->getInput('t'))) {
|
||||||
$tags = urlencode($param['t']['value']);
|
$tags = urlencode($this->getInput('t'));
|
||||||
}
|
}
|
||||||
$html = $this->getSimpleHTMLDOM("http://konachan.com/post?page=$page&tags=$tags") or $this->returnServerError('Could not request Konachan.');
|
$html = $this->getSimpleHTMLDOM("http://konachan.com/post?page=$page&tags=$tags") or $this->returnServerError('Could not request Konachan.');
|
||||||
$input_json = explode('Post.register(', $html);
|
$input_json = explode('Post.register(', $html);
|
||||||
|
|
|
@ -40,21 +40,20 @@ class KununuBridge extends BridgeAbstract{
|
||||||
);
|
);
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$params=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
// Get Site
|
// Get Site
|
||||||
$site = strtolower(trim($params['site']['value']));
|
$site = strtolower(trim($this->getInput('site')));
|
||||||
if(!isset($site) || empty($site) || !$this->site_is_valid($site))
|
if(!isset($site) || empty($site) || !$this->site_is_valid($site))
|
||||||
$this->returnClientError('You must specify a valid site (&site=...)!');
|
$this->returnClientError('You must specify a valid site (&site=...)!');
|
||||||
|
|
||||||
// Get Company (fixing whitespace and umlauts)
|
// Get Company (fixing whitespace and umlauts)
|
||||||
$company = $this->encode_umlauts(strtolower(str_replace(' ', '-', trim($params['company']['value']))));
|
$company = $this->encode_umlauts(strtolower(str_replace(' ', '-', trim($this->getInput('company')))));
|
||||||
if(!isset($company) || empty($company))
|
if(!isset($company) || empty($company))
|
||||||
$this->returnClientError('You must specify a company (&company=...)!');
|
$this->returnClientError('You must specify a company (&company=...)!');
|
||||||
|
|
||||||
$full = false; // By default we'll load only short article
|
$full = false; // By default we'll load only short article
|
||||||
if(isset($params['full']['value']))
|
if(isset($this->getInput('full')))
|
||||||
$full = strtolower(trim($params['full']['value']));
|
$full = strtolower(trim($this->getInput('full')));
|
||||||
|
|
||||||
// Get reviews section name (depends on site)
|
// Get reviews section name (depends on site)
|
||||||
$section = '';
|
$section = '';
|
||||||
|
|
|
@ -135,14 +135,13 @@ class LeBonCoinBridge extends BridgeAbstract{
|
||||||
);
|
);
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
$html = '';
|
$html = '';
|
||||||
if (empty($param['c']['value'])) {
|
if (empty($this->getInput('c'))) {
|
||||||
$link = 'http://www.leboncoin.fr/annonces/offres/' . $param['r']['value'] . '/?f=a&th=1&q=' . urlencode($param['k']['value']);
|
$link = 'http://www.leboncoin.fr/annonces/offres/' . $this->getInput('r') . '/?f=a&th=1&q=' . urlencode($this->getInput('k'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$link = 'http://www.leboncoin.fr/' . $param['c']['value'] . '/offres/' . $param['r']['value'] . '/?f=a&th=1&q=' . urlencode($param['k']['value']);
|
$link = 'http://www.leboncoin.fr/' . $this->getInput('c') . '/offres/' . $this->getInput('r') . '/?f=a&th=1&q=' . urlencode($this->getInput('k'));
|
||||||
}
|
}
|
||||||
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request LeBonCoin.');
|
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request LeBonCoin.');
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,8 @@ class LinkedInCompany extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = '';
|
$html = '';
|
||||||
$link = 'https://www.linkedin.com/company/'.$param['c']['value'];
|
$link = 'https://www.linkedin.com/company/'.$this->getInput('c');
|
||||||
|
|
||||||
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request LinkedIn.');
|
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request LinkedIn.');
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,12 @@ class LolibooruBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$page = 1; $tags = '';
|
$page = 1; $tags = '';
|
||||||
if (isset($param['p']['value'])) {
|
if (isset($this->getInput('p'))) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
|
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
|
||||||
}
|
}
|
||||||
if (isset($param['t']['value'])) {
|
if (isset($this->getInput('t'))) {
|
||||||
$tags = urlencode($param['t']['value']);
|
$tags = urlencode($this->getInput('t'));
|
||||||
}
|
}
|
||||||
$html = $this->getSimpleHTMLDOM("http://lolibooru.moe/post?page=$page&tags=$tags") or $this->returnServerError('Could not request Lolibooru.');
|
$html = $this->getSimpleHTMLDOM("http://lolibooru.moe/post?page=$page&tags=$tags") or $this->returnServerError('Could not request Lolibooru.');
|
||||||
$input_json = explode('Post.register(', $html);
|
$input_json = explode('Post.register(', $html);
|
||||||
|
|
|
@ -76,7 +76,6 @@ class MangareaderBridge extends BridgeAbstract{
|
||||||
);
|
);
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
$this->request = '';
|
$this->request = '';
|
||||||
|
|
||||||
|
@ -84,21 +83,21 @@ class MangareaderBridge extends BridgeAbstract{
|
||||||
$path = "latest";
|
$path = "latest";
|
||||||
$limit = MANGAREADER_LIMIT;
|
$limit = MANGAREADER_LIMIT;
|
||||||
|
|
||||||
if(isset($param['category']['value'])){ // Get popular updates
|
if(isset($this->getInput('category'))){ // Get popular updates
|
||||||
$type = "popular";
|
$type = "popular";
|
||||||
$path = "popular";
|
$path = "popular";
|
||||||
if($param['category']['value'] !== "all"){
|
if($this->getInput('category') !== "all"){
|
||||||
$path .= "/" . $param['category']['value'];
|
$path .= "/" . $this->getInput('category');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($param['path']['value'])){ // Get manga updates
|
if(isset($this->getInput('path'))){ // Get manga updates
|
||||||
$type = "path";
|
$type = "path";
|
||||||
$path = $param['path']['value'];
|
$path = $this->getInput('path');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($param['limit']['value']) && $param['limit']['value'] !== ""){ // Get manga updates (optional parameter)
|
if(isset($this->getInput('limit')) && $this->getInput('limit') !== ""){ // Get manga updates (optional parameter)
|
||||||
$limit = $param['limit']['value'];
|
$limit = $this->getInput('limit');
|
||||||
}
|
}
|
||||||
|
|
||||||
// We'll use the DOM parser for this as it makes navigation easier
|
// We'll use the DOM parser for this as it makes navigation easier
|
||||||
|
|
|
@ -16,13 +16,12 @@ class MilbooruBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$page = 0;$tags='';
|
$page = 0;$tags='';
|
||||||
if (isset($param['p']['value'])) {
|
if (isset($this->getInput('p'))) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
|
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
|
||||||
}
|
}
|
||||||
if (isset($param['t']['value'])) {
|
if (isset($this->getInput('t'))) {
|
||||||
$tags = urlencode($param['t']['value']);
|
$tags = urlencode($this->getInput('t'));
|
||||||
}
|
}
|
||||||
$html = $this->getSimpleHTMLDOM("http://sheslostcontrol.net/moe/shimmie/index.php?q=/post/list/$tags/$page") or $this->returnServerError('Could not request Milbooru.');
|
$html = $this->getSimpleHTMLDOM("http://sheslostcontrol.net/moe/shimmie/index.php?q=/post/list/$tags/$page") or $this->returnServerError('Could not request Milbooru.');
|
||||||
|
|
||||||
|
|
|
@ -16,15 +16,14 @@ class MspabooruBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$page = 0;$tags='';
|
$page = 0;$tags='';
|
||||||
if (isset($param['p']['value'])) {
|
if (isset($this->getInput('p'))) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
|
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
|
||||||
$page = $page - 1;
|
$page = $page - 1;
|
||||||
$page = $page * 50;
|
$page = $page * 50;
|
||||||
}
|
}
|
||||||
if (isset($param['t']['value'])) {
|
if (isset($this->getInput('t'))) {
|
||||||
$tags = urlencode($param['t']['value']);
|
$tags = urlencode($this->getInput('t'));
|
||||||
}
|
}
|
||||||
$html = $this->getSimpleHTMLDOM("http://mspabooru.com/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Mspabooru.');
|
$html = $this->getSimpleHTMLDOM("http://mspabooru.com/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Mspabooru.');
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ class NextgovBridge extends BridgeAbstract {
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
function ExtractFromDelimiters($string, $start, $end) {
|
function ExtractFromDelimiters($string, $start, $end) {
|
||||||
if (strpos($string, $start) !== false) {
|
if (strpos($string, $start) !== false) {
|
||||||
|
@ -44,7 +43,7 @@ class NextgovBridge extends BridgeAbstract {
|
||||||
} return $string;
|
} return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
$category = $param['category']['value'];
|
$category = $this->getInput('category');
|
||||||
if (empty($category))
|
if (empty($category))
|
||||||
$category = 'all';
|
$category = 'all';
|
||||||
if ($category !== preg_replace('/[^a-z-]+/', '', $category) || strlen($category > 32))
|
if ($category !== preg_replace('/[^a-z-]+/', '', $category) || strlen($category > 32))
|
||||||
|
|
|
@ -13,10 +13,9 @@ class NovelUpdatesBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
if (!isset($this->getInput('n')))
|
||||||
if (!isset($param['n']['value']))
|
|
||||||
$this->returnClientError('You must specify the novel URL (/series/...)');
|
$this->returnClientError('You must specify the novel URL (/series/...)');
|
||||||
$thread = parse_url($param['n']['value']) or $this->returnClientError('This URL seems malformed, please check it.');
|
$thread = parse_url($this->getInput('n')) or $this->returnClientError('This URL seems malformed, please check it.');
|
||||||
if($thread['host'] !== 'www.novelupdates.com')
|
if($thread['host'] !== 'www.novelupdates.com')
|
||||||
$this->returnClientError('NovelUpdates URL only.');
|
$this->returnClientError('NovelUpdates URL only.');
|
||||||
if(strpos($thread['path'], 'series/') === FALSE)
|
if(strpos($thread['path'], 'series/') === FALSE)
|
||||||
|
|
|
@ -26,14 +26,13 @@ class OpenClassroomsBridge extends BridgeAbstract{
|
||||||
|
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
if (empty($this->getInput('u')))
|
||||||
if (empty($param['u']['value']))
|
|
||||||
{
|
{
|
||||||
$this->returnServerError('Error: You must chose a category.');
|
$this->returnServerError('Error: You must chose a category.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = '';
|
$html = '';
|
||||||
$link = 'https://openclassrooms.com/courses?categories='.$param['u']['value'].'&title=&sort=updatedAt+desc';
|
$link = 'https://openclassrooms.com/courses?categories='.$this->getInput('u').'&title=&sort=updatedAt+desc';
|
||||||
|
|
||||||
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request OpenClassrooms.');
|
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request OpenClassrooms.');
|
||||||
|
|
||||||
|
|
|
@ -25,27 +25,26 @@ class ParuVenduImmoBridge extends BridgeAbstract
|
||||||
|
|
||||||
public function collectData()
|
public function collectData()
|
||||||
{
|
{
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = '';
|
$html = '';
|
||||||
$num = 20;
|
$num = 20;
|
||||||
$appartment = '&tbApp=1&tbDup=1&tbChb=1&tbLof=1&tbAtl=1&tbPla=1';
|
$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';
|
$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;
|
$link = $this->uri.'/immobilier/annonceimmofo/liste/listeAnnonces?tt=1'.$appartment.$maison;
|
||||||
|
|
||||||
if (isset($param['minarea']['value'])) {
|
if (isset($this->getInput('minarea'))) {
|
||||||
$link .= '&sur0='.urlencode($param['minarea']['value']);
|
$link .= '&sur0='.urlencode($this->getInput('minarea'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($param['maxprice']['value'])) {
|
if (isset($this->getInput('maxprice'))) {
|
||||||
$link .= '&px1='.urlencode($param['maxprice']['value']);
|
$link .= '&px1='.urlencode($this->getInput('maxprice'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($param['pa']['value'])) {
|
if (isset($this->getInput('pa'))) {
|
||||||
$link .= '&pa='.urlencode($param['pa']['value']);
|
$link .= '&pa='.urlencode($this->getInput('pa'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($param['lo']['value'])) {
|
if (isset($this->getInput('lo'))) {
|
||||||
$link .= '&lo='.urlencode($param['lo']['value']);
|
$link .= '&lo='.urlencode($this->getInput('lo'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request paruvendu.');
|
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request paruvendu.');
|
||||||
|
@ -81,16 +80,15 @@ class ParuVenduImmoBridge extends BridgeAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$request='';
|
$request='';
|
||||||
if(isset($param['minarea']['value']) &&
|
if(isset($this->getInput('minarea')) &&
|
||||||
!empty($param['minarea']['value'])
|
!empty($this->getInput('minarea'))
|
||||||
){
|
){
|
||||||
$request .= ' '.$param['minarea']['value'].' m2';
|
$request .= ' '.$this->getInput('minarea').' m2';
|
||||||
}
|
}
|
||||||
if(isset($param['lo']['value']) &&
|
if(isset($this->getInput('lo')) &&
|
||||||
!empty($param['lo']['value'])){
|
!empty($this->getInput('lo'))){
|
||||||
$request .= ' In: '.$param['lo']['value'];
|
$request .= ' In: '.$this->getInput('lo');
|
||||||
}
|
}
|
||||||
return 'Paru Vendu Immobilier'.$request;
|
return 'Paru Vendu Immobilier'.$request;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,19 +26,18 @@ class PickyWallpapersBridge extends BridgeAbstract {
|
||||||
|
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = '';
|
$html = '';
|
||||||
if (!isset($param['c']['value'])) {
|
if (!isset($this->getInput('c'))) {
|
||||||
$this->returnClientError('You must specify at least a category (?c=...).');
|
$this->returnClientError('You must specify at least a category (?c=...).');
|
||||||
} else {
|
} else {
|
||||||
$baseUri = 'http://www.pickywallpapers.com';
|
$baseUri = 'http://www.pickywallpapers.com';
|
||||||
|
|
||||||
$this->category = $param['c']['value'];
|
$this->category = $this->getInput('c');
|
||||||
$this->subcategory = $param['s']['value'] ?: '';
|
$this->subcategory = $this->getInput('s') ?: '';
|
||||||
$this->resolution = $param['r']['value'] ?: '1920x1200'; // Wide wallpaper default
|
$this->resolution = $this->getInput('r') ?: '1920x1200'; // Wide wallpaper default
|
||||||
|
|
||||||
$num = 0;
|
$num = 0;
|
||||||
$max = $param['m']['value'] ?: 12;
|
$max = $this->getInput('m') ?: 12;
|
||||||
$lastpage = 1;
|
$lastpage = 1;
|
||||||
|
|
||||||
for ($page = 1; $page <= $lastpage; $page++) {
|
for ($page = 1; $page <= $lastpage; $page++) {
|
||||||
|
|
|
@ -21,27 +21,26 @@ class PinterestBridge extends BridgeAbstract{
|
||||||
);
|
);
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = '';
|
$html = '';
|
||||||
if (isset($param['u']['value']) || isset($param['b']['value'])) {
|
if (isset($this->getInput('u')) || isset($this->getInput('b'))) {
|
||||||
|
|
||||||
if (empty($param['u']['value']))
|
if (empty($this->getInput('u')))
|
||||||
{
|
{
|
||||||
$this->returnClientError('You must specify a Pinterest username (?u=...).');
|
$this->returnClientError('You must specify a Pinterest username (?u=...).');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($param['b']['value']))
|
if (empty($this->getInput('b')))
|
||||||
{
|
{
|
||||||
$this->returnClientError('You must specify a Pinterest board for this username (?b=...).');
|
$this->returnClientError('You must specify a Pinterest board for this username (?b=...).');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->username = $param['u']['value'];
|
$this->username = $this->getInput('u');
|
||||||
$this->board = $param['b']['value'];
|
$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');
|
$html = $this->getSimpleHTMLDOM($this->getURI().'/'.urlencode($this->username).'/'.urlencode($this->board)) or $this->returnServerError('Username and/or board not found');
|
||||||
|
|
||||||
} else if (isset($param['q']['value']))
|
} else if (isset($this->getInput('q')))
|
||||||
{
|
{
|
||||||
$this->query = $param['q']['value'];
|
$this->query = $this->getInput('q');
|
||||||
$html = $this->getSimpleHTMLDOM($this->getURI().'/search/?q='.urlencode($this->query)) or $this->returnServerError('Could not request Pinterest.');
|
$html = $this->getSimpleHTMLDOM($this->getURI().'/search/?q='.urlencode($this->query)) or $this->returnServerError('Could not request Pinterest.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,13 +14,12 @@ class RTBFBridge extends BridgeAbstract {
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = '';
|
$html = '';
|
||||||
$limit = 10;
|
$limit = 10;
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
|
||||||
if (isset($param['c']['value'])) {
|
if (isset($this->getInput('c'))) {
|
||||||
$html = $this->getSimpleHTMLDOM('http://www.rtbf.be/auvio/emissions/detail?id='.$param['c']['value']) or $this->returnServerError('Could not request RTBF.');
|
$html = $this->getSimpleHTMLDOM('http://www.rtbf.be/auvio/emissions/detail?id='.$this->getInput('c')) 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) {
|
||||||
|
|
|
@ -15,15 +15,14 @@ class Rule34Bridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$page = 0;$tags='';
|
$page = 0;$tags='';
|
||||||
if (isset($param['p']['value'])) {
|
if (isset($this->getInput('p'))) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
|
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
|
||||||
$page = $page - 1;
|
$page = $page - 1;
|
||||||
$page = $page * 50;
|
$page = $page * 50;
|
||||||
}
|
}
|
||||||
if (isset($param['t']['value'])) {
|
if (isset($this->getInput('t'))) {
|
||||||
$tags = urlencode($param['t']['value']);
|
$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("http://rule34.xxx/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Rule34.');
|
||||||
|
|
||||||
|
|
|
@ -16,13 +16,12 @@ class Rule34pahealBridge extends BridgeAbstract{
|
||||||
|
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$page = 0;$tags='';
|
$page = 0;$tags='';
|
||||||
if (isset($param['p']['value'])) {
|
if (isset($this->getInput('p'))) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
|
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
|
||||||
}
|
}
|
||||||
if (isset($param['t']['value'])) {
|
if (isset($this->getInput('t'))) {
|
||||||
$tags = urlencode($param['t']['value']);
|
$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("http://rule34.paheal.net/post/list/$tags/$page") or $this->returnServerError('Could not request Rule34paheal.');
|
||||||
|
|
||||||
|
|
|
@ -15,15 +15,14 @@ class SafebooruBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$page = 0;$tags='';
|
$page = 0;$tags='';
|
||||||
if (isset($param['p']['value'])) {
|
if (isset($this->getInput('p'))) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
|
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
|
||||||
$page = $page - 1;
|
$page = $page - 1;
|
||||||
$page = $page * 40;
|
$page = $page * 40;
|
||||||
}
|
}
|
||||||
if (isset($param['t']['value'])) {
|
if (isset($this->getInput('t'))) {
|
||||||
$tags = urlencode($param['t']['value']);
|
$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("http://safebooru.org/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Safebooru.');
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,12 @@ class SakugabooruBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$page = 1;$tags='';
|
$page = 1;$tags='';
|
||||||
if (isset($param['p']['value'])) {
|
if (isset($this->getInput('p'))) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
|
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
|
||||||
}
|
}
|
||||||
if (isset($param['t']['value'])) {
|
if (isset($this->getInput('t'))) {
|
||||||
$tags = urlencode($param['t']['value']);
|
$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("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);
|
||||||
|
|
|
@ -14,10 +14,9 @@ class ScoopItBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = '';
|
$html = '';
|
||||||
if ($param['u']['value'] != '') {
|
if ($this->getInput('u') != '') {
|
||||||
$this->request = $param['u']['value'];
|
$this->request = $this->getInput('u');
|
||||||
$link = 'http://scoop.it/search?q=' .urlencode($this->request);
|
$link = 'http://scoop.it/search?q=' .urlencode($this->request);
|
||||||
|
|
||||||
$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);
|
||||||
|
|
|
@ -34,18 +34,17 @@ class SensCritiqueBridge extends BridgeAbstract {
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
if ((isset($this->getInput('m')) && $this->getInput('m'))) {
|
||||||
if ((isset($param['m']['value']) && $param['m']['value'])) {
|
|
||||||
$this->collectMoviesData();
|
$this->collectMoviesData();
|
||||||
} else if ((isset($param['s']['value']) && $param['s']['value'])) {
|
} else if ((isset($this->getInput('s')) && $this->getInput('s'))) {
|
||||||
$this->collectSeriesData();
|
$this->collectSeriesData();
|
||||||
} else if ((isset($param['g']['value']) && $param['g']['value'])) {
|
} else if ((isset($this->getInput('g')) && $this->getInput('g'))) {
|
||||||
$this->collectGamesData();
|
$this->collectGamesData();
|
||||||
} else if ((isset($param['b']['value']) && $param['b']['value'])) {
|
} else if ((isset($this->getInput('b')) && $this->getInput('b'))) {
|
||||||
$this->collectBooksData();
|
$this->collectBooksData();
|
||||||
} else if ((isset($param['bd']['value']) && $param['bd']['value'])) {
|
} else if ((isset($this->getInput('bd')) && $this->getInput('bd'))) {
|
||||||
$this->collectBDsData();
|
$this->collectBDsData();
|
||||||
} else if ((isset($param['mu']['value']) && $param['mu']['value'])) {
|
} else if ((isset($this->getInput('mu')) && $this->getInput('mu'))) {
|
||||||
$this->collectMusicsData();
|
$this->collectMusicsData();
|
||||||
} else {
|
} else {
|
||||||
$this->returnClientError('You must choose a category');
|
$this->returnClientError('You must choose a category');
|
||||||
|
|
|
@ -16,11 +16,10 @@ class SoundCloudBridge extends BridgeAbstract{
|
||||||
const CLIENT_ID = '0aca19eae3843844e4053c6d8fdb7875';
|
const CLIENT_ID = '0aca19eae3843844e4053c6d8fdb7875';
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
$res = json_decode($this->getContents(
|
$res = json_decode($this->getContents(
|
||||||
'https://api.soundcloud.com/resolve?url=http://www.soundcloud.com/'
|
'https://api.soundcloud.com/resolve?url=http://www.soundcloud.com/'
|
||||||
. urlencode($param['u']['value'])
|
. urlencode($this->getInput('u'))
|
||||||
.'&client_id=' . self::CLIENT_ID
|
.'&client_id=' . self::CLIENT_ID
|
||||||
)) or $this->returnServerError('No results for this query');
|
)) or $this->returnServerError('No results for this query');
|
||||||
$tracks = json_decode($this->getContents(
|
$tracks = json_decode($this->getContents(
|
||||||
|
@ -35,18 +34,17 @@ class SoundCloudBridge extends BridgeAbstract{
|
||||||
$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'] = 'https://soundcloud.com/'
|
||||||
. urlencode($param['u']['value']) .'/'
|
. urlencode($this->getInput('u')) .'/'
|
||||||
. urlencode($tracks[$i]->permalink);
|
. urlencode($tracks[$i]->permalink);
|
||||||
$item['uri'] = 'https://soundcloud.com/'
|
$item['uri'] = 'https://soundcloud.com/'
|
||||||
. urlencode($param['u']['value']) .'/'
|
. urlencode($this->getInput('u')) .'/'
|
||||||
. urlencode($tracks[$i]->permalink);
|
. urlencode($tracks[$i]->permalink);
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public function getName(){
|
public function getName(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
return $this->name .' - '. $this->getInput('u');
|
||||||
return $this->name .' - '. $param['u']['value'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCacheDuration(){
|
public function getCacheDuration(){
|
||||||
|
|
|
@ -22,15 +22,14 @@ class SuperbWallpapersBridge extends BridgeAbstract {
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = '';
|
$html = '';
|
||||||
$baseUri = 'http://www.superbwallpapers.com';
|
$baseUri = 'http://www.superbwallpapers.com';
|
||||||
|
|
||||||
$this->category = $param['c']['value'] ?: ''; // All default
|
$this->category = $this->getInput('c') ?: ''; // All default
|
||||||
$this->resolution = $param['r']['value'] ?: '1920x1200'; // Wide wallpaper default
|
$this->resolution = $this->getInput('r') ?: '1920x1200'; // Wide wallpaper default
|
||||||
|
|
||||||
$num = 0;
|
$num = 0;
|
||||||
$max = $param['m']['value'] ?: 36;
|
$max = $this->getInput('m') ?: 36;
|
||||||
$lastpage = 1;
|
$lastpage = 1;
|
||||||
|
|
||||||
// Get last page number
|
// Get last page number
|
||||||
|
|
|
@ -14,7 +14,6 @@ class T411Bridge extends BridgeAbstract {
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
//Utility function for retrieving text based on start and end delimiters
|
//Utility function for retrieving text based on start and end delimiters
|
||||||
function ExtractFromDelimiters($string, $start, $end) {
|
function ExtractFromDelimiters($string, $start, $end) {
|
||||||
|
@ -26,12 +25,12 @@ class T411Bridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
//Ensure proper parameters have been provided
|
//Ensure proper parameters have been provided
|
||||||
if (empty($param['search']['value'])) {
|
if (empty($this->getInput('search'))) {
|
||||||
$this->returnClientError('You must specify a search criteria');
|
$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/?'.$param['search']['value'].'&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))
|
||||||
|
|
|
@ -14,9 +14,8 @@ class TagBoardBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = '';
|
$html = '';
|
||||||
$this->request = $param['u']['value'];
|
$this->request = $this->getInput('u');
|
||||||
$link = 'https://post-cache.tagboard.com/search/' .$this->request;
|
$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);
|
||||||
|
|
|
@ -15,15 +15,14 @@ class TbibBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$page = 0;$tags='';
|
$page = 0;$tags='';
|
||||||
if (isset($param['p']['value'])) {
|
if (isset($this->getInput('p'))) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
|
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
|
||||||
$page = $page - 1;
|
$page = $page - 1;
|
||||||
$page = $page * 50;
|
$page = $page * 50;
|
||||||
}
|
}
|
||||||
if (isset($param['t']['value'])) {
|
if (isset($this->getInput('t'))) {
|
||||||
$tags = urlencode($param['t']['value']);
|
$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("http://tbib.org/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Tbib.');
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ class ThePirateBayBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
function parseDateTimestamp($element){
|
function parseDateTimestamp($element){
|
||||||
$guessedDate = $element->find('font',0)->plaintext;
|
$guessedDate = $element->find('font',0)->plaintext;
|
||||||
|
@ -50,10 +49,10 @@ class ThePirateBayBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!isset($param['q']['value']))
|
if (!isset($this->getInput('q')))
|
||||||
$this->returnClientError('You must specify keywords (?q=...)');
|
$this->returnClientError('You must specify keywords (?q=...)');
|
||||||
|
|
||||||
$keywordsList = explode(";",$param['q']['value']);
|
$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('https://thepiratebay.org/search/'.rawurlencode($keywords).'/0/3/0') or $this->returnServerError('Could not request TPB.');
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ class TwitchApiBridge extends BridgeAbstract{
|
||||||
);
|
);
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
/* In accordance with API description:
|
/* In accordance with API description:
|
||||||
* "When specifying a version for a request to the Twitch API, set the Accept HTTP header to the API version you prefer."
|
* "When specifying a version for a request to the Twitch API, set the Accept HTTP header to the API version you prefer."
|
||||||
|
@ -40,11 +39,11 @@ class TwitchApiBridge extends BridgeAbstract{
|
||||||
|
|
||||||
$context = stream_context_create($opts);
|
$context = stream_context_create($opts);
|
||||||
|
|
||||||
if(!isset($param['limit']['value']) ||
|
if(!isset($this->getInput('limit')) ||
|
||||||
empty($param['limit']['value'])){
|
empty($this->getInput('limit'))){
|
||||||
$limit = TWITCH_LIMIT;
|
$limit = TWITCH_LIMIT;
|
||||||
}else{
|
}else{
|
||||||
$limit = (int)$param['limit']['value'];
|
$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.
|
||||||
|
@ -55,7 +54,7 @@ class TwitchApiBridge extends BridgeAbstract{
|
||||||
if($limit % 100 != 0) { $requests++; }
|
if($limit % 100 != 0) { $requests++; }
|
||||||
}
|
}
|
||||||
|
|
||||||
if($param['broadcasts']['value']){
|
if($this->getInput('broadcasts')){
|
||||||
$broadcasts='true';
|
$broadcasts='true';
|
||||||
}else{
|
}else{
|
||||||
$broadcasts='false';
|
$broadcasts='false';
|
||||||
|
@ -66,9 +65,9 @@ class TwitchApiBridge extends BridgeAbstract{
|
||||||
$request = '';
|
$request = '';
|
||||||
|
|
||||||
if($requests == 1) {
|
if($requests == 1) {
|
||||||
$request = 'https://api.twitch.tv/kraken/channels/' . $param['channel']['value'] . '/videos?limit=' . $limit . '&broadcasts=' . $broadcasts;
|
$request = 'https://api.twitch.tv/kraken/channels/' . $this->getInput('channel') . '/videos?limit=' . $limit . '&broadcasts=' . $broadcasts;
|
||||||
} else {
|
} else {
|
||||||
$request = 'https://api.twitch.tv/kraken/channels/' . $param['channel']['value'] . '/videos?limit=100&broadcasts=' . $broadcasts;
|
$request = 'https://api.twitch.tv/kraken/channels/' . $this->getInput('channel') . '/videos?limit=100&broadcasts=' . $broadcasts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Finally we're ready to request data from the API. Each response provides information for the next request. */
|
/* Finally we're ready to request data from the API. Each response provides information for the next request. */
|
||||||
|
@ -106,8 +105,7 @@ class TwitchApiBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
return $this->getInput('channel') . ' - Twitch API Bridge';
|
||||||
return $param['channel']['value'] . ' - Twitch API Bridge';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCacheDuration(){
|
public function getCacheDuration(){
|
||||||
|
|
|
@ -45,23 +45,20 @@ class TwitterBridge extends BridgeAbstract{
|
||||||
$param='u';
|
$param='u';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 'Twitter '.$specific
|
return 'Twitter '.$specific.$this->getInput($param);
|
||||||
.$this->parameters[$this->queriedContext][$param]['value'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getURI(){
|
public function getURI(){
|
||||||
$params=$this->parameters[$this->queriedContext];
|
|
||||||
switch($this->queriedContext){
|
switch($this->queriedContext){
|
||||||
case 'By keyword or hashtag':
|
case 'By keyword or hashtag':
|
||||||
return $this->uri.'search?q='.urlencode($params['q']['value']).'&f=tweets';
|
return $this->uri.'search?q='.urlencode($this->getInput('q')).'&f=tweets';
|
||||||
case 'By username':
|
case 'By username':
|
||||||
return $this->uri.urlencode($params['u']['value']).
|
return $this->uri.urlencode($this->getInput('u')).
|
||||||
($params['norep']['value']?'':'/with_replies');
|
($this->getInput('norep')?'':'/with_replies');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = '';
|
$html = '';
|
||||||
|
|
||||||
$html = $this->getSimpleHTMLDOM($this->getURI());
|
$html = $this->getSimpleHTMLDOM($this->getURI());
|
||||||
|
@ -74,7 +71,7 @@ class TwitterBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$hidePictures = $param['nopic']['value'];
|
$hidePictures = $this->getInput('nopic');
|
||||||
|
|
||||||
foreach($html->find('div.js-stream-tweet') as $tweet) {
|
foreach($html->find('div.js-stream-tweet') as $tweet) {
|
||||||
$item = array();
|
$item = array();
|
||||||
|
|
|
@ -22,15 +22,14 @@ class UnsplashBridge extends BridgeAbstract {
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = '';
|
$html = '';
|
||||||
$baseUri = 'http://unsplash.com';
|
$baseUri = 'http://unsplash.com';
|
||||||
|
|
||||||
$width = $param['w']['value'] ?: '1920'; // Default width
|
$width = $this->getInput('w') ?: '1920'; // Default width
|
||||||
|
|
||||||
$num = 0;
|
$num = 0;
|
||||||
$max = $param['m']['value'] ?: 20;
|
$max = $this->getInput('m') ?: 20;
|
||||||
$quality = $param['q']['value'] ?: 75;
|
$quality = $this->getInput('q') ?: 75;
|
||||||
$lastpage = 1;
|
$lastpage = 1;
|
||||||
|
|
||||||
for ($page = 1; $page <= $lastpage; $page++) {
|
for ($page = 1; $page <= $lastpage; $page++) {
|
||||||
|
|
|
@ -14,9 +14,8 @@ class ViadeoCompany extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = '';
|
$html = '';
|
||||||
$link = 'http://www.viadeo.com/fr/company/'.$param['c']['value'];
|
$link = 'http://www.viadeo.com/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.');
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,8 @@ class VineBridge extends BridgeAbstract {
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = '';
|
$html = '';
|
||||||
$uri = 'http://vine.co/u/'.$param['u']['value'].'?mode=list';
|
$uri = 'http://vine.co/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.');
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,9 @@ class VkBridge extends BridgeAbstract {
|
||||||
);
|
);
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = '';
|
$html = '';
|
||||||
if (isset($param['u']['value'])) {
|
if (isset($this->getInput('u'))) {
|
||||||
$text_html = $this->getSimpleHTMLDOM(urldecode($param['u']['value']))
|
$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);
|
||||||
|
|
|
@ -25,19 +25,18 @@ class WallpaperStopBridge extends BridgeAbstract {
|
||||||
|
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = '';
|
$html = '';
|
||||||
if (!isset($param['c']['value'])) {
|
if (!isset($this->getInput('c'))) {
|
||||||
$this->returnClientError('You must specify at least a category (?c=...).');
|
$this->returnClientError('You must specify at least a category (?c=...).');
|
||||||
} else {
|
} else {
|
||||||
$baseUri = 'http://www.wallpaperstop.com';
|
$baseUri = 'http://www.wallpaperstop.com';
|
||||||
|
|
||||||
$this->category = $param['c']['value'];
|
$this->category = $this->getInput('c');
|
||||||
$this->subcategory = $param['s']['value'] ?: '';
|
$this->subcategory = $this->getInput('s') ?: '';
|
||||||
$this->resolution = $param['r']['value'] ?: '1920x1200'; // Wide wallpaper default
|
$this->resolution = $this->getInput('r') ?: '1920x1200'; // Wide wallpaper default
|
||||||
|
|
||||||
$num = 0;
|
$num = 0;
|
||||||
$max = $param['m']['value'] ?: 20;
|
$max = $this->getInput('m') ?: 20;
|
||||||
$lastpage = 1;
|
$lastpage = 1;
|
||||||
|
|
||||||
for ($page = 1; $page <= $lastpage; $page++) {
|
for ($page = 1; $page <= $lastpage; $page++) {
|
||||||
|
|
|
@ -14,20 +14,19 @@ class WhydBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$html = '';
|
$html = '';
|
||||||
if (strlen(preg_replace("/[^0-9a-f]/",'', $param['u']['value'])) == 24){
|
if (strlen(preg_replace("/[^0-9a-f]/",'', $this->getInput('u'))) == 24){
|
||||||
// is input the userid ?
|
// is input the userid ?
|
||||||
$html = $this->getSimpleHTMLDOM(
|
$html = $this->getSimpleHTMLDOM(
|
||||||
$this->uri.'u/'.preg_replace("/[^0-9a-f]/",'', $param['u']['value'])
|
$this->uri.'u/'.preg_replace("/[^0-9a-f]/",'', $this->getInput('u'))
|
||||||
) or $this->returnServerError('No results for this query.');
|
) or $this->returnServerError('No results for this query.');
|
||||||
} else { // input may be the username
|
} else { // input may be the username
|
||||||
$html = $this->getSimpleHTMLDOM(
|
$html = $this->getSimpleHTMLDOM(
|
||||||
$this->uri.'search?q='.urlencode($param['u']['value'])
|
$this->uri.'search?q='.urlencode($this->getInput('u'))
|
||||||
) or $this->returnServerError('No results for this query.');
|
) or $this->returnServerError('No results for this query.');
|
||||||
|
|
||||||
for ($j = 0; $j < 5; $j++) {
|
for ($j = 0; $j < 5; $j++) {
|
||||||
if (strtolower($html->find('div.user', $j)->find('a',0)->plaintext) == strtolower($param['u']['value'])) {
|
if (strtolower($html->find('div.user', $j)->find('a',0)->plaintext) == strtolower($this->getInput('u'))) {
|
||||||
$html = $this->getSimpleHTMLDOM(
|
$html = $this->getSimpleHTMLDOM(
|
||||||
$this->uri . $html->find('div.user', $j)->find('a', 0)->getAttribute('href')
|
$this->uri . $html->find('div.user', $j)->find('a', 0)->getAttribute('href')
|
||||||
) or $this->returnServerError('No results for this query');
|
) or $this->returnServerError('No results for this query');
|
||||||
|
|
|
@ -43,13 +43,11 @@ class WikipediaBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function getURI(){
|
public function getURI(){
|
||||||
$params=$this->parameters[$this->queriedContext];
|
return 'https://' . strtolower($this->getInput('language')) . '.wikipedia.org';
|
||||||
return 'https://' . strtolower($params['language']['value']) . '.wikipedia.org';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName(){
|
||||||
$params=$this->parameters[$this->queriedContext];
|
switch($this->getInput('subject')){
|
||||||
switch($params['subject']['value']){
|
|
||||||
case 'tfa':
|
case 'tfa':
|
||||||
$subject = WIKIPEDIA_SUBJECT_TFA;
|
$subject = WIKIPEDIA_SUBJECT_TFA;
|
||||||
break;
|
break;
|
||||||
|
@ -63,22 +61,21 @@ class WikipediaBridge extends BridgeAbstract{
|
||||||
|
|
||||||
switch($subject){
|
switch($subject){
|
||||||
case WIKIPEDIA_SUBJECT_TFA:
|
case WIKIPEDIA_SUBJECT_TFA:
|
||||||
$name = 'Today\'s featured article from ' . strtolower($params['language']['value']) . '.wikipedia.org';
|
$name = 'Today\'s featured article from ' . strtolower($this->getInput('language')) . '.wikipedia.org';
|
||||||
break;
|
break;
|
||||||
case WIKIPEDIA_SUBJECT_DYK:
|
case WIKIPEDIA_SUBJECT_DYK:
|
||||||
$name = 'Did you know? - articles from ' . strtolower($params['language']['value']) . '.wikipedia.org';
|
$name = 'Did you know? - articles from ' . strtolower($this->getInput('language')) . '.wikipedia.org';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$name = 'Articles from ' . strtolower($params['language']['value']) . '.wikipedia.org';
|
$name = 'Articles from ' . strtolower($this->getInput('language')) . '.wikipedia.org';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $name;
|
return $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$params=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
switch($params['subject']['value']){
|
switch($this->getInput('subject')){
|
||||||
case 'tfa':
|
case 'tfa':
|
||||||
$subject = WIKIPEDIA_SUBJECT_TFA;
|
$subject = WIKIPEDIA_SUBJECT_TFA;
|
||||||
break;
|
break;
|
||||||
|
@ -90,7 +87,7 @@ class WikipediaBridge extends BridgeAbstract{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fullArticle = $params['fullarticle']['value'];
|
$fullArticle = $this->getInput('fullarticle');
|
||||||
|
|
||||||
// This will automatically send us to the correct main page in any language (try it!)
|
// This will automatically send us to the correct main page in any language (try it!)
|
||||||
$html = $this->getSimpleHTMLDOM($this->getURI() . '/wiki');
|
$html = $this->getSimpleHTMLDOM($this->getURI() . '/wiki');
|
||||||
|
@ -103,7 +100,7 @@ class WikipediaBridge extends BridgeAbstract{
|
||||||
* We build the function name automatically, just make sure you create a private function ending
|
* We build the function name automatically, just make sure you create a private function ending
|
||||||
* with your desired language code, where the language code is upper case! (en -> GetContentsEN).
|
* with your desired language code, where the language code is upper case! (en -> GetContentsEN).
|
||||||
*/
|
*/
|
||||||
$function = 'GetContents' . strtoupper($params['language']['value']);
|
$function = 'GetContents' . strtoupper($this->getInput('language'));
|
||||||
|
|
||||||
if(!method_exists($this, $function))
|
if(!method_exists($this, $function))
|
||||||
$this->returnServerError('A function to get the contents for your language is missing (\'' . $function . '\')!');
|
$this->returnServerError('A function to get the contents for your language is missing (\'' . $function . '\')!');
|
||||||
|
|
|
@ -41,7 +41,6 @@ class WordPressBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
$html = $this->getSimpleHTMLDOM($this->getURI().'/feed/atom')
|
$html = $this->getSimpleHTMLDOM($this->getURI().'/feed/atom')
|
||||||
or $this->returnServerError("Could not request ".$this->getURI().'/feed/atom');
|
or $this->returnServerError("Could not request ".$this->getURI().'/feed/atom');
|
||||||
|
@ -119,8 +118,7 @@ class WordPressBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getURI(){
|
public function getURI(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
return $this->getInput('url');
|
||||||
return $param['url']['value'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName() {
|
public function getName() {
|
||||||
|
|
|
@ -27,15 +27,14 @@ class WorldOfTanksBridge extends HttpCachingBridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
function getURI(){
|
function getURI(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$lang='fr';
|
$lang='fr';
|
||||||
if (!empty($param['lang']['value'])) {
|
if (!empty($this->getInput('lang'))) {
|
||||||
$lang = $param['lang']['value'];
|
$lang = $this->getInput('lang');
|
||||||
}
|
}
|
||||||
|
|
||||||
$uri = $this->uri.$lang.'/news/';
|
$uri = $this->uri.$lang.'/news/';
|
||||||
if(!empty($param['category']['value'])) {
|
if(!empty($this->getInput('category'))) {
|
||||||
$uri .= 'pc-browser/'.$param['category']['value']."/";
|
$uri .= 'pc-browser/'.$this->getInput('category')."/";
|
||||||
}
|
}
|
||||||
return $uri;
|
return $uri;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,15 +15,14 @@ class XbooruBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$page = 0;$tags='';
|
$page = 0;$tags='';
|
||||||
if (isset($param['p']['value'])) {
|
if (isset($this->getInput('p'))) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
|
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
|
||||||
$page = $page - 1;
|
$page = $page - 1;
|
||||||
$page = $page * 50;
|
$page = $page * 50;
|
||||||
}
|
}
|
||||||
if (isset($param['t']['value'])) {
|
if (isset($this->getInput('t'))) {
|
||||||
$tags = urlencode($param['t']['value']);
|
$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("http://xbooru.com/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Xbooru.');
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,12 @@ class YandereBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
$page = 1; $tags = '';
|
$page = 1; $tags = '';
|
||||||
if (isset($param['p']['value'])) {
|
if (isset($this->getInput('p'))) {
|
||||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
|
$page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
|
||||||
}
|
}
|
||||||
if (isset($param['t']['value'])) {
|
if (isset($this->getInput('t'))) {
|
||||||
$tags = urlencode($param['t']['value']);
|
$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("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);
|
||||||
|
|
|
@ -102,19 +102,18 @@ class YoutubeBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
$xml = '';
|
$xml = '';
|
||||||
$html = '';
|
$html = '';
|
||||||
$url_feed = '';
|
$url_feed = '';
|
||||||
$url_listing = '';
|
$url_listing = '';
|
||||||
|
|
||||||
if (isset($param['u']['value'])) { /* User and Channel modes */
|
if (isset($this->getInput('u'))) { /* User and Channel modes */
|
||||||
$this->request = $param['u']['value'];
|
$this->request = $this->getInput('u');
|
||||||
$url_feed = $this->uri.'feeds/videos.xml?user='.urlencode($this->request);
|
$url_feed = $this->uri.'feeds/videos.xml?user='.urlencode($this->request);
|
||||||
$url_listing = $this->uri.'user/'.urlencode($this->request).'/videos';
|
$url_listing = $this->uri.'user/'.urlencode($this->request).'/videos';
|
||||||
} else if (isset($param['c']['value'])) {
|
} else if (isset($this->getInput('c'))) {
|
||||||
$this->request = $param['c']['value'];
|
$this->request = $this->getInput('c');
|
||||||
$url_feed = $this->uri.'feeds/videos.xml?channel_id='.urlencode($this->request);
|
$url_feed = $this->uri.'feeds/videos.xml?channel_id='.urlencode($this->request);
|
||||||
$url_listing = $this->uri.'channel/'.urlencode($this->request).'/videos';
|
$url_listing = $this->uri.'channel/'.urlencode($this->request).'/videos';
|
||||||
}
|
}
|
||||||
|
@ -126,16 +125,16 @@ class YoutubeBridge extends BridgeAbstract {
|
||||||
} else $this->returnServerError("Could not request YouTube. Tried:\n - $url_feed\n - $url_listing");
|
} else $this->returnServerError("Could not request YouTube. Tried:\n - $url_feed\n - $url_listing");
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (isset($param['p']['value'])) { /* playlist mode */
|
else if (isset($this->getInput('p'))) { /* playlist mode */
|
||||||
$this->request = $param['p']['value'];
|
$this->request = $this->getInput('p');
|
||||||
$url_listing = $this->uri.'playlist?list='.urlencode($this->request);
|
$url_listing = $this->uri.'playlist?list='.urlencode($this->request);
|
||||||
$html = $this->getSimpleHTMLDOM($url_listing) or $this->returnServerError("Could not request YouTube. Tried:\n - $url_listing");
|
$html = $this->getSimpleHTMLDOM($url_listing) or $this->returnServerError("Could not request YouTube. Tried:\n - $url_listing");
|
||||||
$this->ytBridgeParseHtmlListing($html, 'tr.pl-video', '.pl-video-title a');
|
$this->ytBridgeParseHtmlListing($html, 'tr.pl-video', '.pl-video-title a');
|
||||||
$this->request = 'Playlist: '.str_replace(' - YouTube', '', $html->find('title', 0)->plaintext);
|
$this->request = 'Playlist: '.str_replace(' - YouTube', '', $html->find('title', 0)->plaintext);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (isset($param['s']['value'])) { /* search mode */
|
else if (isset($this->getInput('s'))) { /* search mode */
|
||||||
$this->request = $param['s']['value']; $page = 1; if (isset($param['pa']['value'])) $page = (int)preg_replace("/[^0-9]/",'', $param['pa']['value']);
|
$this->request = $this->getInput('s'); $page = 1; if (isset($this->getInput('pa'))) $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('pa'));
|
||||||
$url_listing = $this->uri.'results?search_query='.urlencode($this->request).'&page='.$page.'&filters=video&search_sort=video_date_uploaded';
|
$url_listing = $this->uri.'results?search_query='.urlencode($this->request).'&page='.$page.'&filters=video&search_sort=video_date_uploaded';
|
||||||
$html = $this->getSimpleHTMLDOM($url_listing) or $this->returnServerError("Could not request YouTube. Tried:\n - $url_listing");
|
$html = $this->getSimpleHTMLDOM($url_listing) or $this->returnServerError("Could not request YouTube. Tried:\n - $url_listing");
|
||||||
$this->ytBridgeParseHtmlListing($html, 'div.yt-lockup', 'h3');
|
$this->ytBridgeParseHtmlListing($html, 'div.yt-lockup', 'h3');
|
||||||
|
|
|
@ -160,7 +160,6 @@ class ZDNetBridge extends BridgeAbstract {
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
function StripCDATA($string) {
|
function StripCDATA($string) {
|
||||||
$string = str_replace('<![CDATA[', '', $string);
|
$string = str_replace('<![CDATA[', '', $string);
|
||||||
|
@ -209,7 +208,7 @@ class ZDNetBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
$baseUri = $this->getURI();
|
$baseUri = $this->getURI();
|
||||||
$feed = $param['feed']['value'];
|
$feed = $this->getInput('feed');
|
||||||
if (empty($feed))
|
if (empty($feed))
|
||||||
$this->returnClientError('Please select a feed to display.');
|
$this->returnClientError('Please select a feed to display.');
|
||||||
if (strpos($feed, 'downloads!') !== false) {
|
if (strpos($feed, 'downloads!') !== false) {
|
||||||
|
|
|
@ -11,7 +11,6 @@ class ZoneTelechargementBridge extends BridgeAbstract {
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
function StripCDATA($string) {
|
function StripCDATA($string) {
|
||||||
$string = str_replace('<![CDATA[', '', $string);
|
$string = str_replace('<![CDATA[', '', $string);
|
||||||
|
@ -20,8 +19,8 @@ class ZoneTelechargementBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
$category = '/';
|
$category = '/';
|
||||||
if (!empty($param['category']['value']))
|
if (!empty($this->getInput('category')))
|
||||||
$category = '/'.$param['category']['value'].'/';
|
$category = '/'.$this->getInput('category').'/';
|
||||||
|
|
||||||
$url = $this->getURI().$category.'rss.xml';
|
$url = $this->getURI().$category.'rss.xml';
|
||||||
$html = $this->getSimpleHTMLDOM($url) or $this->returnServerError('Could not request Zone Telechargement: '.$url);
|
$html = $this->getSimpleHTMLDOM($url) or $this->returnServerError('Could not request Zone Telechargement: '.$url);
|
||||||
|
|
|
@ -120,6 +120,7 @@ abstract class BridgeAbstract implements BridgeInterface {
|
||||||
public $maintainer = 'No maintainer';
|
public $maintainer = 'No maintainer';
|
||||||
public $useProxy = true;
|
public $useProxy = true;
|
||||||
public $parameters = array();
|
public $parameters = array();
|
||||||
|
public $inputs = array();
|
||||||
protected $queriedContext='';
|
protected $queriedContext='';
|
||||||
|
|
||||||
protected function returnError($message, $code){
|
protected function returnError($message, $code){
|
||||||
|
@ -271,6 +272,7 @@ abstract class BridgeAbstract implements BridgeInterface {
|
||||||
foreach($inputs as $name=>$value){
|
foreach($inputs as $name=>$value){
|
||||||
foreach($this->parameters as $context=>$set){
|
foreach($this->parameters as $context=>$set){
|
||||||
if(isset($this->parameters[$context][$name])){
|
if(isset($this->parameters[$context][$name])){
|
||||||
|
$this->inputs[$context][$name]['value']=$value;
|
||||||
$this->parameters[$context][$name]['value']=$value;
|
$this->parameters[$context][$name]['value']=$value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -302,9 +304,9 @@ abstract class BridgeAbstract implements BridgeInterface {
|
||||||
switch($properties['type']){
|
switch($properties['type']){
|
||||||
case 'checkbox':
|
case 'checkbox':
|
||||||
if(!isset($properties['defaultValue'])){
|
if(!isset($properties['defaultValue'])){
|
||||||
$this->parameters[$context][$name]['value']=false;
|
$this->inputs[$context][$name]['value']=false;
|
||||||
}else{
|
}else{
|
||||||
$this->parameters[$context][$name]['value']=$properties['defaultValue'];
|
$this->inputs[$context][$name]['value']=$properties['defaultValue'];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -312,6 +314,7 @@ abstract class BridgeAbstract implements BridgeInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy global parameter values to the guessed context
|
// Copy global parameter values to the guessed context
|
||||||
|
if(isset($this->parameters['global'])){
|
||||||
foreach($this->parameters['global'] as $name=>$properties){
|
foreach($this->parameters['global'] as $name=>$properties){
|
||||||
if(isset($inputs[$name])){
|
if(isset($inputs[$name])){
|
||||||
$value=$inputs[$name];
|
$value=$inputs[$name];
|
||||||
|
@ -320,8 +323,12 @@ abstract class BridgeAbstract implements BridgeInterface {
|
||||||
}else{
|
}else{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$this->parameters[$queriedContext][$name]['value']=$value;
|
$this->inputs[$queriedContext][$name]['value']=$value;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only keep guessed context parameters values
|
||||||
|
$this->inputs=array($this->queriedContext=>$this->inputs[$this->queriedContext]);
|
||||||
|
|
||||||
$this->collectData();
|
$this->collectData();
|
||||||
|
|
||||||
|
@ -330,6 +337,13 @@ abstract class BridgeAbstract implements BridgeInterface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getInput($input){
|
||||||
|
if(!isset($this->inputs[$this->queriedContext][$input]['value'])){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return $this->inputs[$this->queriedContext][$input]['value'];
|
||||||
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName(){
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue