2022-06-06 02:02:15 +03:00
|
|
|
<?php
|
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
class PCGWNewsBridge extends FeedExpander
|
|
|
|
{
|
|
|
|
const MAINTAINER = 'somini';
|
|
|
|
const NAME = 'PCGamingWiki News';
|
|
|
|
const BASE_URI = 'https://www.pcgamingwiki.com';
|
|
|
|
const URI = self::BASE_URI . '/wiki/PCGamingWiki:News';
|
|
|
|
const DESCRIPTION = 'PCGW News Feed';
|
2022-06-06 02:02:15 +03:00
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
public function getIcon()
|
|
|
|
{
|
|
|
|
return 'https://static.pcgamingwiki.com/favicons/pcgamingwiki.png';
|
|
|
|
}
|
2022-06-06 02:02:15 +03:00
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
public function collectData()
|
|
|
|
{
|
|
|
|
$html = getSimpleHTMLDOM($this->getURI());
|
2022-06-06 02:02:15 +03:00
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
$now = strtotime('now');
|
2022-06-06 02:02:15 +03:00
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
foreach ($html->find('.mw-parser-output .news_li') as $element) {
|
|
|
|
$item = [];
|
2022-06-06 02:02:15 +03:00
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
$date_string = $element->find('b', 0)->innertext;
|
|
|
|
$date = strtotime($date_string);
|
|
|
|
if ($date > $now) {
|
|
|
|
$date = strtotime($date_string . ' - 1 year');
|
|
|
|
}
|
|
|
|
$item['title'] = self::NAME . ' for ' . date('Y-m-d', $date);
|
|
|
|
$item['content'] = $element;
|
|
|
|
$item['uri'] = $this->getURI();
|
|
|
|
$item['timestamp'] = $date;
|
|
|
|
|
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
2022-06-06 02:02:15 +03:00
|
|
|
}
|