rss-bridge/bridges/FlickrExploreBridge.php

39 lines
1.2 KiB
PHP
Raw Normal View History

2013-08-11 15:30:41 +04:00
<?php
/**
* RssBridgeFlickrExplore
* Returns the newest interesting images from http://www.flickr.com/explore
2014-05-26 01:27:14 +04:00
* 2014-05-25
2013-08-11 15:30:41 +04:00
*
* @name Flickr Explore
2014-05-26 01:27:14 +04:00
* @homepage http://www.flickr.com/explore
2013-08-11 15:30:41 +04:00
* @description Returns the latest interesting images from Flickr
2014-05-21 21:44:14 +04:00
* @maintainer sebsauvage
2013-08-11 15:30:41 +04:00
*/
class FlickrExploreBridge extends BridgeAbstract{
public function collectData(array $param){
$html = file_get_html('http://www.flickr.com/explore') or $this->returnError('Could not request Flickr.', 404);
foreach($html->find('span.photo_container') as $element) {
$item = new \Item();
$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;
}
}
public function getName(){
return 'Flickr Explore';
}
public function getURI(){
return 'http://www.flickr.com/explore';
}
public function getCacheDuration(){
return 21600; // 6 hours
}
2014-05-21 21:15:52 +04:00
}