[KhinsiderBridge] fix RSS because of the new layout (#2767)

* [KhinsiderBridge] fix RSS because of the new layout

* [KhinsiderBridge] fix phpcs
This commit is contained in:
Shikiryu 2022-06-04 22:41:37 +02:00 committed by GitHub
parent 8e41887393
commit b7e1dc1ab1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 6 deletions

View File

@ -12,18 +12,23 @@ class KhinsiderBridge extends BridgeAbstract
{
$html = getSimpleHTMLDOM(self::URI);
$dates = $html->find('#EchoTopic h3');
$dates = $html->find('.latestSoundtrackHeading');
$tables = $html->find('.albumList');
// $dates is empty
foreach ($dates as $date) {
foreach ($dates as $i => $date) {
$item = array();
$item['uri'] = self::URI;
$item['timestamp'] = DateTime::createFromFormat('F jS, Y', $date->plaintext)->format('U');
$item['timestamp'] = DateTime::createFromFormat('F jS, Y', $date->plaintext)->setTime(1, 1)->format('U');
$item['title'] = sprintf('OST for %s', $date->plaintext);
$item['author'] = 'Khinsider';
$links = $date->next_sibling()->find('a');
$trs = $tables[$i]->find('tr');
$content = '<ul>';
foreach ($links as $link) {
$content .= sprintf('<li><a href="%s">%s</a></li>', $link->href, $link->plaintext);
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);
}
}
$content .= '</ul>';
$item['content'] = $content;