CopieDoubleBridge.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. class CopieDoubleBridge extends BridgeAbstract{
  3. public function loadMetadatas() {
  4. $this->maintainer = "superbaillot.net";
  5. $this->name = "CopieDouble";
  6. $this->uri = "http://www.copie-double.com/";
  7. $this->description = "CopieDouble";
  8. $this->update = "12/12/2013";
  9. }
  10. public function collectData(array $param){
  11. $html = $this->file_get_html('http://www.copie-double.com/') or $this->returnError('Could not request CopieDouble.', 404);
  12. $table = $html->find('table table', 2);
  13. foreach($table->find('tr') as $element)
  14. {
  15. $td = $element->find('td', 0);
  16. $cpt++;
  17. if($td->class == "couleur_1")
  18. {
  19. $item = new Item();
  20. $title = $td->innertext;
  21. $pos = strpos($title, "<a");
  22. $title = substr($title, 0, $pos);
  23. $item->title = $title;
  24. }
  25. elseif(strpos($element->innertext, "/images/suivant.gif") === false)
  26. {
  27. $a=$element->find("a", 0);
  28. $item->uri = "http://www.copie-double.com" . $a->href;
  29. $content = str_replace('src="/', 'src="http://www.copie-double.com/',$element->find("td", 0)->innertext);
  30. $content = str_replace('href="/', 'href="http://www.copie-double.com/',$content);
  31. $item->content = $content;
  32. $this->items[] = $item;
  33. }
  34. }
  35. }
  36. public function getName(){
  37. return 'CopieDouble';
  38. }
  39. public function getURI(){
  40. return 'http://www.copie-double.com';
  41. }
  42. public function getDescription(){
  43. return 'CopieDouble via rss-bridge';
  44. }
  45. public function getCacheDuration(){
  46. return 14400; // 4 hours
  47. }
  48. }
  49. ?>