Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ViceBridge] - RSS feed for Vice Publications. #1310

Merged
merged 3 commits into from
Oct 3, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions bridges/ViceBridge.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
class ViceBridge extends FeedExpander {
const MAINTAINER = 'IceWreck';
const NAME = 'Vice Bridge';
const URI = 'https://www.vice.com/';
const CACHE_TIMEOUT = 3600; // This is a news site, so don't cache for more than 10 mins
const DESCRIPTION = 'RSS feed for vice publications like Vice News, Munchies, Motherboard, etc.';
const PARAMETERS = array( array(
'feed' => array(
'name' => 'Feed',
'type' => 'list',
'values' => array(
'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');
$feedURL = 'https://www.vice.com/' . $feed;
$this->collectExpandableDatas($feedURL, 10);
}

protected function parseItem($newsItem){
$item = parent::parseItem($newsItem);
// $articlePage gets the entire page's contents
$articlePage = getSimpleHTMLDOM($newsItem->link);
// text and embedded content
$article = $article . $articlePage->find('.article__body', 0);
$item['content'] = $article;

return $item;
}
}