1
0
Fork 0
forked from blallo/rss-bridge

[Arte] update bridges (new website) - fix #165

This commit is contained in:
Mitsukarenai 2015-10-30 11:26:49 +01:00
parent d90b118671
commit e1dac3abb3
2 changed files with 78 additions and 92 deletions

View file

@ -2,64 +2,57 @@
/**
* RssBridgeArte7de
* Returns images from given page and tags
* 2014-05-25
*
* @name Arte +7 DE
* @homepage http://www.arte.tv/guide/de/
* @homepage http://www.arte.tv/guide/de/plus7
* @description Returns newest videos from ARTE +7 (german)
* @maintainer mitsukarenai
* @update 2015-10-30
* @use1(cat="category")
*/
class Arte7deBridge extends BridgeAbstract{
public function collectData(array $param){
$input_json = json_decode(file_get_contents('http://www.arte.tv/guide/de/plus7.json'), TRUE) or $this->returnError('Could not request ARTE.', 404);
foreach($input_json['videos'] as $element) {
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;
}
$category='alle-videos';
if (!empty($param['cat']))
$category=$param['cat'];
$input_json = extractVideoset($category);
foreach($input_json['videos'] as $element) {
$item = new \Item();
$item->uri = $element['url'];
$item->postid = $item->uri;
$date = $element['airdate_long'];
$date = explode(' ', $date);
$day = (int)$date['1'];
$month=FALSE;
switch ($date['2']) {
case 'Januar':
$month=1;break;
case 'Februar':
$month=2;break;
case 'März':
$month=3;break;
case 'April':
$month=4;break;
case 'Mai':
$month=5;break;
case 'Juni':
$month=6;break;
case 'Juli':
$month=7;break;
case 'August':
$month=8;break;
case 'September':
$month=9;break;
case 'Oktober':
$month=10;break;
case 'November':
$month=11;break;
case 'Dezember':
$month=12;break;
}
$year=(int)date('Y');
$heure=explode(':', $date['4']);
$hour=(int)$heure['0'];
$minute=(int)$heure['1'];
$item->timestamp = mktime($hour, $minute, 0, $month, $day, $year);
$item->thumbnailUri = $element['image_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'];
$item->title = $element['title'];
$item->content = $element['desc'].'<br><br>'.$element['video_channels'].', '.$element['duration'].'min<br><img src="' . $item->thumbnailUri . '" />';
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>';
$this->items[] = $item;
}
}

View file

@ -2,64 +2,57 @@
/**
* RssBridgeArte7fr
* Returns images from given page and tags
* 2014-05-25
*
* @name Arte +7 FR
* @homepage http://www.arte.tv/guide/fr/
* @homepage http://www.arte.tv/guide/fr/plus7
* @description Returns newest videos from ARTE +7 (french)
* @maintainer mitsukarenai
* @update 2015-10-30
* @use1(cat="category")
*/
class Arte7frBridge extends BridgeAbstract{
public function collectData(array $param){
$input_json = json_decode(file_get_contents('http://www.arte.tv/guide/fr/plus7.json'), TRUE) or $this->returnError('Could not request ARTE.', 404);
foreach($input_json['videos'] as $element) {
function extractVideoset($category='toutes-les-videos')
{
$url = 'http://www.arte.tv/guide/fr/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;
}
$category='toutes-les-videos';
if (!empty($param['cat']))
$category=$param['cat'];
$input_json = extractVideoset($category);
foreach($input_json['videos'] as $element) {
$item = new \Item();
$item->uri = $element['url'];
$item->postid = $item->uri;
$date = $element['airdate_long'];
$date = explode(' ', $date);
$day = (int)$date['1'];
$month=FALSE;
switch ($date['2']) {
case 'janvier':
$month=1;break;
case 'février':
$month=2;break;
case 'mars':
$month=3;break;
case 'avril':
$month=4;break;
case 'mai':
$month=5;break;
case 'juin':
$month=6;break;
case 'juillet':
$month=7;break;
case 'août':
$month=8;break;
case 'septembre':
$month=9;break;
case 'octobre':
$month=10;break;
case 'novembre':
$month=11;break;
case 'décembre':
$month=12;break;
}
$year=(int)date('Y');
$heure=explode('h', $date['4']);
$hour=(int)$heure['0'];
$minute=(int)$heure['1'];
$item->timestamp = mktime($hour, $minute, 0, $month, $day, $year);
$item->thumbnailUri = $element['image_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'];
$item->title = $element['title'];
$item->content = $element['desc'].'<br><br>'.$element['video_channels'].', '.$element['duration'].'min<br><img src="' . $item->thumbnailUri . '" />';
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>';
$this->items[] = $item;
}
}