-
Notifications
You must be signed in to change notification settings - Fork 1k
/
TebeoBridge.php
45 lines (40 loc) · 1.45 KB
/
TebeoBridge.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
class TebeoBridge extends FeedExpander
{
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';
const MAINTAINER = 'Mitsukarenai';
const PARAMETERS = [ [
'cat' => [
'name' => 'Catégorie',
'type' => 'list',
'values' => [
'Toutes les vidéos' => '/',
'Actualité' => '/14-actualite',
'Sport' => '/3-sport',
'Culture-Loisirs' => '/5-culture-loisirs',
'Société' => '/15-societe',
'Langue Bretonne' => '/9-langue-bretonne'
]
]
]];
public function getIcon()
{
return self::URI . 'images/header_logo.png';
}
public function collectData()
{
$url = self::URI . '/le-replay/' . $this->getInput('cat');
$html = getSimpleHTMLDOM($url);
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);
$item['content'] = '<a href="' . $item['uri'] . '"><img alt="" src="' . $element->find('img', 0)->src . '"></a>';
$this->items[] = $item;
}
}
}