mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-12-18 00:43:19 +03:00
bba216073c
That's the source code manager job to keep this information consistent Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
54 lines
1.6 KiB
PHP
54 lines
1.6 KiB
PHP
<?php
|
|
class IdenticaBridge extends BridgeAbstract{
|
|
|
|
private $request;
|
|
|
|
public function loadMetadatas() {
|
|
|
|
$this->maintainer = "mitsukarenai";
|
|
$this->name = "Identica Bridge";
|
|
$this->uri = "https://identi.ca/";
|
|
$this->description = "Returns user timelines";
|
|
|
|
$this->parameters[] =
|
|
'[
|
|
{
|
|
"name" : "username",
|
|
"identifier" : "u"
|
|
}
|
|
]';
|
|
|
|
}
|
|
|
|
public function collectData(array $param){
|
|
$html = '';
|
|
if (isset($param['u'])) { /* user timeline mode */
|
|
$this->request = $param['u'];
|
|
$html = $this->getSimpleHTMLDOM('https://identi.ca/'.urlencode($this->request)) or $this->returnServerError('Requested username can\'t be found.');
|
|
}
|
|
else {
|
|
$this->returnClientError('You must specify an Identica username (?u=...).');
|
|
}
|
|
|
|
foreach($html->find('li.major') as $dent) {
|
|
$item = new \Item();
|
|
$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'] . ' | ' . $item->content;
|
|
$this->items[] = $item;
|
|
}
|
|
}
|
|
|
|
public function getName(){
|
|
return (!empty($this->request) ? $this->request .' - ' : '') .'Identica Bridge';
|
|
}
|
|
|
|
public function getURI(){
|
|
return 'https://identica.com';
|
|
}
|
|
|
|
public function getCacheDuration(){
|
|
return 300; // 5 minutes
|
|
}
|
|
}
|