Socket
Socket
Sign inDemoInstall

feedparser

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

feedparser - npm Package Compare versions

Comparing version 0.16.6 to 0.17.0

5

bin/dump.js

@@ -9,3 +9,4 @@ #!/usr/bin/env node

*/
var util = require('util')
var isatty = require('tty').isatty
, util = require('util')
, FeedParser = require('../');

@@ -18,4 +19,4 @@

while (item = stream.read()) {
console.log(util.inspect(item, null, 10, true));
console.log(util.inspect(item, null, 10, isatty(1) && isatty(2)));
}
});

2

examples/iconv.js

@@ -16,3 +16,3 @@ /**

req.setMaxListeners(50);
// Some feeds do not response without user-agent and accept headers.
// Some feeds do not respond without user-agent and accept headers.
req.setHeader('user-agent', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36')

@@ -19,0 +19,0 @@ .setHeader('accept', 'text/html,application/xhtml+xml');

v0.17.0 / 2014-05-27
==================
* Improve tests
* Use readable-stream instead of core stream; update dependencies.
* Update README
* Add permalink property for RSS feeds
* Add nodeico badge
* Remove unnecessary test server
* Only colorize dump output if outputing to a terminal.
* Fix small typo.
v0.16.6 / 2014-02-12

@@ -3,0 +15,0 @@ ==================

@@ -17,10 +17,6 @@ /**********************************************************************

, util = require('util')
, TransformStream = require('stream').Transform
, TransformStream = require('readable-stream').Transform
, utils = require('./utils')
;
if (TransformStream === undefined) {
TransformStream = require('readable-stream').Transform;
}
/**

@@ -729,2 +725,3 @@ * FeedParser constructor. Most apps will only use one instance.

var el = node[name]
, attrs = el['@']
, enclosure = {};

@@ -805,2 +802,13 @@ if (normalize) {

item.guid = utils.get(el);
// http://cyber.law.harvard.edu/rss/rss.html#ltguidgtSubelementOfLtitemgt
// If the guid element has an attribute named "isPermaLink" with a value
// of true, the reader may assume that it is a permalink to the item,
// that is, a url that can be opened in a Web browser, that points to
// the full item described by the <item> element.
// isPermaLink is optional, its default value is true. If its value is
// false, the guid may not be assumed to be a url, or a url to anything
// in particular.
if (item.guid && type == 'rss' && name == 'guid' && attrs.ispermalink !== 'false') {
item.permalink = item.guid;
}
break;

@@ -807,0 +815,0 @@ case('author'):

@@ -5,3 +5,3 @@ {

"description": "Robust RSS Atom and RDF feed parsing using sax js",
"version": "0.16.6",
"version": "0.17.0",
"keywords": [

@@ -30,6 +30,6 @@ "rss",

"dependencies": {
"sax": "0.5.x",
"sax": "~0.6.0",
"addressparser": "~0.1.3",
"array-indexofobject": "0.0.1",
"readable-stream": "1.0.x",
"array-indexofobject": "~0.0.1",
"readable-stream": "~1.0.17",
"resanitize": "~0.3.0"

@@ -36,0 +36,0 @@ },

[![Build Status](https://secure.travis-ci.org/danmactough/node-feedparser.png?branch=master)](https://travis-ci.org/danmactough/node-feedparser)
[![NPM](https://nodei.co/npm/feedparser.png?downloads=true&stars=true)](https://nodei.co/npm/feedparser/)
# Feedparser - Robust RSS, Atom, and RDF feed parsing in Node.js

@@ -194,2 +196,3 @@

* origlink (when FeedBurner or Pheedo puts a special tracking url in the `link` property, `origlink` contains the original link)
* permalink (when an RSS feed has a `guid` field and the `isPermalink` attribute is not set to `false`, `permalink` contains the value of `guid`)
* date (most recent update)

@@ -196,0 +199,0 @@ * pubdate (original published date)

@@ -6,3 +6,4 @@ describe('api', function () {

it('should read a stream via .pipe()', function (done) {
var events = [];
var meta
, items = [];

@@ -12,20 +13,17 @@ fs.createReadStream(feed).pipe(FeedParser())

assert.ifError(err);
events.push('error');
done(err);
})
.on('meta', function (meta) {
assert.notEqual(meta, null);
events.push('meta');
.on('meta', function (_meta) {
meta = _meta;
})
.on('readable', function () {
var stream = this, items = [], item;
while (item = stream.read()) {
var item;
while (item = this.read()) {
items.push(item);
}
assert.ok(items.length);
events.push('article');
})
.on('end', function () {
assert.equal(events.indexOf('error'), -1);
assert.ok(~events.indexOf('meta'));
assert.ok(~events.indexOf('article'));
assert(meta);
assert.strictEqual(items.length, 4);
done();

@@ -36,3 +34,5 @@ });

it('should parse and set options', function (done) {
var options = { normalize: false, addmeta: false };
var meta
, item
, options = { normalize: false, addmeta: false };

@@ -44,10 +44,13 @@ fs.createReadStream(feed).pipe(FeedParser(options))

})
.on('meta', function (meta) {
assert.notEqual(meta, null);
.on('meta', function (_meta) {
meta = _meta;
})
.on('readable', function () {
var _item = this.read();
item || (item = _item);
})
.on('end', function () {
assert(meta);
assert.equal(meta.title, null);
assert.equal(meta['rss:title']['#'], 'Liftoff News');
})
.once('readable', function () {
var stream = this;
var item = stream.read();
assert.equal(item.meta, null);

@@ -54,0 +57,0 @@ done();

@@ -8,2 +8,3 @@ describe('bad feeds', function(){

it('should emit an error and no data', function (done) {
var error;
fs.createReadStream(feed).pipe(new FeedParser())

@@ -14,4 +15,7 @@ .once('readable', function () {

.on('error', function (err) {
assert.ok(err instanceof Error);
assert.equal(err.message, 'Not a feed');
error = err;
})
.on('end', function () {
assert.ok(error instanceof Error);
assert.equal(error.message, 'Not a feed');
done();

@@ -18,0 +22,0 @@ });

@@ -1,46 +0,4 @@

/*global assert:true, FeedParser:true, server:true*/
var URL = require('url');
/*global assert:true, FeedParser:true, fs:true*/
assert = require('assert');
var path = require('path')
, zlib = require('zlib')
, gzip = zlib.createGzip();
fs = require('fs');
FeedParser = require('../');
server = function (done) {
var app = require('http').createServer();
app.on('request', function (req, res) {
var url = URL.parse(req.url, true)
, file = path.resolve(__dirname, 'feeds', url.pathname.replace(/^\//, ''));
if (url.query['notModified'] === 'true') {
res.writeHead('304', 'Not modified');
res.end();
}
else {
fs.exists(file, function (exists) {
if (!exists) {
res.writeHead('404', 'Not found');
return res.end();
}
// gzip the response unless the Accept-Encoding header says otherwise - issue #36
if (url.query['gzip'] === 'true' && !req.headers['accept-encoding'].match(/identity/i)) {
fs.createReadStream(file).pipe(gzip).pipe(res);
}
else {
fs.createReadStream(file).pipe(res);
}
});
}
});
app.listen(21337, function () {
done && done();
});
server.app = app;
server.close = function (done) {
app.close.call(app, function (){
delete server.app;
done && done();
});
};
};

Sorry, the diff of this file is not supported yet

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