FlickrExploreBridge.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * RssBridgeFlickrExplore
  4. * Returns the newest interesting images from http://www.flickr.com/explore
  5. * 2014-05-25
  6. *
  7. * @name Flickr Explore
  8. * @homepage http://www.flickr.com/explore
  9. * @description Returns the latest interesting images from Flickr
  10. * @maintainer sebsauvage
  11. */
  12. class FlickrExploreBridge extends BridgeAbstract{
  13. public function collectData(array $param){
  14. $html = file_get_html('http://www.flickr.com/explore') or $this->returnError('Could not request Flickr.', 404);
  15. foreach($html->find('span.photo_container') as $element) {
  16. $item = new \Item();
  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. public function getName(){
  25. return 'Flickr Explore';
  26. }
  27. public function getURI(){
  28. return 'http://www.flickr.com/explore';
  29. }
  30. public function getCacheDuration(){
  31. return 21600; // 6 hours
  32. }
  33. }