Rss-Bridge/rss-bridge-flickr-explore.php

29 lines
1.2 KiB
PHP
Raw Normal View History

2013-08-06 23:57:22 +02:00
<?php
require_once('rss-bridge-lib.php');
2013-08-06 23:57:22 +02:00
/**
* RssBridgeFlickrExplore
* Returns the newest interesting images from http://www.flickr.com/explore
*/
class RssBridgeFlickrExplore extends RssBridgeAbstractClass
2013-08-06 23:57:22 +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) {
$html = file_get_html('http://www.flickr.com/explore') or $this->returnError('404 Not Found', 'ERROR: could not request Flickr.');
$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-06 23:57:22 +02:00
}
$bridge = new RssBridgeFlickrExplore();
$bridge->process();
?>