2013-08-15 11:02:43 +02:00
|
|
|
<?php
|
|
|
|
class IdenticaBridge extends BridgeAbstract{
|
2015-11-05 16:50:18 +01:00
|
|
|
|
2016-08-30 11:23:55 +02:00
|
|
|
const MAINTAINER = "mitsukarenai";
|
|
|
|
const NAME = "Identica Bridge";
|
|
|
|
const URI = "https://identi.ca/";
|
2016-09-25 17:04:28 +02:00
|
|
|
const CACHE_TIMEOUT = 300; // 5min
|
2016-08-30 11:23:55 +02:00
|
|
|
const DESCRIPTION = "Returns user timelines";
|
2015-11-05 16:50:18 +01:00
|
|
|
|
2016-08-30 11:23:55 +02:00
|
|
|
const PARAMETERS = array( array(
|
2016-08-27 21:03:26 +02:00
|
|
|
'u'=>array(
|
|
|
|
'name'=>'username',
|
|
|
|
'required'=>true
|
|
|
|
)
|
|
|
|
));
|
2015-11-05 16:50:18 +01:00
|
|
|
|
2016-08-25 01:24:53 +02:00
|
|
|
public function collectData(){
|
2016-09-25 23:22:33 +02:00
|
|
|
$html = getSimpleHTMLDOM($this->getURI())
|
|
|
|
or returnServerError('Requested username can\'t be found.');
|
2013-08-15 11:02:43 +02:00
|
|
|
|
|
|
|
foreach($html->find('li.major') as $dent) {
|
2016-08-22 18:55:59 +02: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 01:25:33 +02:00
|
|
|
$item['title'] = $this->getInput('u') . ' | ' . $item['content'];
|
2013-08-15 11:02:43 +02:00
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getName(){
|
2016-08-28 01:25:33 +02:00
|
|
|
return $this->getInput('u') .' - Identica Bridge';
|
2013-08-15 11:02:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getURI(){
|
2016-08-30 11:23:55 +02:00
|
|
|
return self::URI.urlencode($this->getInput('u'));
|
2013-08-15 11:02:43 +02:00
|
|
|
}
|
|
|
|
}
|