2014-05-26 00:30:46 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* RssBridgeArte7de
|
|
|
|
* Returns images from given page and tags
|
|
|
|
*
|
|
|
|
* @name Arte +7 DE
|
2015-10-30 11:26:49 +01:00
|
|
|
* @homepage http://www.arte.tv/guide/de/plus7
|
2014-05-26 00:30:46 +02:00
|
|
|
* @description Returns newest videos from ARTE +7 (german)
|
|
|
|
* @maintainer mitsukarenai
|
2015-10-30 11:26:49 +01:00
|
|
|
* @update 2015-10-30
|
|
|
|
* @use1(cat="category")
|
2014-05-26 00:30:46 +02:00
|
|
|
*/
|
|
|
|
class Arte7deBridge extends BridgeAbstract{
|
|
|
|
|
|
|
|
public function collectData(array $param){
|
|
|
|
|
2015-10-30 11:26:49 +01:00
|
|
|
function extractVideoset($category='alle-videos')
|
|
|
|
{
|
|
|
|
$url = 'http://www.arte.tv/guide/de/plus7/'.$category;
|
|
|
|
$input = file_get_contents($url) or die('Could not request ARTE.');
|
|
|
|
if(strpos($input, 'categoryVideoSet') !== FALSE)
|
|
|
|
{
|
|
|
|
$input = explode('categoryVideoSet: ', $input);
|
|
|
|
$input = explode('}},', $input[1]);
|
|
|
|
$input = $input[0].'}}';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$input = explode('videoSet: ', $input);
|
|
|
|
$input = explode('}]},', $input[1]);
|
|
|
|
$input = $input[0].'}]}';
|
|
|
|
}
|
|
|
|
$input = json_decode($input, TRUE);
|
|
|
|
return $input;
|
|
|
|
}
|
2014-05-26 00:30:46 +02:00
|
|
|
|
2015-10-30 11:26:49 +01:00
|
|
|
$category='alle-videos';
|
|
|
|
if (!empty($param['cat']))
|
|
|
|
$category=$param['cat'];
|
|
|
|
$input_json = extractVideoset($category);
|
2014-05-26 00:30:46 +02:00
|
|
|
|
2015-10-30 11:26:49 +01:00
|
|
|
foreach($input_json['videos'] as $element) {
|
|
|
|
$item = new \Item();
|
|
|
|
$item->uri = $element['url'];
|
|
|
|
$item->id = $element['id'];
|
|
|
|
$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->thumbnailUri = $element['thumbnail_url'];
|
2014-05-26 00:30:46 +02:00
|
|
|
$item->title = $element['title'];
|
2015-10-30 11:26:49 +01:00
|
|
|
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="' . $item->thumbnailUri . '" /></a>';
|
2014-05-26 00:30:46 +02:00
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getName(){
|
|
|
|
return 'Arte7de';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getURI(){
|
|
|
|
return 'http://www.arte.tv/';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCacheDuration(){
|
|
|
|
return 1800; // 30 minutes
|
|
|
|
}
|
|
|
|
}
|