forked from blallo/rss-bridge
[Arte7bridge] code simplification
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
fb05976fa6
commit
ff5ac1659f
1 changed files with 23 additions and 22 deletions
|
@ -43,8 +43,20 @@
|
|||
)
|
||||
);
|
||||
|
||||
protected function extractVideoset($category='toutes-les-videos', $lang='fr'){
|
||||
$url = 'http://www.arte.tv/guide/'.$lang.'/plus7/'.$category;
|
||||
public function collectData(){
|
||||
|
||||
switch($this->queriedContext){
|
||||
case 'Catégorie (Français)':
|
||||
$category=$this->getInput('catfr');
|
||||
$lang='fr';
|
||||
break;
|
||||
case 'Catégorie (Allemand)':
|
||||
$category=$this->getInput('catde');
|
||||
$lang='de';
|
||||
break;
|
||||
}
|
||||
|
||||
$url = $this->uri.'guide/'.$lang.'/plus7/'.$category;
|
||||
$input = $this->getContents($url) or die('Could not request ARTE.');
|
||||
if(strpos($input, 'categoryVideoSet') !== FALSE){
|
||||
$input = explode('categoryVideoSet: ', $input);
|
||||
|
@ -55,18 +67,7 @@
|
|||
$input = explode('}]},', $input[1]);
|
||||
$input = $input[0].'}]}';
|
||||
}
|
||||
$input = json_decode($input, TRUE);
|
||||
return $input;
|
||||
}
|
||||
|
||||
public function collectData(){
|
||||
|
||||
$category='toutes-les-videos'; $lang='fr';
|
||||
if (!empty($this->getInput('catfr')))
|
||||
$category=$this->getInput('catfr');
|
||||
if (!empty($this->getInput('catde')))
|
||||
{ $category=$this->getInput('catde'); $lang='de'; }
|
||||
$input_json = $this->extractVideoset($category, $lang);
|
||||
$input_json = json_decode($input, TRUE);
|
||||
|
||||
foreach($input_json['videos'] as $element) {
|
||||
$item = array();
|
||||
|
|
Loading…
Reference in a new issue