Rss-Bridge/bridges/FierPandaBridge.php

27 lines
950 B
PHP
Raw Normal View History

2015-12-11 11:51:27 +01:00
<?php
class FierPandaBridge extends BridgeAbstract {
2015-12-11 11:51:27 +01:00
const MAINTAINER = "snroki";
const NAME = "Fier Panda Bridge";
const URI = "http://www.fier-panda.fr/";
const DESCRIPTION = "Returns latest articles from Fier Panda.";
2015-12-11 11:51:27 +01:00
public function collectData(){
$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) {
$item = array();
$item['uri'] = $this->getURI().$element->find('a', 0)->href;
$item['title'] = trim($element->find('h2 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 = '';
$item['content'] = $element->find('p', 0)->innertext;
2015-12-11 11:51:27 +01:00
$this->items[] = $item;
}
}
public function getCacheDuration(){
return 21600; // 6 hours
}
}