-
Notifications
You must be signed in to change notification settings - Fork 1k
/
UsesTechBridge.php
30 lines (26 loc) · 1.06 KB
/
UsesTechBridge.php
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
<?php
class UsesTechbridge extends BridgeAbstract
{
const NAME = '/uses';
const URI = 'https://uses.tech/';
const DESCRIPTION = 'RSS feed for /uses';
const MAINTAINER = '[email protected]';
const MAX_ITEM = 100; # Maximum items to loop through which works fast enough on my computer
public function collectData()
{
$html = getSimpleHTMLDOM(self::URI)
or returnServerError('Could not request: ' . self::URI);
foreach ($html->find('div[class=PersonInner]') as $index => $a) {
$item = []; // Create an empty item
$articlePath = $a->find('a[class=displayLink]', 0)->href;
$item['title'] = $a->find('img', 0)->getAttribute('alt');
$item['author'] = $a->find('img', 0)->getAttribute('alt');
$item['uri'] = $articlePath;
$item['content'] = $a->find('p', 0)->innertext;
$this->items[] = $item; // Add item to the list
if (count($this->items) >= self::MAX_ITEM) {
break;
}
}
}
}