Socket
Socket
Sign inDemoInstall

rss-combiner

Package Overview
Dependencies
88
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.4 to 0.0.5

45

lib/index.js

@@ -9,3 +9,3 @@ 'use strict';

function getEntries(url) {
function getEntries(softFail, url) {
var deferred = Q.defer();

@@ -23,4 +23,7 @@ var fp = new FeedParser();

req.on('error', function (err) {
console.error(err);
deferred.reject(err);
if (softFail) {
deferred.resolve(null);
} else {
deferred.reject(err);
}
});

@@ -30,4 +33,7 @@ req.on('response', function (res) {

var err = new Error('Bad response %d', res.statusCode);
console.error(err);
deferred.reject(err);
if (softFail) {
deferred.resolve(null);
} else {
deferred.reject(err);
}
}

@@ -38,4 +44,5 @@ req.pipe(fp);

fp.on('error', function (err) {
console.error(err);
deferred.reject(err);
if (!softFail) {
deferred.reject(err);
}
});

@@ -67,3 +74,13 @@ var items = [];

for (var i = 0; i < entries.length; i++) {
newFeed.item(entries[i]);
var thisEntry = entries[i];
var item = {
title: thisEntry.title,
description: thisEntry.title,
url: thisEntry.link,
guid: thisEntry.guid,
categories: thisEntry.categories,
author: thisEntry.author,
date: thisEntry.pubdate
};
newFeed.item(item);
}

@@ -88,2 +105,10 @@ return newFeed;

if (err == null) {
if (!feedConfig.generator) {
feedConfig.generator = 'rss-combiner for Node';
}
if (!feedConfig.link) {
feedConfig.link = 'https://www.npmjs.com/package/rss-combiner';
}
// Strip properties 'feeds' and 'size' from config to be passed to `rss` module

@@ -96,3 +121,5 @@ var strippedConfig = {};

Q
.all(_.map(feedConfig.feeds, getEntries))
.all(_.map(feedConfig.feeds, function (feed) {
return getEntries(feedConfig.softFail || false, feed);
}))
.then(_.flatten)

@@ -99,0 +126,0 @@ .then(function (entries) { return _.sortBy(entries, sortEntries) })

2

package.json
{
"name": "rss-combiner",
"version": "0.0.4",
"version": "0.0.5",
"description": "Combine multiple RSS feed sources into one",

@@ -5,0 +5,0 @@ "keywords": [

@@ -35,5 +35,23 @@ rss-combiner [![Build Status](https://travis-ci.org/awocallaghan/node-rss-combiner.svg?branch=master)](https://travis-ci.org/awocallaghan/node-rss-combiner)

Plus 2 additional required options:
Additional options
* `size` **int** the maximum number of entries to keep (most recently published will be kept)
* `feeds` **array url string** array of feed_urls to retrieve content from
* `softFail` _optional_ **boolean** if true failing to retrieve a single feed will not result in an error being thrown (default value: false)
##### Example `feedOptions`
Creates a new feed with a maximum of 20 entries containing the latest entries from
2 RSS feeds.
```js
var feedConfig = {
title: 'Tech news from Guardian and BBC',
size: 20,
feeds: [
'http://feeds.bbci.co.uk/news/technology/rss.xml',
'https://www.theguardian.com/uk/technology/rss'
],
pubDate: new Date()
};
```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc