feedparser
Advanced tools
Comparing version 0.16.5 to 0.16.6
v0.16.6 / 2014-02-12 | ||
================== | ||
* Update README to improve example code. | ||
* Fix error check in handleEnd method. | ||
* Remove unused dependency. | ||
* Add to namespaces and prettify. | ||
* Update iconv example to remove event-stream dependency. | ||
* Cleanup iconv example | ||
* Add gitignore | ||
* Merge branch 'kof-iconv' | ||
* Refactor iconv example to be more explicit. | ||
* Create a localhost server for example. | ||
* Refactor getParams method. | ||
* Move tips for url fetching to example script | ||
* Remove gitignore | ||
* complicated example using iconv and request | ||
v0.16.5 / 2013-12-29 | ||
@@ -3,0 +21,0 @@ ================== |
@@ -16,3 +16,2 @@ /********************************************************************** | ||
, resanitize = require('resanitize') | ||
, URL = require('url') | ||
, util = require('util') | ||
@@ -130,3 +129,3 @@ , TransformStream = require('stream').Transform | ||
// parsing a feed | ||
if (this.meta && !this.meta['#type']) { | ||
if (!(this.meta && this.meta['#type'])) { | ||
var e = new Error('Not a feed'); | ||
@@ -133,0 +132,0 @@ return this.handleError(e); |
@@ -7,29 +7,32 @@ /* | ||
module.exports = { 'http://www.w3.org/2005/Atom': 'atom' // v1.0 | ||
, 'http://purl.org/atom/ns#': 'atom' // v0.3 | ||
, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' : 'rdf' | ||
, 'http://purl.org/rss/1.0/' : 'rdf' // rss v1.0 | ||
, 'http://my.netscape.com/rdf/simple/0.9/' : 'rdf' // rss v0.90 | ||
, 'http://webns.net/mvcb/' : 'admin' | ||
, 'http://creativecommons.org/ns#' : 'cc' | ||
, 'http://web.resource.org/cc/' : 'cc' | ||
, 'http://purl.org/rss/1.0/modules/content/' : 'content' | ||
, 'http://backend.userland.com/creativeCommonsRSSModule' : 'creativecommons' | ||
, 'http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html' : 'creativecommons' | ||
, 'http://purl.org/dc/elements/1.1/': 'dc' | ||
, 'http://purl.org/dc/elements/1.0/': 'dc' | ||
, 'http://purl.oclc.org/net/rss_2.0/enc#' : 'enc' | ||
, 'http://rssnamespace.org/feedburner/ext/1.0' : 'feedburner' | ||
, 'http://www.itunes.com/dtds/podcast-1.0.dtd' : 'itunes' | ||
, 'http://www.w3.org/2003/01/geo/wgs84_pos#' : 'geo' | ||
, 'http://www.georss.org/georss' : 'georss' | ||
, 'http://search.yahoo.com/mrss/' : 'media' | ||
, 'http://search.yahoo.com/mrss' : 'media' // commonly-used but wrong | ||
, 'http://www.pheedo.com/namespace/pheedo' : 'pheedo' | ||
, 'http://purl.org/rss/1.0/modules/syndication/' : 'syn' | ||
, 'http://feedsync.org/2007/feedsync' : 'sx' // feedsync (Simple Sharing Extensions) http://feedsyncsamples.codeplex.com/ | ||
, 'http://purl.org/rss/1.0/modules/taxonomy/' : 'taxo' | ||
, 'http://purl.org/syndication/thread/1.0': 'thr' | ||
, 'http://www.w3.org/1999/xhtml' : 'xhtml' | ||
, 'http://www.w3.org/XML/1998/namespace' : 'xml' | ||
}; | ||
module.exports = { 'http://www.w3.org/2005/Atom' :'atom' // v1.0 | ||
, 'http://purl.org/atom/ns#' :'atom' // v0.3 | ||
, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' :'rdf' | ||
, 'http://purl.org/rss/1.0/' :'rdf' // rss v1.0 | ||
, 'http://my.netscape.com/rdf/simple/0.9/' :'rdf' // rss v0.90 | ||
, 'http://webns.net/mvcb/' :'admin' | ||
, 'http://creativecommons.org/ns#' :'cc' | ||
, 'http://web.resource.org/cc/' :'cc' | ||
, 'http://purl.org/rss/1.0/modules/content/' :'content' | ||
, 'http://backend.userland.com/creativeCommonsRSSModule' :'creativecommons' | ||
, 'http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html' :'creativecommons' | ||
, 'http://purl.org/dc/elements/1.1/' :'dc' | ||
, 'http://purl.org/dc/elements/1.0/' :'dc' | ||
, 'http://purl.oclc.org/net/rss_2.0/enc#' :'enc' | ||
, 'http://rssnamespace.org/feedburner/ext/1.0' :'feedburner' | ||
, 'http://www.bradsoft.com/feeddemon/xmlns/1.0/' :'fd' // FeedDemon | ||
, 'http://www.itunes.com/dtds/podcast-1.0.dtd' :'itunes' | ||
, 'http://www.w3.org/2003/01/geo/wgs84_pos#' :'geo' | ||
, 'http://www.georss.org/georss' :'georss' | ||
, 'http://search.yahoo.com/mrss/' :'media' | ||
, 'http://search.yahoo.com/mrss' :'media' // commonly-used but wrong | ||
, 'http://newsgator.com/schema/extensions' :'ng' // NewsGator | ||
, 'http://opml.org/spec2' :'opml' // OPML 2.0 | ||
, 'http://www.pheedo.com/namespace/pheedo' :'pheedo' | ||
, 'http://purl.org/rss/1.0/modules/syndication/' :'syn' | ||
, 'http://feedsync.org/2007/feedsync' :'sx' // feedsync (Simple Sharing Extensions) http://feedsyncsamples.codeplex.com/ | ||
, 'http://purl.org/rss/1.0/modules/taxonomy/' :'taxo' | ||
, 'http://purl.org/syndication/thread/1.0' :'thr' | ||
, 'http://www.w3.org/1999/xhtml' :'xhtml' | ||
, 'http://www.w3.org/XML/1998/namespace' :'xml' | ||
}; |
@@ -5,3 +5,3 @@ { | ||
"description": "Robust RSS Atom and RDF feed parsing using sax js", | ||
"version": "0.16.5", | ||
"version": "0.16.6", | ||
"keywords": [ | ||
@@ -37,3 +37,5 @@ "rss", | ||
"devDependencies": { | ||
"mocha": "1.x" | ||
"mocha": "1.x", | ||
"request": "2.27.x", | ||
"iconv": "2.0.x" | ||
}, | ||
@@ -40,0 +42,0 @@ "scripts": { |
@@ -49,3 +49,3 @@ [![Build Status](https://secure.travis-ci.org/danmactough/node-feedparser.png?branch=master)](https://travis-ci.org/danmactough/node-feedparser) | ||
The easiest way to use feedparser is to just give it a [readable stream](http://nodejs.org/api/stream.html#stream_readable_stream). | ||
The easiest way to use feedparser is to just give it a [readable stream](http://nodejs.org/api/stream.html#stream_readable_stream). | ||
It will then return a readable object stream. | ||
@@ -58,27 +58,36 @@ | ||
request('http://somefeedurl.xml') | ||
.pipe(new FeedParser([options])) | ||
.on('error', function(error) { | ||
// always handle errors | ||
}) | ||
.on('meta', function (meta) { | ||
// do something | ||
}) | ||
.on('readable', function () { | ||
// do something else, then do the next thing | ||
}) | ||
``` | ||
var req = request('http://somefeedurl.xml') | ||
, feedparser = new FeedParser([options]); | ||
Or: | ||
req.on('error', function (error) { | ||
// handle any request errors | ||
}); | ||
req.on('response', function (res) { | ||
var stream = this; | ||
```js | ||
if (res.statusCode != 200) return this.emit('error', new Error('Bad status code')); | ||
var FeedParser = require('feedparser') | ||
, request = require('request'); | ||
stream.pipe(feedparser); | ||
}); | ||
request('http://somefeedurl.xml') | ||
.pipe(new FeedParser([options])) | ||
.pipe([some other stream]) | ||
feedparser.on('error', function(error) { | ||
// always handle errors | ||
}); | ||
feedparser.on('readable', function() { | ||
// This is where the action is! | ||
var stream = this | ||
, meta = this.meta // **NOTE** the "meta" is always available in the context of the feedparser instance | ||
, item; | ||
while (item = stream.read()) { | ||
console.log(item); | ||
} | ||
}); | ||
``` | ||
I *strongly* encourage you to take a look at the [iconv example](examples/iconv.js) | ||
for a very thorough working example. | ||
### options | ||
@@ -112,3 +121,3 @@ | ||
See the `examples` directory. | ||
See the [`examples`](examples/) directory. | ||
@@ -215,3 +224,3 @@ ## API | ||
Copyright (c) 2011, 2012, 2013 Dan MacTough and contributors | ||
Copyright (c) 2011-2014 Dan MacTough and contributors | ||
@@ -218,0 +227,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
932685
51
1576
239
3
5
3