2013-08-06 23:57:22 +02:00
|
|
|
<?php
|
2013-08-07 22:33:21 +02:00
|
|
|
/**
|
|
|
|
* RssBridgeFlickrExplore
|
|
|
|
* Returns the newest interesting images from http://www.flickr.com/explore
|
2013-08-09 18:57:25 +02:00
|
|
|
*
|
|
|
|
* @name Flickr Explore
|
|
|
|
* @description Returns the latest interesting images from Flickr
|
2013-08-07 22:33:21 +02:00
|
|
|
*/
|
|
|
|
class RssBridgeFlickrExplore extends RssBridgeAbstractClass
|
2013-08-06 23:57:22 +02:00
|
|
|
{
|
2013-08-07 22:33:21 +02:00
|
|
|
protected $bridgeName = 'Flickr Explore';
|
|
|
|
protected $bridgeURI = 'http://www.flickr.com/explore';
|
|
|
|
protected $bridgeDescription = 'Returns the latest interesting images from Flickr';
|
|
|
|
protected $cacheDuration = 360; // 6 hours. No need to get more.
|
|
|
|
protected function collectData($request) {
|
2013-08-09 18:57:25 +02:00
|
|
|
$html = file_get_html('http://www.flickr.com/explore') or $this->returnError(404, 'could not request Flickr.');
|
2013-08-07 22:33:21 +02:00
|
|
|
$this->items = Array();
|
|
|
|
foreach($html->find('span.photo_container') as $element) {
|
|
|
|
$item['uri'] = 'http://flickr.com'.$element->find('a',0)->href;
|
|
|
|
$item['thumbnailUri'] = $element->find('img',0)->getAttribute('data-defer-src');
|
|
|
|
$item['content'] = '<a href="'.$item['uri'].'"><img src="'.$item['thumbnailUri'].'" /></a>'; // FIXME: Filter javascript ?
|
|
|
|
$item['title'] = $element->find('a',0)->title;
|
|
|
|
$this->items[] = $item;
|
2013-08-06 23:57:22 +02:00
|
|
|
}
|
2013-08-07 22:33:21 +02:00
|
|
|
}
|
2013-08-06 23:57:22 +02:00
|
|
|
}
|
|
|
|
|
2013-08-07 22:33:21 +02:00
|
|
|
$bridge = new RssBridgeFlickrExplore();
|
2013-08-09 18:57:25 +02:00
|
|
|
$bridge->process();
|