2021-07-06 16:00:19 +03:00
|
|
|
|
<?php
|
|
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
|
class NikonDownloadCenterBridge extends BridgeAbstract
|
|
|
|
|
{
|
|
|
|
|
const NAME = 'Nikon Download Center – What\'s New';
|
|
|
|
|
const URI = 'https://downloadcenter.nikonimglib.com/';
|
|
|
|
|
const DESCRIPTION = 'Firmware updates and new software from Nikon.';
|
|
|
|
|
const MAINTAINER = 'sal0max';
|
|
|
|
|
const CACHE_TIMEOUT = 60 * 60 * 2; // 2 hours
|
2021-07-06 16:00:19 +03:00
|
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
|
public function getURI()
|
|
|
|
|
{
|
|
|
|
|
$year = date('Y');
|
|
|
|
|
return self::URI . 'en/update/index/' . $year . '.html';
|
|
|
|
|
}
|
2021-07-06 16:00:19 +03:00
|
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
|
public function getIcon()
|
|
|
|
|
{
|
|
|
|
|
return self::URI . 'favicon.ico';
|
|
|
|
|
}
|
2021-07-06 16:00:19 +03:00
|
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
|
public function collectData()
|
|
|
|
|
{
|
|
|
|
|
$html = getSimpleHTMLDOM($this->getURI());
|
2021-07-06 16:00:19 +03:00
|
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
|
foreach ($html->find('dd>ul>li') as $element) {
|
|
|
|
|
$date = $element->find('.date', 0)->plaintext;
|
|
|
|
|
$productType = $element->find('.icon>img', 0)->alt;
|
|
|
|
|
$desc = $element->find('p>a', 0)->plaintext;
|
|
|
|
|
$link = urljoin(self::URI, $element->find('p>a', 0)->href);
|
|
|
|
|
|
|
|
|
|
$item = [
|
|
|
|
|
'title' => $desc,
|
|
|
|
|
'uri' => $link,
|
|
|
|
|
'timestamp' => strtotime($date),
|
|
|
|
|
'content' => <<<EOD
|
2021-07-06 16:00:19 +03:00
|
|
|
|
<p>
|
|
|
|
|
New/updated {$productType}:<br>
|
|
|
|
|
<strong><a href="{$link}">{$desc}</a></strong>
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
{$date}
|
|
|
|
|
</p>
|
|
|
|
|
EOD
|
2022-07-01 16:10:30 +03:00
|
|
|
|
];
|
|
|
|
|
$this->items[] = $item;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-07-06 16:00:19 +03:00
|
|
|
|
}
|