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