59 lines
2.5 KiB
PHP
59 lines
2.5 KiB
PHP
<?php
|
|
class Y2MateDownloaderBridge extends BridgeAbstract {
|
|
|
|
const MAINTAINER = 'Akamaru';
|
|
const NAME = 'Y2Mate Downloader Changelog';
|
|
const URI = 'https://y2mate.ch/de/y2mate-downloader-changelog';
|
|
const CACHE_TIMEOUT = 21600; // 6 hours
|
|
const DESCRIPTION = 'Changelog for Y2Mate Downloader';
|
|
|
|
public function collectData() {
|
|
$html = getSimpleHTMLDOM(self::URI);
|
|
|
|
// Extract main updates
|
|
foreach($html->find('div.container') as $section) {
|
|
$title_element = $section->find('p.edition.tc', 0);
|
|
$new_features_element = $section->find('div.list', 0);
|
|
$date_element = $section->find('p.tc.time', 0);
|
|
|
|
if ($title_element && $new_features_element && $date_element) {
|
|
$item = [];
|
|
$item['title'] = str_replace(' ChangeLog', '', $title_element->plaintext); // Remove "ChangeLog"
|
|
$item['timestamp'] = strtotime(str_replace('Freigegeben am', '', $date_element->plaintext));
|
|
$item['uri'] = self::URI;
|
|
$item['uid'] = $item['title'];
|
|
$item['content'] = $new_features_element->outertext;
|
|
|
|
$this->items[] = $item;
|
|
}
|
|
}
|
|
|
|
// Extract updates from the history section
|
|
$history_section = $html->find('div.update-his', 0);
|
|
if ($history_section) {
|
|
foreach($history_section->find('div.list') as $history_update) {
|
|
$title_element = $history_update->find('p.edition.tl', 0);
|
|
$date_element = $history_update->find('p.tl.time', 0);
|
|
|
|
if ($title_element && $date_element) {
|
|
$item = [];
|
|
$item['title'] = $title_element->plaintext;
|
|
$item['timestamp'] = strtotime(str_replace('Freigegeben am', '', $date_element->plaintext));
|
|
$item['uri'] = self::URI;
|
|
$item['uid'] = $title_element->plaintext;
|
|
|
|
// Remove the title and date from the content
|
|
$history_update->find('p.edition.tl', 0)->outertext = '';
|
|
$history_update->find('p.tl.time', 0)->outertext = '';
|
|
$item['content'] = $history_update->innertext;
|
|
|
|
$this->items[] = $item;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public function getIcon() {
|
|
return 'https://y2mate.ch/favicon.ico';
|
|
}
|
|
} |