Merge branch 'master' of github.com:RSS-Bridge/rss-bridge
This commit is contained in:
commit
4d36c9dc30
2 changed files with 42 additions and 4 deletions
|
@ -15,10 +15,10 @@ class N26Bridge extends BridgeAbstract
|
||||||
|
|
||||||
public function collectData()
|
public function collectData()
|
||||||
{
|
{
|
||||||
$html = getSimpleHTMLDOM(self::URI . '/en-fr/blog-archive')
|
$html = getSimpleHTMLDOM(self::URI . '/en-eu/blog-archive')
|
||||||
or returnServerError('Error while downloading the website content');
|
or returnServerError('Error while downloading the website content');
|
||||||
|
|
||||||
foreach($html->find('div.ga') as $article) {
|
foreach($html->find('div[class="ag ah ai aj bs bt dx ea fo gx ie if ih ii ij ik s"]') as $article) {
|
||||||
$item = [];
|
$item = [];
|
||||||
|
|
||||||
$item['uri'] = self::URI . $article->find('h2 a', 0)->href;
|
$item['uri'] = self::URI . $article->find('h2 a', 0)->href;
|
||||||
|
@ -27,9 +27,9 @@ class N26Bridge extends BridgeAbstract
|
||||||
$fullArticle = getSimpleHTMLDOM($item['uri'])
|
$fullArticle = getSimpleHTMLDOM($item['uri'])
|
||||||
or returnServerError('Error while downloading the full article');
|
or returnServerError('Error while downloading the full article');
|
||||||
|
|
||||||
$dateElement = $fullArticle->find('span[class="fk fl de ch fm by"]', 0);
|
$dateElement = $fullArticle->find('time', 0);
|
||||||
$item['timestamp'] = strtotime($dateElement->plaintext);
|
$item['timestamp'] = strtotime($dateElement->plaintext);
|
||||||
$item['content'] = $fullArticle->find('main article', 0)->innertext;
|
$item['content'] = $fullArticle->find('div[class="af ag ah ai an"]', 1)->innertext;
|
||||||
|
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
|
|
38
bridges/ViceBridge.php
Normal file
38
bridges/ViceBridge.php
Normal file
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue