forked from RSS-Bridge/rss-bridge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DauphineLibereBridge.php
57 lines (50 loc) · 1.5 KB
/
DauphineLibereBridge.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
46
47
48
49
50
51
52
53
54
55
56
57
<?php
class DauphineLibereBridge extends FeedExpander {
const MAINTAINER = 'qwertygc';
const NAME = 'Dauphine Bridge';
const URI = 'https://www.ledauphine.com/';
const CACHE_TIMEOUT = 7200; // 2h
const DESCRIPTION = 'Returns the newest articles.';
const PARAMETERS = array( array(
'u' => array(
'name' => 'Catégorie de l\'article',
'type' => 'list',
'values' => array(
'À la une' => '',
'France Monde' => 'france-monde',
'Faits Divers' => 'faits-divers',
'Économie et Finance' => 'economie-et-finance',
'Politique' => 'politique',
'Sport' => 'sport',
'Ain' => 'ain',
'Alpes-de-Haute-Provence' => 'haute-provence',
'Hautes-Alpes' => 'hautes-alpes',
'Ardèche' => 'ardeche',
'Drôme' => 'drome',
'Isère Sud' => 'isere-sud',
'Savoie' => 'savoie',
'Haute-Savoie' => 'haute-savoie',
'Vaucluse' => 'vaucluse'
)
)
));
public function collectData(){
$url = self::URI . 'rss';
if(empty($this->getInput('u'))) {
$url = self::URI . $this->getInput('u') . '/rss';
}
$this->collectExpandableDatas($url, 10);
}
protected function parseItem($newsItem){
$item = parent::parseItem($newsItem);
$item['content'] = $this->extractContent($item['uri']);
return $item;
}
private function extractContent($url){
$html2 = getSimpleHTMLDOMCached($url);
foreach ($html2->find('.noprint, link, script, iframe, .shareTool, .contentInfo') as $remove) {
$remove->outertext = '';
}
return $html2->find('div.content', 0)->innertext;
}
}