FierPandaBridge.php 936 B

1234567891011121314151617181920212223242526
  1. <?php
  2. class FierPandaBridge extends BridgeAbstract {
  3. const MAINTAINER = "snroki";
  4. const NAME = "Fier Panda Bridge";
  5. const URI = "http://www.fier-panda.fr/";
  6. const DESCRIPTION = "Returns latest articles from Fier Panda.";
  7. public function collectData(){
  8. $html = getSimpleHTMLDOM(self::URI) or returnServerError('Could not request Fier Panda.');
  9. foreach($html->find('div.container-content article') as $element) {
  10. $item = array();
  11. $item['uri'] = $this->getURI().$element->find('a', 0)->href;
  12. $item['title'] = trim($element->find('h1 a', 0)->innertext);
  13. // Remove the link at the end of the article
  14. $element->find('p a', 0)->outertext = '';
  15. $item['content'] = $element->find('p', 0)->innertext;
  16. $this->items[] = $item;
  17. }
  18. }
  19. public function getCacheDuration(){
  20. return 21600; // 6 hours
  21. }
  22. }