2013-08-15 13:02:43 +04:00
|
|
|
<?php
|
|
|
|
class IdenticaBridge extends BridgeAbstract{
|
2015-11-05 18:50:18 +03:00
|
|
|
|
2016-08-27 22:03:26 +03:00
|
|
|
public $maintainer = "mitsukarenai";
|
|
|
|
public $name = "Identica Bridge";
|
|
|
|
public $uri = "https://identi.ca/";
|
|
|
|
public $description = "Returns user timelines";
|
2015-11-05 18:50:18 +03:00
|
|
|
|
2016-08-27 22:03:26 +03:00
|
|
|
public $parameters = array( array(
|
|
|
|
'u'=>array(
|
|
|
|
'name'=>'username',
|
|
|
|
'required'=>true
|
|
|
|
)
|
|
|
|
));
|
2015-11-05 18:50:18 +03:00
|
|
|
|
2016-08-25 02:24:53 +03:00
|
|
|
public function collectData(){
|
2016-08-27 15:47:52 +03:00
|
|
|
$html = $this->getSimpleHTMLDOM($this->getURI())
|
|
|
|
or $this->returnServerError('Requested username can\'t be found.');
|
2013-08-15 13:02:43 +04:00
|
|
|
|
|
|
|
foreach($html->find('li.major') as $dent) {
|
2016-08-22 19:55:59 +03:00
|
|
|
$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
|
2016-08-28 02:25:33 +03:00
|
|
|
$item['title'] = $this->getInput('u') . ' | ' . $item['content'];
|
2013-08-15 13:02:43 +04:00
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getName(){
|
2016-08-28 02:25:33 +03:00
|
|
|
return $this->getInput('u') .' - Identica Bridge';
|
2013-08-15 13:02:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getURI(){
|
2016-08-28 02:25:33 +03:00
|
|
|
return $this->uri.urlencode($this->getInput('u'));
|
2013-08-15 13:02:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getCacheDuration(){
|
|
|
|
return 300; // 5 minutes
|
|
|
|
}
|
|
|
|
}
|