mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-12 01:48:48 +00:00
add AliasBridge v0.0
add FlickrTag v0.0
This commit is contained in:
parent
b866fb74c0
commit
d23488205e
35
bridges/AliasBridge.php
Executable file
35
bridges/AliasBridge.php
Executable file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* RssBridgeAlias
|
||||
* Returns the latest alias from http://alias.sh/latest-aliases/
|
||||
*
|
||||
* @name Alias
|
||||
* @description Returns the last alias from Alias.sh
|
||||
*/
|
||||
class AliasBridge extends BridgeAbstract{
|
||||
|
||||
public function collectData(array $param){
|
||||
$html = file_get_html('http://alias.sh/latest-aliases/') or $this->returnError('Could not request Alias.', 404);
|
||||
|
||||
foreach($html->find('.views-row') as $element) {
|
||||
$item = new \Item();
|
||||
$item->uri = 'http://alias.sh/'.$element->find('a',0)->href;
|
||||
//$item->thumbnailUri = $element->find('img',0)->getAttribute('data-defer-src');
|
||||
$item->content = $element->find('.bash',0)->plaintext;
|
||||
$item->title = $element->find('a',0)->plaintext;
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return 'Alias latest';
|
||||
}
|
||||
|
||||
public function getURI(){
|
||||
return 'http://alias.sh/';
|
||||
}
|
||||
|
||||
public function getCacheDuration(){
|
||||
return 21600; // 6 hours
|
||||
}
|
||||
}
|
49
bridges/FlickrTagBridge.php
Executable file
49
bridges/FlickrTagBridge.php
Executable file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* RssBridgeFlickrTagUser
|
||||
* Returns the newest interesting images from http://www.flickr.com/explore
|
||||
*
|
||||
* @name Flickr TagUser
|
||||
* @description Returns the tagged or user images from Flickr
|
||||
* @use1(q="keyword")
|
||||
* @use2(u="username")
|
||||
*/
|
||||
class FlickrTagBridge extends BridgeAbstract{
|
||||
|
||||
public function collectData(array $param){
|
||||
$html = file_get_html('http://www.flickr.com/search/?q=vendee&s=rec') or $this->returnError('Could not request Flickr.', 404);
|
||||
if (isset($param['q'])) { /* keyword search mode */
|
||||
$this->request = $param['q'];
|
||||
$html = file_get_html('http://www.flickr.com/search/?q='.urlencode($this->request).'&s=rec') or $this->returnError('No results for this query.', 404);
|
||||
}
|
||||
elseif (isset($param['u'])) { /* user timeline mode */
|
||||
$this->request = $param['u'];
|
||||
$html = file_get_html('http://www.flickr.com/photos/'.urlencode($this->request).'/') or $this->returnError('Requested username can\'t be found.', 404);
|
||||
}
|
||||
|
||||
else {
|
||||
$this->returnError('You must specify a keyword or a Flickr username.', 400);
|
||||
}
|
||||
|
||||
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 Tag';
|
||||
}
|
||||
|
||||
public function getURI(){
|
||||
return 'http://www.flickr.com/search/';
|
||||
}
|
||||
|
||||
public function getCacheDuration(){
|
||||
return 21600; // 6 hours
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user