blob: dd81c55921cedbd2657e8228edaf8e95319f718c (
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
43
44
|
<?php
class ViceBridge extends FeedExpander
{
const MAINTAINER = 'IceWreck';
const NAME = 'Vice Bridge';
const URI = 'https://www.vice.com/';
const CACHE_TIMEOUT = 3600;
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'
]
]
]];
public function collectData()
{
$feed = $this->getInput('feed');
if ($feed === 'rss') {
// They changed url in Sep 2023
$feed = 'en/rss';
}
$feedURL = 'https://www.vice.com/' . $feed;
$this->collectExpandableDatas($feedURL, 10);
}
protected function parseItem(array $item)
{
$articlePage = getSimpleHTMLDOM($item['uri']);
// text and embedded content
$article = $articlePage->find('.article__body', 0);
$item['content'] = $article ?? '';
return $item;
}
}
|