2014-05-31 20:58:56 +04:00
|
|
|
<?php
|
2016-09-05 19:43:56 +03:00
|
|
|
class DauphineLibereBridge extends FeedExpander {
|
2015-11-05 18:50:18 +03:00
|
|
|
|
2016-09-05 19:43:56 +03:00
|
|
|
const MAINTAINER = "qwertygc";
|
|
|
|
const NAME = "Dauphine Bridge";
|
|
|
|
const URI = "http://www.ledauphine.com/";
|
|
|
|
const DESCRIPTION = "Returns the newest articles.";
|
2015-11-05 18:50:18 +03:00
|
|
|
|
2016-08-30 12:23:55 +03:00
|
|
|
const PARAMETERS = array( array(
|
2016-08-27 22:03:26 +03:00
|
|
|
'u'=>array(
|
2016-08-22 02:25:56 +03:00
|
|
|
'name'=>'Catégorie de l\'article',
|
|
|
|
'type'=>'list',
|
|
|
|
'values'=>array(
|
2016-08-27 22:03:26 +03:00
|
|
|
'À 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'
|
2016-08-22 02:25:56 +03:00
|
|
|
)
|
2016-08-27 22:03:26 +03:00
|
|
|
)
|
|
|
|
));
|
2015-11-05 18:50:18 +03:00
|
|
|
|
2016-09-05 19:43:56 +03:00
|
|
|
public function collectData(){
|
|
|
|
$url = self::URI . 'rss';
|
2016-08-02 16:31:55 +03:00
|
|
|
|
2016-09-05 19:43:56 +03:00
|
|
|
if (empty($this->getInput('u'))) {
|
|
|
|
$url = self::URI . $this->getInput('u') . '/rss';
|
|
|
|
}
|
2016-08-02 16:31:55 +03:00
|
|
|
|
2016-09-05 21:26:45 +03:00
|
|
|
$this->collectExpandableDatas($url, 10);
|
2016-09-05 19:43:56 +03:00
|
|
|
}
|
2016-08-02 16:57:01 +03:00
|
|
|
|
2016-09-05 19:43:56 +03:00
|
|
|
protected function parseItem($newsItem){
|
2016-09-12 11:42:27 +03:00
|
|
|
$item = parent::parseItem($newsItem);
|
2016-09-05 19:43:56 +03:00
|
|
|
$item['content'] = $this->ExtractContent($item['uri']);
|
|
|
|
return $item;
|
|
|
|
}
|
2014-05-31 20:58:56 +04:00
|
|
|
|
2016-09-05 19:43:56 +03:00
|
|
|
private function ExtractContent($url) {
|
2016-09-10 20:11:09 +03:00
|
|
|
$html2 = $this->getSimpleHTMLDOMCached($url);
|
2016-09-05 19:43:56 +03:00
|
|
|
$text = $html2->find('div.column', 0)->innertext;
|
|
|
|
$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
|
|
|
|
return $text;
|
|
|
|
}
|
2014-05-31 20:58:56 +04:00
|
|
|
|
2016-09-05 19:43:56 +03:00
|
|
|
public function getCacheDuration(){
|
|
|
|
return 3600*2; // 2 hours
|
|
|
|
}
|
2014-05-31 20:58:56 +04:00
|
|
|
}
|
2016-07-08 20:06:35 +03:00
|
|
|
?>
|