2014-05-26 00:30:46 +02:00
|
|
|
<?php
|
|
|
|
class BlaguesDeMerdeBridge extends BridgeAbstract{
|
|
|
|
|
2016-08-30 11:23:55 +02:00
|
|
|
const MAINTAINER = "superbaillot.net";
|
|
|
|
const NAME = "Blagues De Merde";
|
|
|
|
const URI = "http://www.blaguesdemerde.fr/";
|
2016-09-25 17:04:28 +02:00
|
|
|
const CACHE_TIMEOUT = 7200; // 2h
|
2016-08-30 11:23:55 +02:00
|
|
|
const DESCRIPTION = "Blagues De Merde";
|
2015-11-03 23:28:44 +01:00
|
|
|
|
|
|
|
|
2016-08-25 01:24:53 +02:00
|
|
|
public function collectData(){
|
2016-08-30 11:23:55 +02:00
|
|
|
$html = $this->getSimpleHTMLDOM(self::URI)
|
2016-08-28 11:59:34 +02:00
|
|
|
or $this->returnServerError('Could not request BDM.');
|
2016-07-08 19:06:35 +02:00
|
|
|
|
2014-05-26 00:30:46 +02:00
|
|
|
foreach($html->find('article.joke_contener') as $element) {
|
2016-08-22 18:55:59 +02:00
|
|
|
$item = array();
|
2014-05-26 00:30:46 +02:00
|
|
|
$temp = $element->find('a');
|
|
|
|
if(isset($temp[2]))
|
|
|
|
{
|
2016-08-22 18:55:59 +02:00
|
|
|
$item['content'] = trim($element->find('div.joke_text_contener', 0)->innertext);
|
2014-05-26 00:30:46 +02:00
|
|
|
$uri = $temp[2]->href;
|
2016-08-22 18:55:59 +02:00
|
|
|
$item['uri'] = $uri;
|
|
|
|
$item['title'] = substr($uri, (strrpos($uri, "/") + 1));
|
2014-05-26 00:30:46 +02:00
|
|
|
$date = $element->find("li.bdm_date",0)->innertext;
|
|
|
|
$time = mktime(0, 0, 0, substr($date, 3, 2), substr($date, 0, 2), substr($date, 6, 4));
|
2016-08-22 18:55:59 +02:00
|
|
|
$item['timestamp'] = $time;
|
|
|
|
$item['author'] = $element->find("li.bdm_pseudo",0)->innertext;;
|
2014-05-26 00:30:46 +02:00
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|