2015-12-11 13:51:27 +03:00
|
|
|
<?php
|
2016-08-27 22:03:26 +03:00
|
|
|
class FierPandaBridge extends BridgeAbstract {
|
2015-12-11 13:51:27 +03:00
|
|
|
|
2016-08-30 12:23:55 +03:00
|
|
|
const MAINTAINER = "snroki";
|
|
|
|
const NAME = "Fier Panda Bridge";
|
|
|
|
const URI = "http://www.fier-panda.fr/";
|
2016-09-25 18:04:28 +03:00
|
|
|
const CACHE_TIMEOUT = 21600; // 6h
|
2016-08-30 12:23:55 +03:00
|
|
|
const DESCRIPTION = "Returns latest articles from Fier Panda.";
|
2015-12-11 13:51:27 +03:00
|
|
|
|
2016-08-25 02:24:53 +03:00
|
|
|
public function collectData(){
|
2016-09-26 00:22:33 +03:00
|
|
|
$html = getSimpleHTMLDOM(self::URI) or returnServerError('Could not request Fier Panda.');
|
2015-12-11 13:51:27 +03:00
|
|
|
|
|
|
|
foreach($html->find('div.container-content article') as $element) {
|
2016-08-22 19:55:59 +03:00
|
|
|
$item = array();
|
|
|
|
$item['uri'] = $this->getURI().$element->find('a', 0)->href;
|
2016-09-14 11:22:28 +03:00
|
|
|
$item['title'] = trim($element->find('h1 a', 0)->innertext);
|
2015-12-11 13:51:27 +03:00
|
|
|
// Remove the link at the end of the article
|
|
|
|
$element->find('p a', 0)->outertext = '';
|
2016-08-22 19:55:59 +03:00
|
|
|
$item['content'] = $element->find('p', 0)->innertext;
|
2015-12-11 13:51:27 +03:00
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|