[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(
|
'values'=>array(
|
||||||
'Faux Raccord'=>'faux-raccord',
|
'Faux Raccord'=>'faux-raccord',
|
||||||
'Top 5'=>'top-5',
|
'Top 5'=>'top-5',
|
||||||
'Tueurs En Serie'=>'tuers-en-serie'
|
'Tueurs en Séries'=>'tueurs-en-serie'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function getURI(){
|
||||||
$category = '';
|
|
||||||
switch($this->getInput('category')){
|
switch($this->getInput('category')){
|
||||||
case 'faux-raccord':
|
case 'faux-raccord':
|
||||||
$this->uri = 'http://www.allocine.fr/video/programme-12284/saison-24580/';
|
$uri = 'http://www.allocine.fr/video/programme-12284/saison-24580/';
|
||||||
$category = 'Faux Raccord';
|
|
||||||
break;
|
break;
|
||||||
case 'top-5':
|
case 'top-5':
|
||||||
$this->uri = 'http://www.allocine.fr/video/programme-12299/saison-22542/';
|
$uri = 'http://www.allocine.fr/video/programme-12299/saison-22542/';
|
||||||
$category = 'Top 5';
|
|
||||||
break;
|
break;
|
||||||
case 'tuers-en-serie':
|
case 'tueurs-en-serie':
|
||||||
$this->uri = 'http://www.allocine.fr/video/programme-12286/saison-22938/';
|
$uri = 'http://www.allocine.fr/video/programme-12286/saison-22938/';
|
||||||
$category = 'Tueurs en Séries';
|
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
$this->returnClientError('You must select a valid category!');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update bridge name to match selection
|
return $uri;
|
||||||
$this->name .= ' : ' . $category;
|
}
|
||||||
|
|
||||||
|
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)
|
foreach($html->find('figure.media-meta-fig') as $element)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue