2014-05-26 02:30:46 +04:00
|
|
|
<?php
|
|
|
|
class BlaguesDeMerdeBridge extends BridgeAbstract{
|
|
|
|
|
2015-11-04 01:28:44 +03:00
|
|
|
public function loadMetadatas() {
|
|
|
|
|
|
|
|
$this->maintainer = "superbaillot.net";
|
|
|
|
$this->name = "Blagues De Merde";
|
|
|
|
$this->uri = "http://www.blaguesdemerde.fr/";
|
|
|
|
$this->description = "Blagues De Merde";
|
2016-08-17 15:45:08 +03:00
|
|
|
$this->update = '2016-08-17';
|
2015-11-04 01:28:44 +03:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-05-26 02:30:46 +04:00
|
|
|
public function collectData(array $param){
|
2016-07-08 20:06:35 +03:00
|
|
|
$html = $this->getSimpleHTMLDOM('http://www.blaguesdemerde.fr/') or $this->returnServerError('Could not request BDM.');
|
|
|
|
|
2014-05-26 02:30:46 +04:00
|
|
|
foreach($html->find('article.joke_contener') as $element) {
|
|
|
|
$item = new Item();
|
|
|
|
$temp = $element->find('a');
|
|
|
|
if(isset($temp[2]))
|
|
|
|
{
|
|
|
|
$item->content = trim($element->find('div.joke_text_contener', 0)->innertext);
|
|
|
|
$uri = $temp[2]->href;
|
|
|
|
$item->uri = $uri;
|
|
|
|
$item->title = substr($uri, (strrpos($uri, "/") + 1));
|
|
|
|
$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));
|
|
|
|
$item->timestamp = $time;
|
2016-08-09 15:54:44 +03:00
|
|
|
$item->author = $element->find("li.bdm_pseudo",0)->innertext;;
|
2014-05-26 02:30:46 +04:00
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCacheDuration(){
|
|
|
|
return 7200; // 2h hours
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|