[CpasbienBridge] fix and code simplification
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
963bbcc402
commit
a80246a2b3
1 changed files with 6 additions and 11 deletions
|
@ -15,18 +15,14 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$html = '';
|
$request = str_replace(" ","-",trim($this->getInput('q')));
|
||||||
if (isset($this->getInput('q'))) { /* keyword search mode */
|
$html = $this->getSimpleHTMLDOM($this->uri.'/recherche/'.urlencode($request).'.html')
|
||||||
$request = str_replace(" ","-",trim($this->getInput('q')));
|
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 {
|
|
||||||
$this->returnClientError('You must specify a keyword (?q=...).');
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($html->find('#gauche',0)->find('div') as $episode) {
|
foreach ($html->find('#gauche',0)->find('div') as $episode) {
|
||||||
if ($episode->getAttribute('class')=='ligne0' || $episode->getAttribute('class')=='ligne1')
|
if ($episode->getAttribute('class')=='ligne0' ||
|
||||||
|
$episode->getAttribute('class')=='ligne1')
|
||||||
{
|
{
|
||||||
|
|
||||||
$htmlepisode=str_get_html($this->get_cached($episode->find('a', 0)->getAttribute('href')));
|
$htmlepisode=str_get_html($this->get_cached($episode->find('a', 0)->getAttribute('href')));
|
||||||
|
|
||||||
$item = array();
|
$item = array();
|
||||||
|
@ -52,8 +48,7 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
|
||||||
|
|
||||||
|
|
||||||
public function getName(){
|
public function getName(){
|
||||||
return $this->parameters[$this->queriedContext]['q']['value']
|
return $this->getInput('q').' : '.$this->name;
|
||||||
.' : '.$this->name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCacheDuration(){
|
public function getCacheDuration(){
|
||||||
|
|
Loading…
Add table
Reference in a new issue