2019-07-29 13:12:55 +03:00
|
|
|
<?php
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2019-07-29 13:12:55 +03:00
|
|
|
class FabriceBellardBridge extends BridgeAbstract
|
|
|
|
{
|
|
|
|
const NAME = 'Fabrice Bellard';
|
|
|
|
const URI = 'https://bellard.org/';
|
|
|
|
const DESCRIPTION = "Fabrice Bellard's Home Page";
|
|
|
|
const MAINTAINER = 'somini';
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2019-07-29 13:12:55 +03:00
|
|
|
public function collectData()
|
|
|
|
{
|
2022-01-02 12:36:09 +03:00
|
|
|
$html = getSimpleHTMLDOM(self::URI);
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2019-07-29 13:12:55 +03:00
|
|
|
foreach ($html->find('p') as $obj) {
|
|
|
|
$item = [];
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2019-07-29 13:12:55 +03:00
|
|
|
$html = defaultLinkTo($html, $this->getURI());
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2019-07-29 13:12:55 +03:00
|
|
|
$links = $obj->find('a');
|
|
|
|
if (count($links) > 0) {
|
|
|
|
$link_uri = $links[0]->href;
|
|
|
|
} else {
|
|
|
|
$link_uri = $this->getURI();
|
|
|
|
}
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2019-07-29 13:12:55 +03:00
|
|
|
/* try to make sure the link is valid */
|
|
|
|
if ($link_uri[-1] !== '/' && strpos($link_uri, '/') === false) {
|
|
|
|
$link_uri = $link_uri . '/';
|
|
|
|
}
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2019-07-29 13:12:55 +03:00
|
|
|
$item['title'] = strip_tags($obj->innertext);
|
|
|
|
$item['uri'] = $link_uri;
|
|
|
|
$item['content'] = $obj->innertext;
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2019-07-29 13:12:55 +03:00
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|