TebeoBridge.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. class TebeoBridge extends FeedExpander {
  3. const NAME = 'Tébéo Bridge';
  4. const URI = 'http://www.tebeo.bzh/';
  5. const CACHE_TIMEOUT = 21600; //6h
  6. const DESCRIPTION = 'Returns the newest Tébéo videos by category';
  7. const MAINTAINER = 'Mitsukarenai';
  8. const PARAMETERS = array( array(
  9. 'cat' => array(
  10. 'name' => 'Catégorie',
  11. 'type' => 'list',
  12. 'values' => array(
  13. 'Toutes les vidéos' => '/',
  14. 'Actualité' => '/14-actualite',
  15. 'Sport' => '/3-sport',
  16. 'Culture-Loisirs' => '/5-culture-loisirs',
  17. 'Société' => '/15-societe',
  18. 'Langue Bretonne' => '/9-langue-bretonne'
  19. )
  20. )
  21. ));
  22. public function collectData(){
  23. $url = self::URI . '/le-replay/' . $this->getInput('cat');
  24. $html = getSimpleHTMLDOM($url)
  25. or returnServerError('Could not request Tébéo.');
  26. foreach($html->find('div[id=items_replay] div.replay') as $element) {
  27. $item = array();
  28. $item['uri'] = $element->find('a', 0)->href;
  29. $item['title'] = $element->find('h3', 0)->plaintext;
  30. $item['timestamp'] = strtotime($element->find('p.moment-format-day', 0)->plaintext);
  31. $item['content'] = '<a href="'.$item['uri'].'"><img alt="" src="'.$element->find('img', 0)->src.'"></a>';
  32. $this->items[] = $item;
  33. }
  34. }
  35. }