Rss-Bridge/bridges/IdenticaBridge.php
Pierre Mazière d95fa6117a [IdenticaBridge] remove useless code and fix getURI()
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-08-28 13:00:55 +02:00

49 lines
1.5 KiB
PHP

<?php
class IdenticaBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "mitsukarenai";
$this->name = "Identica Bridge";
$this->uri = "https://identi.ca/";
$this->description = "Returns user timelines";
$this->parameters[] = array(
'u'=>array(
'name'=>'username',
'required'=>true
)
);
}
public function collectData(){
$html = '';
$html = $this->getSimpleHTMLDOM($this->getURI())
or $this->returnServerError('Requested username can\'t be found.');
foreach($html->find('li.major') as $dent) {
$item = array();
$item['uri'] = html_entity_decode($dent->find('a', 0)->href); // get dent link
$item['timestamp'] = strtotime($dent->find('abbr.easydate', 0)->plaintext); // extract dent timestamp
$item['content'] = trim($dent->find('div.activity-content', 0)->innertext); // extract dent text
$item['title'] = $param['u']['value'] . ' | ' . $item['content'];
$this->items[] = $item;
}
}
public function getName(){
$param=$this->parameters[$this->queriedContext];
return $param['u']['value'] .' - Identica Bridge';
}
public function getURI(){
$param=$this->parameters[$this->queriedContext];
return $this->uri.urlencode($param['u']['value']);
}
public function getCacheDuration(){
return 300; // 5 minutes
}
}