1
0

flickr-explore.php 1.2 KB

1234567891011121314151617181920212223242526272829
  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. */
  9. class RssBridgeFlickrExplore extends RssBridgeAbstractClass
  10. {
  11. protected $bridgeName = 'Flickr Explore';
  12. protected $bridgeURI = 'http://www.flickr.com/explore';
  13. protected $bridgeDescription = 'Returns the latest interesting images from Flickr';
  14. protected $cacheDuration = 360; // 6 hours. No need to get more.
  15. protected function collectData($request) {
  16. $html = file_get_html('http://www.flickr.com/explore') or $this->returnError(404, 'could not request Flickr.');
  17. $this->items = Array();
  18. foreach($html->find('span.photo_container') as $element) {
  19. $item['uri'] = 'http://flickr.com'.$element->find('a',0)->href;
  20. $item['thumbnailUri'] = $element->find('img',0)->getAttribute('data-defer-src');
  21. $item['content'] = '<a href="'.$item['uri'].'"><img src="'.$item['thumbnailUri'].'" /></a>'; // FIXME: Filter javascript ?
  22. $item['title'] = $element->find('a',0)->title;
  23. $this->items[] = $item;
  24. }
  25. }
  26. }
  27. $bridge = new RssBridgeFlickrExplore();
  28. $bridge->process();