FlickrExploreBridge.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * RssBridgeFlickrExplore
  4. * Returns the newest interesting images from http://www.flickr.com/explore
  5. *
  6. * @name Flickr Explore
  7. * @description Returns the latest interesting images from Flickr
  8. * @maintainer sebsauvage
  9. */
  10. class FlickrExploreBridge extends BridgeAbstract{
  11. public function collectData(array $param){
  12. $html = file_get_html('http://www.flickr.com/explore') or $this->returnError('Could not request Flickr.', 404);
  13. foreach($html->find('span.photo_container') as $element) {
  14. $item = new \Item();
  15. $item->uri = 'http://flickr.com'.$element->find('a',0)->href;
  16. $item->thumbnailUri = $element->find('img',0)->getAttribute('data-defer-src');
  17. $item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a>'; // FIXME: Filter javascript ?
  18. $item->title = $element->find('a',0)->title;
  19. $this->items[] = $item;
  20. }
  21. }
  22. public function getName(){
  23. return 'Flickr Explore';
  24. }
  25. public function getURI(){
  26. return 'http://www.flickr.com/explore';
  27. }
  28. public function getCacheDuration(){
  29. return 21600; // 6 hours
  30. }
  31. }