forked from blallo/rss-bridge
[Arte7Bridge] extract nested function
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
73ec10f9ca
commit
fbf17beae8
1 changed files with 12 additions and 17 deletions
|
@ -45,35 +45,30 @@ class Arte7Bridge extends BridgeAbstract{
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function extractVideoset($category='toutes-les-videos', $lang='fr'){
|
||||||
public function collectData(array $param){
|
$url = 'http://www.arte.tv/guide/'.$lang.'/plus7/'.$category;
|
||||||
|
$input = $this->getContents($url) or die('Could not request ARTE.');
|
||||||
function extractVideoset($category='toutes-les-videos', $lang='fr')
|
if(strpos($input, 'categoryVideoSet') !== FALSE){
|
||||||
{
|
|
||||||
$url = 'http://www.arte.tv/guide/'.$lang.'/plus7/'.$category;
|
|
||||||
$input = $this->getContents($url) or die('Could not request ARTE.');
|
|
||||||
if(strpos($input, 'categoryVideoSet') !== FALSE)
|
|
||||||
{
|
|
||||||
$input = explode('categoryVideoSet: ', $input);
|
$input = explode('categoryVideoSet: ', $input);
|
||||||
$input = explode('}},', $input[1]);
|
$input = explode('}},', $input[1]);
|
||||||
$input = $input[0].'}}';
|
$input = $input[0].'}}';
|
||||||
}
|
}else{
|
||||||
else
|
|
||||||
{
|
|
||||||
$input = explode('videoSet: ', $input);
|
$input = explode('videoSet: ', $input);
|
||||||
$input = explode('}]},', $input[1]);
|
$input = explode('}]},', $input[1]);
|
||||||
$input = $input[0].'}]}';
|
$input = $input[0].'}]}';
|
||||||
}
|
}
|
||||||
$input = json_decode($input, TRUE);
|
$input = json_decode($input, TRUE);
|
||||||
return $input;
|
return $input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function collectData(array $param){
|
||||||
|
|
||||||
$category='toutes-les-videos'; $lang='fr';
|
$category='toutes-les-videos'; $lang='fr';
|
||||||
if (!empty($param['catfr']))
|
if (!empty($param['catfr']))
|
||||||
$category=$param['catfr'];
|
$category=$param['catfr'];
|
||||||
if (!empty($param['catde']))
|
if (!empty($param['catde']))
|
||||||
{ $category=$param['catde']; $lang='de'; }
|
{ $category=$param['catde']; $lang='de'; }
|
||||||
$input_json = extractVideoset($category, $lang);
|
$input_json = $this->extractVideoset($category, $lang);
|
||||||
|
|
||||||
foreach($input_json['videos'] as $element) {
|
foreach($input_json['videos'] as $element) {
|
||||||
$item = array();
|
$item = array();
|
||||||
|
|
Loading…
Reference in a new issue