blob: 6de152761bd2ce190853833f103e3d48b920e85a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
<?php
class OvertakeBridge extends FeedExpander
{
const NAME = 'Overtake News';
const URI = 'https://www.overtake.gg/';
const DESCRIPTION = 'Get the latest (sim)racing news from Overtake.';
const MAINTAINER = 't0stiman';
const DONATION_URI = 'https://ko-fi.com/tostiman';
public function collectData()
{
$this->collectExpandableDatas('https://www.overtake.gg/ams/index.rss', 10);
}
protected function parseItem(array $item)
{
$articlePage = getSimpleHTMLDOMCached($item['uri']);
$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);
//convert iframes to links. meant for embedded videos.
foreach ($item['content']->find('iframe') as $found) {
$iframeUrl = $found->getAttribute('src');
if ($iframeUrl) {
$found->outertext = '<a href="' . $iframeUrl . '">' . $iframeUrl . '</a>';
}
}
$item['categories'] = [];
foreach ($articlePage->find('a.tagItem') as $tag) {
array_push($item['categories'], $tag->innertext);
}
return $item;
}
}
|