1
0

rss-bridge-flickr-explore.php 1.2 KB

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