2020-12-13 13:50:54 +03:00
|
|
|
<?php
|
|
|
|
|
2024-10-16 19:37:30 +03:00
|
|
|
class OvertakeBridge extends FeedExpander
|
2020-12-13 13:50:54 +03:00
|
|
|
{
|
2024-10-16 19:37:30 +03:00
|
|
|
const NAME = 'Overtake News';
|
|
|
|
const URI = 'https://www.overtake.gg/';
|
|
|
|
const DESCRIPTION = 'Get the latest (sim)racing news from Overtake.';
|
2020-12-13 13:50:54 +03:00
|
|
|
const MAINTAINER = 't0stiman';
|
2024-02-04 20:28:12 +03:00
|
|
|
const DONATION_URI = 'https://ko-fi.com/tostiman';
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2020-12-13 13:50:54 +03:00
|
|
|
public function collectData()
|
2022-07-01 16:10:30 +03:00
|
|
|
{
|
2024-10-16 19:37:30 +03:00
|
|
|
$this->collectExpandableDatas('https://www.overtake.gg/ams/index.rss', 10);
|
2020-12-13 13:50:54 +03:00
|
|
|
}
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2023-10-13 02:59:05 +03:00
|
|
|
protected function parseItem(array $item)
|
2020-12-13 13:50:54 +03:00
|
|
|
{
|
2023-10-13 01:25:34 +03:00
|
|
|
$articlePage = getSimpleHTMLDOMCached($item['uri']);
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2021-05-17 21:18:51 +03:00
|
|
|
$coverImage = $articlePage->find('img.js-articleCoverImage', 0);
|
|
|
|
#relative url -> absolute url
|
|
|
|
$coverImage = str_replace('src="/', 'src="' . $this->getURI() . '/', $coverImage);
|
|
|
|
$article = $articlePage->find('article.articleBody-main > div.bbWrapper', 0);
|
|
|
|
$item['content'] = str_get_html($coverImage . $article);
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2020-12-13 13:50:54 +03:00
|
|
|
//convert iframes to links. meant for embedded videos.
|
|
|
|
foreach ($item['content']->find('iframe') as $found) {
|
|
|
|
$iframeUrl = $found->getAttribute('src');
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2020-12-13 13:50:54 +03:00
|
|
|
if ($iframeUrl) {
|
|
|
|
$found->outertext = '<a href="' . $iframeUrl . '">' . $iframeUrl . '</a>';
|
|
|
|
}
|
2022-07-01 16:10:30 +03:00
|
|
|
}
|
|
|
|
|
2021-05-17 21:18:51 +03:00
|
|
|
$item['categories'] = [];
|
|
|
|
foreach ($articlePage->find('a.tagItem') as $tag) {
|
|
|
|
array_push($item['categories'], $tag->innertext);
|
2020-12-13 13:50:54 +03:00
|
|
|
}
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2020-12-13 13:50:54 +03:00
|
|
|
return $item;
|
|
|
|
}
|
|
|
|
}
|