FierPandaBridge.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. Class FierPandaBridge extends BridgeAbstract{
  3. public function loadMetadatas() {
  4. $this->maintainer = "snroki";
  5. $this->name = "Fier Panda Bridge";
  6. $this->uri = "http://www.fier-panda.fr/";
  7. $this->description = "Returns latest articles from Fier Panda.";
  8. $this->update = "2015-12-11";
  9. }
  10. public function collectData(array $param){
  11. $link = 'http://www.fier-panda.fr/';
  12. $html = $this->file_get_html($link) or $this->returnError('Could not request Fier Panda.', 404);
  13. foreach($html->find('div.container-content article') as $element) {
  14. $item = new \Item();
  15. $item->uri = $this->getURI().$element->find('a', 0)->href;
  16. $item->title = trim($element->find('h2 a', 0)->innertext);
  17. // Remove the link at the end of the article
  18. $element->find('p a', 0)->outertext = '';
  19. $item->content = $element->find('p', 0)->innertext;
  20. $this->items[] = $item;
  21. }
  22. }
  23. public function getName(){
  24. return 'Fier Panda';
  25. }
  26. public function getURI(){
  27. return 'http://www.fier-panda.fr';
  28. }
  29. public function getCacheDuration(){
  30. return 21600; // 6 hours
  31. }
  32. }