mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-21 17:58:42 +02:00
[SamMobileBridge] New brige to fetches the latest security patches for Samsung devices (#4676)
Some checks are pending
Build Image on Commit and Release / bake (push) Waiting to run
Lint / phpcs (7.4) (push) Waiting to run
Lint / phpcompatibility (7.4) (push) Waiting to run
Lint / executable_php_files_check (push) Waiting to run
Tests / phpunit8 (7.4) (push) Waiting to run
Tests / phpunit8 (8.0) (push) Waiting to run
Tests / phpunit8 (8.1) (push) Waiting to run
Tests / phpunit8 (8.2) (push) Waiting to run
Tests / phpunit8 (8.3) (push) Waiting to run
Tests / phpunit8 (8.4) (push) Waiting to run
Some checks are pending
Build Image on Commit and Release / bake (push) Waiting to run
Lint / phpcs (7.4) (push) Waiting to run
Lint / phpcompatibility (7.4) (push) Waiting to run
Lint / executable_php_files_check (push) Waiting to run
Tests / phpunit8 (7.4) (push) Waiting to run
Tests / phpunit8 (8.0) (push) Waiting to run
Tests / phpunit8 (8.1) (push) Waiting to run
Tests / phpunit8 (8.2) (push) Waiting to run
Tests / phpunit8 (8.3) (push) Waiting to run
Tests / phpunit8 (8.4) (push) Waiting to run
* [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
1 changed files with 55 additions and 0 deletions
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…
Add table
Add a link
Reference in a new issue