blob: 6029eea2c4170623b782dd3e7d067e60b76d1f06 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
<?php
class IdenticaBridge extends BridgeAbstract
{
const MAINTAINER = 'mitsukarenai';
const NAME = 'Identica Bridge';
const URI = 'https://identi.ca/';
const CACHE_TIMEOUT = 300; // 5min
const DESCRIPTION = 'Returns user timelines';
const PARAMETERS = [ [
'u' => [
'name' => 'username',
'exampleValue' => 'jxself',
'required' => true
]
]];
public function collectData()
{
$html = getSimpleHTMLDOM($this->getURI());
foreach ($html->find('li.major') as $dent) {
$item = [];
// get dent link
$item['uri'] = html_entity_decode($dent->find('a', 0)->href);
// extract dent timestamp
$item['timestamp'] = strtotime($dent->find('abbr.easydate', 0)->plaintext);
// extract dent text
$item['content'] = trim($dent->find('div.activity-content', 0)->innertext);
$item['title'] = $this->getInput('u') . ' | ' . $item['content'];
$this->items[] = $item;
}
}
public function getName()
{
if (!is_null($this->getInput('u'))) {
return $this->getInput('u') . ' - Identica Bridge';
}
return parent::getName();
}
public function getURI()
{
if (!is_null($this->getInput('u'))) {
return self::URI . urlencode($this->getInput('u'));
}
return parent::getURI();
}
}
|