2019-10-03 23:02:30 +03:00
|
|
|
<?php
|
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
class ViceBridge extends FeedExpander
|
|
|
|
{
|
|
|
|
const MAINTAINER = 'IceWreck';
|
|
|
|
const NAME = 'Vice Bridge';
|
|
|
|
const URI = 'https://www.vice.com/';
|
2023-09-23 21:39:02 +03:00
|
|
|
const CACHE_TIMEOUT = 3600;
|
2022-07-01 16:10:30 +03:00
|
|
|
const DESCRIPTION = 'RSS feed for vice publications like Vice News, Munchies, Motherboard, etc.';
|
|
|
|
const PARAMETERS = [ [
|
|
|
|
'feed' => [
|
|
|
|
'name' => 'Feed',
|
|
|
|
'type' => 'list',
|
|
|
|
'values' => [
|
|
|
|
'Vice News' => 'rss',
|
|
|
|
'Motherboard - Tech' => 'en_us/rss/topic/tech',
|
|
|
|
'Entertainment' => 'en_us/rss/topic/entertainment',
|
|
|
|
'Noisey - Music' => 'en_us/rss/topic/music',
|
|
|
|
'Munchies - Food' => 'en_us/rss/topic/food'
|
|
|
|
]
|
|
|
|
]
|
|
|
|
]];
|
2019-10-03 23:02:30 +03:00
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
public function collectData()
|
|
|
|
{
|
|
|
|
$feed = $this->getInput('feed');
|
2023-09-23 21:39:02 +03:00
|
|
|
if ($feed === 'rss') {
|
|
|
|
// They changed url in Sep 2023
|
|
|
|
$feed = 'en/rss';
|
|
|
|
}
|
2022-07-01 16:10:30 +03:00
|
|
|
$feedURL = 'https://www.vice.com/' . $feed;
|
|
|
|
$this->collectExpandableDatas($feedURL, 10);
|
|
|
|
}
|
2019-10-03 23:02:30 +03:00
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
protected function parseItem($newsItem)
|
|
|
|
{
|
|
|
|
$item = parent::parseItem($newsItem);
|
|
|
|
// $articlePage gets the entire page's contents
|
|
|
|
$articlePage = getSimpleHTMLDOM($newsItem->link);
|
|
|
|
// text and embedded content
|
2022-09-04 23:58:58 +03:00
|
|
|
$article = $articlePage->find('.article__body', 0);
|
2022-07-01 16:10:30 +03:00
|
|
|
$item['content'] = $article;
|
|
|
|
|
|
|
|
return $item;
|
|
|
|
}
|
2019-10-03 23:02:30 +03:00
|
|
|
}
|