2018-02-11 18:56:34 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class TebeoBridge extends FeedExpander
|
2022-07-01 16:10:30 +03:00
|
|
|
{
|
2018-02-11 18:56:34 +03:00
|
|
|
const NAME = 'Tébéo Bridge';
|
|
|
|
const URI = 'http://www.tebeo.bzh/';
|
|
|
|
const CACHE_TIMEOUT = 21600; //6h
|
|
|
|
const DESCRIPTION = 'Returns the newest Tébéo videos by category';
|
2018-02-11 21:08:19 +03:00
|
|
|
const MAINTAINER = 'Mitsukarenai';
|
2018-02-11 18:56:34 +03:00
|
|
|
|
2018-10-26 19:07:34 +03:00
|
|
|
const PARAMETERS = [ [
|
2022-07-01 16:10:30 +03:00
|
|
|
'cat' => [
|
2018-10-26 19:07:34 +03:00
|
|
|
'name' => 'Catégorie',
|
2018-02-11 18:56:34 +03:00
|
|
|
'type' => 'list',
|
|
|
|
'values' => [
|
2018-10-26 19:07:34 +03:00
|
|
|
'Toutes les vidéos' => '/',
|
2018-02-11 18:56:34 +03:00
|
|
|
'Actualité' => '/14-actualite',
|
2018-02-11 21:08:19 +03:00
|
|
|
'Sport' => '/3-sport',
|
2018-10-26 19:07:34 +03:00
|
|
|
'Culture-Loisirs' => '/5-culture-loisirs',
|
2018-02-11 21:08:19 +03:00
|
|
|
'Société' => '/15-societe',
|
2018-10-26 19:07:34 +03:00
|
|
|
'Langue Bretonne' => '/9-langue-bretonne'
|
2022-07-01 16:10:30 +03:00
|
|
|
]
|
|
|
|
]
|
2018-10-26 19:07:34 +03:00
|
|
|
]];
|
|
|
|
|
2018-02-11 18:56:34 +03:00
|
|
|
public function getIcon()
|
|
|
|
{
|
|
|
|
return self::URI . 'images/header_logo.png';
|
2022-07-01 16:10:30 +03:00
|
|
|
}
|
2018-02-11 18:56:34 +03:00
|
|
|
|
2018-10-26 19:07:34 +03:00
|
|
|
public function collectData()
|
2022-07-01 16:10:30 +03:00
|
|
|
{
|
2018-02-11 18:56:34 +03:00
|
|
|
$url = self::URI . '/le-replay/' . $this->getInput('cat');
|
2022-01-02 12:36:09 +03:00
|
|
|
$html = getSimpleHTMLDOM($url);
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2018-02-11 18:56:34 +03:00
|
|
|
foreach ($html->find('div[id=items_replay] div.replay') as $element) {
|
|
|
|
$item = [];
|
|
|
|
$item['uri'] = $element->find('a', 0)->href;
|
|
|
|
$item['title'] = $element->find('h3', 0)->plaintext;
|
|
|
|
$item['timestamp'] = strtotime($element->find('p.moment-format-day', 0)->plaintext);
|
2018-11-05 14:55:58 +03:00
|
|
|
$item['content'] = '<a href="' . $item['uri'] . '"><img alt="" src="' . $element->find('img', 0)->src . '"></a>';
|
2018-02-11 21:08:19 +03:00
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
2022-07-01 16:10:30 +03:00
|
|
|
}
|
2018-02-11 18:56:34 +03:00
|
|
|
}
|