forked from RSS-Bridge/rss-bridge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MozillaSecurity] New Bridge (RSS-Bridge#946)
* [MozillaSecurity] New Bridge Kudo to @teromene & @ArthurHoaro on this one !
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
class MozillaSecurityBridge extends BridgeAbstract { | ||
|
||
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(){ | ||
$html = getSimpleHTMLDOM(self::URI) | ||
or returnServerError('Could not request MSA.'); | ||
|
||
$html = defaultLinkTo($html, self::WEBROOT); | ||
|
||
$item = array(); | ||
$articles = $html->find('div[itemprop="articleBody"] h2'); | ||
|
||
foreach ($articles as $element) { | ||
$item['title'] = $element->innertext; | ||
$item['timestamp'] = strtotime($element->innertext); | ||
$item['content'] = $element->next_sibling()->innertext; | ||
$item['uri'] = self::URI; | ||
$this->items[] = $item; | ||
} | ||
} | ||
} |