2018-11-30 20:25:02 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class MozillaSecurityBridge extends BridgeAbstract
|
2022-07-01 16:10:30 +03:00
|
|
|
{
|
2018-11-30 20:25:02 +03:00
|
|
|
const MAINTAINER = 'm0le.net';
|
|
|
|
const NAME = 'Mozilla Security Advisories';
|
|
|
|
const URI = 'https://www.mozilla.org/en-US/security/advisories/';
|
|
|
|
const CACHE_TIMEOUT = 7200; // 2h
|
|
|
|
const DESCRIPTION = 'Mozilla Security Advisories';
|
|
|
|
const WEBROOT = 'https://www.mozilla.org';
|
|
|
|
|
|
|
|
public function collectData()
|
|
|
|
{
|
2022-01-02 12:36:09 +03:00
|
|
|
$html = getSimpleHTMLDOM(self::URI);
|
2018-11-30 20:25:02 +03:00
|
|
|
|
|
|
|
$html = defaultLinkTo($html, self::WEBROOT);
|
|
|
|
|
|
|
|
$item = [];
|
2020-01-10 16:22:58 +03:00
|
|
|
$articles = $html->find('div[id="main-content"] h2');
|
2018-11-30 20:25:02 +03:00
|
|
|
|
|
|
|
foreach ($articles as $element) {
|
2021-10-09 14:03:12 +03:00
|
|
|
//Limit total amount of requests
|
|
|
|
if (count($this->items) >= 20) {
|
|
|
|
break;
|
|
|
|
}
|
2018-11-30 20:25:02 +03:00
|
|
|
$item['title'] = $element->innertext;
|
|
|
|
$item['timestamp'] = strtotime($element->innertext);
|
|
|
|
$item['content'] = $element->next_sibling()->innertext;
|
2019-02-19 23:50:00 +03:00
|
|
|
$item['uri'] = self::URI . '?' . $item['timestamp'];
|
|
|
|
$item['uid'] = self::URI . '?' . $item['timestamp'];
|
2018-11-30 20:25:02 +03:00
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|