forked from blallo/rss-bridge
[AllocineFRBridge] fix and simplify code
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
1b3c8a8aeb
commit
fa7cd4a739
1 changed files with 31 additions and 20 deletions
|
@ -16,34 +16,45 @@ class AllocineFRBridge extends BridgeAbstract{
|
|||
'values'=>array(
|
||||
'Faux Raccord'=>'faux-raccord',
|
||||
'Top 5'=>'top-5',
|
||||
'Tueurs En Serie'=>'tuers-en-serie'
|
||||
'Tueurs en Séries'=>'tueurs-en-serie'
|
||||
)
|
||||
)
|
||||
));
|
||||
|
||||
public function collectData(){
|
||||
$category = '';
|
||||
public function getURI(){
|
||||
switch($this->getInput('category')){
|
||||
case 'faux-raccord':
|
||||
$this->uri = 'http://www.allocine.fr/video/programme-12284/saison-24580/';
|
||||
$category = 'Faux Raccord';
|
||||
$uri = 'http://www.allocine.fr/video/programme-12284/saison-24580/';
|
||||
break;
|
||||
case 'top-5':
|
||||
$this->uri = 'http://www.allocine.fr/video/programme-12299/saison-22542/';
|
||||
$category = 'Top 5';
|
||||
$uri = 'http://www.allocine.fr/video/programme-12299/saison-22542/';
|
||||
break;
|
||||
case 'tuers-en-serie':
|
||||
$this->uri = 'http://www.allocine.fr/video/programme-12286/saison-22938/';
|
||||
$category = 'Tueurs en Séries';
|
||||
case 'tueurs-en-serie':
|
||||
$uri = 'http://www.allocine.fr/video/programme-12286/saison-22938/';
|
||||
break;
|
||||
default:
|
||||
$this->returnClientError('You must select a valid category!');
|
||||
}
|
||||
|
||||
// Update bridge name to match selection
|
||||
$this->name .= ' : ' . $category;
|
||||
return $uri;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return $this->name.' : '
|
||||
.array_search(
|
||||
$this->getInput('category'),
|
||||
$this->parameters[$this->queriedContext]['category']['values']
|
||||
);
|
||||
}
|
||||
|
||||
public function collectData(){
|
||||
|
||||
$html = $this->getSimpleHTMLDOM($this->getURI())
|
||||
or $this->returnServerError("Could not request ".$this->getURI()." !");
|
||||
|
||||
$category=array_search(
|
||||
$this->getInput('category'),
|
||||
$this->parameters[$this->queriedContext]['category']['values']
|
||||
);
|
||||
|
||||
$html = $this->getSimpleHTMLDOM($this->uri) or $this->returnServerError("Could not request {$this->uri}!");
|
||||
|
||||
foreach($html->find('figure.media-meta-fig') as $element)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue