2013-08-15 13:02:43 +04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* RssBridgeIdentica
|
2014-05-26 01:27:14 +04:00
|
|
|
* 2014-05-25
|
2013-08-15 13:02:43 +04:00
|
|
|
*
|
|
|
|
* @name Identica Bridge
|
2014-05-26 01:27:14 +04:00
|
|
|
* @homepage https://identi.ca/
|
2013-08-15 13:02:43 +04:00
|
|
|
* @description Returns user timelines
|
2014-05-21 21:44:14 +04:00
|
|
|
* @maintainer mitsukarenai
|
2013-08-15 13:02:43 +04:00
|
|
|
* @use1(u="username")
|
|
|
|
*/
|
|
|
|
class IdenticaBridge extends BridgeAbstract{
|
2013-08-15 15:58:58 +04:00
|
|
|
|
|
|
|
private $request;
|
2013-08-15 13:02:43 +04:00
|
|
|
|
|
|
|
public function collectData(array $param){
|
|
|
|
$html = '';
|
|
|
|
if (isset($param['u'])) { /* user timeline mode */
|
2013-08-15 15:58:58 +04:00
|
|
|
$this->request = $param['u'];
|
|
|
|
$html = file_get_html('https://identi.ca/'.urlencode($this->request)) or $this->returnError('Requested username can\'t be found.', 404);
|
2013-08-15 13:02:43 +04:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$this->returnError('You must specify an Identica username (?u=...).', 400);
|
|
|
|
}
|
|
|
|
|
|
|
|
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(){
|
2013-08-15 15:58:58 +04:00
|
|
|
return (!empty($this->request) ? $this->request .' - ' : '') .'Identica Bridge';
|
2013-08-15 13:02:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getURI(){
|
|
|
|
return 'https://identica.com';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCacheDuration(){
|
|
|
|
return 300; // 5 minutes
|
|
|
|
}
|
|
|
|
}
|