mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-22 11:28:36 +00:00
[SamMobileBridge] New brige to fetches the latest security patches for Samsung devices (#4676)
* [SamMobileBridge] Fetches the latest security patches for Samsung devices * [SamMobileBridge] Add date handling * [SamMobileBridge] Remove empty spaces * [SamMobileBridge] add strict_types --------- Co-authored-by: Florent VIOLLEAU <florent.violleau@samsic.fr>
This commit is contained in:
parent
b423b13bd5
commit
096e398e41
55
bridges/SamMobileUpdateBridge.php
Normal file
55
bridges/SamMobileUpdateBridge.php
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
class SamMobileUpdateBridge extends BridgeAbstract
|
||||||
|
{
|
||||||
|
const NAME = 'SamMobile updates';
|
||||||
|
// pull info from this site
|
||||||
|
const URI = 'https://www.sammobile.com/samsung/security/';
|
||||||
|
const DESCRIPTION = 'Fetches the latest security patches for Samsung devices';
|
||||||
|
const MAINTAINER = 'floviolleau';
|
||||||
|
const PARAMETERS = [
|
||||||
|
[
|
||||||
|
'model' => [
|
||||||
|
'name' => 'Model',
|
||||||
|
'exampleValue' => 'SM-S926B',
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
'country' => [
|
||||||
|
'name' => 'Country',
|
||||||
|
'exampleValue' => 'EUX',
|
||||||
|
'required' => true,
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
const CACHE_TIMEOUT = 7200; // 2h
|
||||||
|
|
||||||
|
public function collectData()
|
||||||
|
{
|
||||||
|
$model = $this->getInput('model');
|
||||||
|
$country = $this->getInput('country');
|
||||||
|
$uri = self::URI . $model . '/' . $country;
|
||||||
|
$html = getSimpleHTMLDOM($uri);
|
||||||
|
|
||||||
|
$elementsDom = $html->find('.main-content-item__content.main-content-item__content-md table tbody tr');
|
||||||
|
|
||||||
|
foreach ($elementsDom as $elementDom) {
|
||||||
|
$item = [];
|
||||||
|
|
||||||
|
$td = $elementDom->find('td');
|
||||||
|
|
||||||
|
$title = 'Security patch: ' . $td[2] . ' - Android version: ' . $td[3] . ' - PDA: ' . $td[4];
|
||||||
|
$text = 'Model: ' . $td[0] . '<br>Country/Carrier: ' . $td[1] . '<br>Security patch: ' . $td[2] . '<br>OS version: Android ' . $td[3] . '<br>PDA: ' . $td[4];
|
||||||
|
|
||||||
|
$item['uri'] = $uri;
|
||||||
|
$item['title'] = $title;
|
||||||
|
$item['author'] = self::MAINTAINER;
|
||||||
|
$item['timestamp'] = (new DateTime($td[2]->innertext))->getTimestamp();
|
||||||
|
$item['content'] = $text;
|
||||||
|
$item['uid'] = hash('sha256', $item['title']);
|
||||||
|
|
||||||
|
$this->items[] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user