2021-12-20 10:36:44 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class KhinsiderBridge extends BridgeAbstract
|
|
|
|
{
|
|
|
|
const MAINTAINER = 'Chouchenos';
|
|
|
|
const NAME = 'Khinsider';
|
|
|
|
const URI = 'https://downloads.khinsider.com/';
|
|
|
|
const CACHE_TIMEOUT = 14400; // 4 h
|
|
|
|
const DESCRIPTION = 'Fetch daily game OST from Khinsider';
|
|
|
|
|
|
|
|
public function collectData()
|
|
|
|
{
|
2022-01-02 12:36:09 +03:00
|
|
|
$html = getSimpleHTMLDOM(self::URI);
|
2021-12-20 10:36:44 +03:00
|
|
|
|
2022-06-04 23:41:37 +03:00
|
|
|
$dates = $html->find('.latestSoundtrackHeading');
|
|
|
|
$tables = $html->find('.albumList');
|
2022-04-13 00:37:30 +03:00
|
|
|
// $dates is empty
|
2022-06-04 23:41:37 +03:00
|
|
|
foreach ($dates as $i => $date) {
|
2021-12-20 10:36:44 +03:00
|
|
|
$item = [];
|
|
|
|
$item['uri'] = self::URI;
|
2022-06-04 23:41:37 +03:00
|
|
|
$item['timestamp'] = DateTime::createFromFormat('F jS, Y', $date->plaintext)->setTime(1, 1)->format('U');
|
2021-12-20 10:36:44 +03:00
|
|
|
$item['title'] = sprintf('OST for %s', $date->plaintext);
|
|
|
|
$item['author'] = 'Khinsider';
|
2022-06-04 23:41:37 +03:00
|
|
|
$trs = $tables[$i]->find('tr');
|
2021-12-20 10:36:44 +03:00
|
|
|
$content = '<ul>';
|
2022-06-04 23:41:37 +03:00
|
|
|
foreach ($trs as $tr) {
|
|
|
|
$td = $tr->find('td', 1);
|
|
|
|
if (null !== $td) {
|
|
|
|
$link = $td->find('a', 0);
|
|
|
|
$content .= sprintf('<li><a href="%s">%s</a></li>', $link->href, $link->plaintext);
|
|
|
|
}
|
2021-12-20 10:36:44 +03:00
|
|
|
}
|
|
|
|
$content .= '</ul>';
|
|
|
|
$item['content'] = $content;
|
|
|
|
$item['uid'] = $item['timestamp'];
|
|
|
|
$item['categories'] = ['Video games', 'Music', 'OST', 'download'];
|
|
|
|
|
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|