FootitoBridge.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. class FootitoBridge extends BridgeAbstract{
  3. public function loadMetadatas() {
  4. $this->maintainer = "superbaillot.net";
  5. $this->name = "Footito";
  6. $this->uri = "http://www.footito.fr/";
  7. $this->description = "Footito";
  8. $this->update = "21/11/2013";
  9. }
  10. public function collectData(array $param){
  11. $html = $this->file_get_html('http://www.footito.fr/') or $this->returnError('Could not request Footito.', 404);
  12. foreach($html->find('div.post') as $element) {
  13. $item = new Item();
  14. $content = trim($element->innertext);
  15. $content = str_replace("<img", "<img style='float : left;'", $content );
  16. $content = str_replace("class=\"logo\"", "style='float : left;'", $content );
  17. $content = str_replace("class=\"contenu\"", "style='margin-left : 60px;'", $content );
  18. $content = str_replace("class=\"responsive-comment\"", "style='border-top : 1px #DDD solid; background-color : white; padding : 10px;'", $content );
  19. $content = str_replace("class=\"jaime\"", "style='display : none;'", $content );
  20. $content = str_replace("class=\"auteur-event responsive\"", "style='display : none;'", $content );
  21. $content = str_replace("class=\"report-abuse-button\"", "style='display : none;'", $content );
  22. $content = str_replace("class=\"reaction clearfix\"", "style='margin : 10px 0px; padding : 5px; border-bottom : 1px #DDD solid;'", $content );
  23. $content = str_replace("class=\"infos\"", "style='font-size : 0.7em;'", $content );
  24. $item->content = $content;
  25. $title = $element->find('.contenu .texte ', 0)->plaintext;
  26. $item->title = $title;
  27. $info = $element->find('div.infos', 0);
  28. $item->timestamp = strtotime($info->find('time', 0)->datetime);
  29. $item->name = $info->find('a.auteur', 0)->plaintext;
  30. $this->items[] = $item;
  31. }
  32. }
  33. public function getName(){
  34. return 'footito';
  35. }
  36. public function getURI(){
  37. return 'http://www.footito.fr/';
  38. }
  39. public function getCacheDuration(){
  40. return 3600; // 1h hours
  41. }
  42. public function getDescription(){
  43. return "Footito via rss-bridge";
  44. }
  45. }
  46. ?>