2014-05-26 00:30:46 +02:00
|
|
|
<?php
|
|
|
|
class BlaguesDeMerdeBridge extends BridgeAbstract{
|
|
|
|
|
2016-08-27 21:03:26 +02:00
|
|
|
public $maintainer = "superbaillot.net";
|
|
|
|
public $name = "Blagues De Merde";
|
|
|
|
public $uri = "http://www.blaguesdemerde.fr/";
|
|
|
|
public $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-28 11:59:34 +02:00
|
|
|
$html = $this->getSimpleHTMLDOM($this->uri)
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCacheDuration(){
|
|
|
|
return 7200; // 2h hours
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|