Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rss-parser

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rss-parser - npm Package Compare versions

Comparing version 2.2.2 to 2.2.4

test/input/heise.atom

28

index.js

@@ -40,19 +40,23 @@ var Entities = require("entities");

var json = {feed: {entries: []}};
if (feed.link[0] && feed.link[0].$.href) {
json.feed.link = feed.link[0].$.href;
if (feed.link) {
if (feed.link[0] && feed.link[0].$.href) json.feed.link = feed.link[0].$.href;
if (feed.link[1] && feed.link[1].$.href) json.feed.feedUrl = feed.link[1].$.href;
}
if (feed.link[1] && feed.link[1].$.href) {
json.feed.feedUrl = feed.link[1].$.href;
if (feed.title) {
var title = feed.title[0] || '';
if (title._) title = title._
if (title) json.feed.title = title;
}
if (feed.title[0]) {
json.feed.title = feed.title[0];
}
var entries = feed.entry;
(entries || []).forEach(function (entry) {
var item = {};
if (entry.title) item.title = entry.title[0];
if (entry.link) item.link = entry.link[0].$.href;
if (entry.updated) item.pubDate = new Date(entry.updated[0]).toISOString();
if (entry.author) item.author = entry.author[0].name[0];
if (entry.content) {
if (entry.title) {
var title = entry.title[0] || '';
if (title._) title = title._;
if (title) item.title = title;
}
if (entry.link && entry.link.length) item.link = entry.link[0].$.href;
if (entry.updated && entry.updated.length) item.pubDate = new Date(entry.updated[0]).toISOString();
if (entry.author && entry.author.length) item.author = entry.author[0].name[0];
if (entry.content && entry.content.length) {
item.content = getContent(entry.content[0]);

@@ -59,0 +63,0 @@ item.contentSnippet = getSnippet(item.content)

{
"name": "rss-parser",
"version": "2.2.2",
"version": "2.2.4",
"main": "index.js",

@@ -5,0 +5,0 @@ "scripts": {

@@ -32,5 +32,5 @@ var FS = require('fs');

it('should parse craigslist', function(done) {
Parser.parseURL('https://seattle.craigslist.org/search/act?format=rss', function(err, parsed) {
Expect(err).to.not.equal(null);
it('should not parse craigslist (RSS 1.0)', function(done) {
Parser.parseFile(__dirname + '/input/craigslist.rss', function(err, parsed) {
Expect(err.indexOf('not yet implemented')).to.not.equal(-1);
done();

@@ -51,2 +51,10 @@ })

})
it('should parse with missing fields', function(done) {
testParseForFile('missing-fields', 'atom', done)
})
it('should parse heise', function(done) {
testParseForFile('heise', 'atom', done);
})
})
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc