AllocineFRBridge.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. class AllocineFRBridge extends BridgeAbstract{
  3. private $_URL = "http://www.allocine.fr/video/programme-12284/saison-24580/";
  4. private $_NOM = "Faux Raccord";
  5. public function loadMetadatas() {
  6. $this->maintainer = "superbaillot.net";
  7. $this->name = "Allo Cine : Faux Raccord";
  8. $this->uri = "http://www.allocine.fr/video/programme-12284/saison-24580/";
  9. $this->description = "Allo Cine : Faux Raccord";
  10. $this->update = "07/11/2013";
  11. }
  12. public function collectData(array $param){
  13. $html = $this->file_get_html($this->_URL) or $this->returnError('Could not request Allo cine.', 404);
  14. foreach($html->find('figure.media-meta-fig') as $element)
  15. {
  16. $item = new Item();
  17. $titre = $element->find('div.titlebar h3.title a', 0);
  18. $content = trim($element->innertext);
  19. $figCaption = strpos($content, $this->_NOM);
  20. if($figCaption !== false)
  21. {
  22. $content = str_replace('src="/', 'src="http://www.allocine.fr/',$content);
  23. $content = str_replace('href="/', 'href="http://www.allocine.fr/',$content);
  24. $content = str_replace('src=\'/', 'src=\'http://www.allocine.fr/',$content);
  25. $content = str_replace('href=\'/', 'href=\'http://www.allocine.fr/',$content);
  26. $item->content = $content;
  27. $item->title = trim($titre->innertext);
  28. $item->uri = "http://www.allocine.fr" . $titre->href;
  29. $this->items[] = $item;
  30. }
  31. }
  32. }
  33. public function getName(){
  34. return 'Allo Cine : ' . $this->_NOM;
  35. }
  36. public function getURI(){
  37. return $this->_URL;
  38. }
  39. public function getCacheDuration(){
  40. return 25200; // 7 hours
  41. }
  42. public function getDescription(){
  43. return "Allo Cine : " . $this->_NOM . " via rss-bridge";
  44. }
  45. }
  46. ?>