2016-07-17 14:40:03 +02:00
|
|
|
<?php
|
|
|
|
class EstCeQuonMetEnProdBridge extends BridgeAbstract {
|
|
|
|
|
2016-08-30 11:23:55 +02:00
|
|
|
const MAINTAINER = 'ORelio';
|
|
|
|
const NAME = 'Est-ce qu\'on met en prod aujourd\'hui ?';
|
|
|
|
const URI = 'https://www.estcequonmetenprodaujourdhui.info/';
|
2016-09-25 17:04:28 +02:00
|
|
|
const CACHE_TIMEOUT = 21600; // 6h
|
2016-08-30 11:23:55 +02:00
|
|
|
const DESCRIPTION = 'Should we put a website in production today? (French)';
|
2016-07-17 14:40:03 +02:00
|
|
|
|
2016-08-25 01:24:53 +02:00
|
|
|
public function collectData(){
|
2016-07-17 14:40:03 +02:00
|
|
|
function ExtractFromDelimiters($string, $start, $end) {
|
|
|
|
if (strpos($string, $start) !== false) {
|
|
|
|
$section_retrieved = substr($string, strpos($string, $start) + strlen($start));
|
|
|
|
$section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end));
|
|
|
|
return $section_retrieved;
|
|
|
|
} return false;
|
|
|
|
}
|
|
|
|
|
2016-08-09 14:57:42 +02:00
|
|
|
$html = $this->getSimpleHTMLDOM($this->getURI()) or $this->returnServerError('Could not request EstCeQuonMetEnProd: '.$this->getURI());
|
2016-07-17 14:40:03 +02:00
|
|
|
|
2016-08-22 18:55:59 +02:00
|
|
|
$item = array();
|
|
|
|
$item['uri'] = $this->getURI().'#'.date('Y-m-d');
|
|
|
|
$item['title'] = $this->getName();
|
|
|
|
$item['author'] = 'Nicolas Hoffmann';
|
|
|
|
$item['timestamp'] = strtotime('today midnight');
|
|
|
|
$item['content'] = str_replace('src="/', 'src="'.$this->getURI(), trim(ExtractFromDelimiters($html->outertext, '<body role="document">', '<br /><br />')));
|
2016-07-17 14:40:03 +02:00
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
2016-08-09 14:57:42 +02:00
|
|
|
?>
|