1
0
Fork 0
forked from blallo/rss-bridge

Merge pull request #206 from lagaisse/CpasbienBridge

Change url again & constant factorization
This commit is contained in:
Mitsu 2016-01-26 21:08:36 +01:00
commit 57de433553

View file

@ -22,15 +22,17 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
$this->maintainer = "lagaisse"; $this->maintainer = "lagaisse";
$this->name = "Cpasbien Bridge"; $this->name = "Cpasbien Bridge";
$this->uri = "http://Cpasbien.pw/"; $this->uri = "http://www.cpasbien.io";
$this->description = "Returns latest torrent from request query"; $this->description = "Returns latest torrents from a request query";
$this->update = "2015-05-17"; $this->update = "2016-01-26";
$this->parameters[] = $this->parameters[] =
'[ '[
{ {
"name" : "keyword", "name" : "Search",
"identifier" : "q" "identifier" : "q",
"required" : true,
"title" : "Type your search"
} }
]'; ]';
@ -38,10 +40,11 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
public function collectData(array $param){ public function collectData(array $param){
$this->loadMetadatas();
$html = ''; $html = '';
if (isset($param['q'])) { /* keyword search mode */ if (isset($param['q'])) { /* keyword search mode */
$this->request = str_replace(" ","-",trim($param['q'])); $this->request = str_replace(" ","-",trim($param['q']));
$html = file_get_html('http://www.cpasbien.pw/recherche/'.urlencode($this->request).'.html') or $this->returnError('No results for this query.', 404); $html = file_get_html($this->uri.'/recherche/'.urlencode($this->request).'.html') or $this->returnError('No results for this query.', 404);
} }
else { else {
$this->returnError('You must specify a keyword (?q=...).', 400); $this->returnError('You must specify a keyword (?q=...).', 400);
@ -66,7 +69,7 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
} }
$item->id = $episode->find('a', 0)->getAttribute('href'); $item->id = $episode->find('a', 0)->getAttribute('href');
$item->uri = $this->getURI() . $htmlepisode->find('#telecharger',0)->getAttribute('href'); $item->uri = $this->uri . $htmlepisode->find('#telecharger',0)->getAttribute('href');
$item->thumbnailUri = $htmlepisode->find('#bigcover', 0)->find('img',0)->getAttribute('src'); $item->thumbnailUri = $htmlepisode->find('#bigcover', 0)->find('img',0)->getAttribute('src');
$this->items[] = $item; $this->items[] = $item;
} }
@ -77,11 +80,11 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
public function getName(){ public function getName(){
return (!empty($this->request) ? $this->request .' - ' : '') .'Cpasbien Bridge'; return (!empty($this->request) ? $this->request .' - ' : '') . $this->name;
} }
public function getURI(){ public function getURI(){
return 'http://www.cpasbien.pw'; return $this->uri;
} }
public function getCacheDuration(){ public function getCacheDuration(){