FlickrExploreBridge.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  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 FlickrExploreBridge extends BridgeAbstract{
  10. public function collectData(array $param){
  11. $html = file_get_html('http://www.flickr.com/explore') or $this->returnError('Could not request Flickr.', 404);
  12. foreach($html->find('span.photo_container') as $element) {
  13. $item = new \Item();
  14. $item->uri = 'http://flickr.com'.$element->find('a',0)->href;
  15. $item->thumbnailUri = $element->find('img',0)->getAttribute('data-defer-src');
  16. $item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a>'; // FIXME: Filter javascript ?
  17. $item->title = $element->find('a',0)->title;
  18. $this->items[] = $item;
  19. }
  20. }
  21. public function getName(){
  22. return 'Flickr Explore';
  23. }
  24. public function getURI(){
  25. return 'http://www.flickr.com/explore';
  26. }
  27. public function getCacheDuration(){
  28. return 21600; // 6 hours
  29. }
  30. }