2016-11-05 18:24:04 +01:00
|
|
|
<?php
|
2017-02-11 16:16:56 +01:00
|
|
|
class Arte7Bridge extends BridgeAbstract {
|
2014-05-26 00:30:46 +02:00
|
|
|
|
2017-02-11 16:16:56 +01:00
|
|
|
const MAINTAINER = 'mitsukarenai';
|
|
|
|
const NAME = 'Arte +7';
|
|
|
|
const URI = 'http://www.arte.tv/';
|
|
|
|
const CACHE_TIMEOUT = 1800; // 30min
|
|
|
|
const DESCRIPTION = 'Returns newest videos from ARTE +7';
|
|
|
|
const PARAMETERS = array(
|
|
|
|
'Catégorie (Français)' => array(
|
|
|
|
'catfr' => array(
|
|
|
|
'type' => 'list',
|
|
|
|
'name' => 'Catégorie',
|
|
|
|
'values' => array(
|
|
|
|
'Toutes les vidéos (français)' => 'toutes-les-videos',
|
|
|
|
'Actu & société' => 'actu-société',
|
|
|
|
'Séries & fiction' => 'séries-fiction',
|
|
|
|
'Cinéma' => 'cinéma',
|
|
|
|
'Arts & spectacles classiques' => 'arts-spectacles-classiques',
|
|
|
|
'Culture pop' => 'culture-pop',
|
|
|
|
'Découverte' => 'découverte',
|
|
|
|
'Histoire' => 'histoire',
|
|
|
|
'Junior' => 'junior'
|
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'Catégorie (Allemand)' => array(
|
|
|
|
'catde' => array(
|
|
|
|
'type' => 'list',
|
|
|
|
'name' => 'Catégorie',
|
|
|
|
'values' => array(
|
|
|
|
'Alle Videos (deutsch)' => 'alle-videos',
|
|
|
|
'Aktuelles & Gesellschaft' => 'aktuelles-gesellschaft',
|
|
|
|
'Fernsehfilme & Serien' => 'fernsehfilme-serien',
|
|
|
|
'Kino' => 'kino',
|
|
|
|
'Kunst & Kultur' => 'kunst-kultur',
|
|
|
|
'Popkultur & Alternativ' => 'popkultur-alternativ',
|
|
|
|
'Entdeckung' => 'entdeckung',
|
|
|
|
'Geschichte' => 'geschichte',
|
|
|
|
'Junior' => 'junior'
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
2015-11-03 15:36:19 +01:00
|
|
|
|
2017-02-11 16:16:56 +01:00
|
|
|
public function collectData(){
|
2017-07-29 19:28:00 +02:00
|
|
|
switch($this->queriedContext) {
|
2017-02-11 16:16:56 +01:00
|
|
|
case 'Catégorie (Français)':
|
|
|
|
$category = $this->getInput('catfr');
|
|
|
|
$lang = 'fr';
|
|
|
|
break;
|
|
|
|
case 'Catégorie (Allemand)':
|
|
|
|
$category = $this->getInput('catde');
|
|
|
|
$lang = 'de';
|
|
|
|
break;
|
|
|
|
}
|
2015-11-03 15:36:19 +01:00
|
|
|
|
2017-02-11 16:16:56 +01:00
|
|
|
$url = self::URI . 'guide/' . $lang . '/plus7/' . $category;
|
|
|
|
$input = getContents($url) or die('Could not request ARTE.');
|
2014-05-26 00:30:46 +02:00
|
|
|
|
2017-07-29 19:28:00 +02:00
|
|
|
if(strpos($input, 'categoryVideoSet') !== false) {
|
2017-02-11 16:16:56 +01:00
|
|
|
$input = explode('categoryVideoSet="', $input);
|
|
|
|
$input = explode('}}', $input[1]);
|
|
|
|
$input = $input[0] . '}}';
|
|
|
|
} else {
|
|
|
|
$input = explode('videoSet="', $input);
|
|
|
|
$input = explode('}]}', $input[1]);
|
|
|
|
$input = $input[0] . '}]}';
|
|
|
|
}
|
2016-08-28 11:50:01 +02:00
|
|
|
|
2017-02-11 16:16:56 +01:00
|
|
|
$input_json = json_decode(html_entity_decode($input, ENT_QUOTES), true);
|
2016-11-05 12:48:58 +01:00
|
|
|
|
2017-02-11 16:16:56 +01:00
|
|
|
foreach($input_json['videos'] as $element) {
|
|
|
|
$item = array();
|
|
|
|
$item['uri'] = str_replace("autoplay=1", "", $element['url']);
|
|
|
|
$item['id'] = $element['id'];
|
2014-05-26 00:30:46 +02:00
|
|
|
|
2017-02-11 16:16:56 +01:00
|
|
|
$hack_broadcast_time = $element['rights_end'];
|
|
|
|
$hack_broadcast_time = strtok($hack_broadcast_time, 'T');
|
|
|
|
$hack_broadcast_time = strtok('T');
|
|
|
|
|
|
|
|
$item['timestamp'] = strtotime($element['scheduled_on'] . 'T' . $hack_broadcast_time);
|
|
|
|
$item['title'] = $element['title'];
|
|
|
|
|
|
|
|
if(!empty($element['subtitle']))
|
|
|
|
$item['title'] = $element['title'] . ' | ' . $element['subtitle'];
|
|
|
|
|
|
|
|
$item['duration'] = round((int)$element['duration'] / 60);
|
|
|
|
$item['content'] = $element['teaser']
|
|
|
|
. '<br><br>'
|
|
|
|
. $item['duration']
|
|
|
|
. 'min<br><a href="'
|
|
|
|
. $item['uri']
|
|
|
|
. '"><img src="'
|
|
|
|
. $element['thumbnail_url']
|
|
|
|
. '" /></a>';
|
|
|
|
|
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
2014-05-26 00:30:46 +02:00
|
|
|
|
|
|
|
}
|