RSS/Atom/JSON feed parser
var FeedMe = require'feed'parser =fs = require'fs'parseron'title'console.log'title of feed is' title;;parseron'item'console.logitem;;// sax-js and clarinet allow streaming// which means faster parsing for larger feeds!fscreateReadStream'rssfeed.xml'pipeparser;
Creates a new instance of the FeedMe parser.
buffer can be
true if you want the parser to buffer the entire feed document as a JSON object, letting you use the
Write to the parser.
Can only be used if
type: 'rss 2.0'title: 'Liftoff News'link: ''description: 'Liftoff to Space Exploration.'language: 'en-us'pubdate: 'Tue, 10 Jun 2003 04:00:00 GMT'lastbuilddate: 'Tue, 10 Jun 2003 09:41:01 GMT'docs: ''generator: 'Weblog Editor 2.0'managingeditor: 'firstname.lastname@example.org'webmaster: 'email@example.com'items:title: 'Star City'link: ''description: 'How do Americans get ready to work with Russians aboard the International Space Station? They take a crash course in culture, language and protocol at Russia\'s <a href="">Star City</a>.'pubdate: 'Tue, 03 Jun 2003 09:39:21 GMT'guid: ''description: 'Sky watchers in Europe, Asia, and parts of Alaska and Canada will experience a <a href="">partial eclipse of the Sun</a> on Saturday, May 31st.'pubdate: 'Fri, 30 May 2003 11:06:42 GMT'guid: ''title: 'The Engine That Does More'link: ''description: 'Before man travels to Mars, NASA hopes to design new engines that will let us fly through the Solar System more quickly. The proposed VASIMR engine would do that.'pubdate: 'Tue, 27 May 2003 08:37:32 GMT'guid: ''title: 'Astronauts\' Dirty Laundry'link: ''description: 'Compared to earlier spacecraft, the International Space Station has many luxuries, but laundry facilities are not one of them. Instead, astronauts have other options.'pubdate: 'Tue, 20 May 2003 08:56:02 GMT'guid: ''
Object- Item from the feed.
Emitted whenever the parser finds a new feed item. An item can be inside an
<item> or ` tag.
Object- The object containing the value of the tag found.
Emitted whenever a tag on the root of the document is finished parsing. The root being the
<feed> tag. Example:
parseron'description'// do something;
string- Type of feed. Example: atom, rss 2.0, json.
Emitted when there is an error parsing the document.
npm install feedme
Tests are written with mocha