Skip to content

Latest commit

 

History

History
54 lines (45 loc) · 2.03 KB

readme.md

File metadata and controls

54 lines (45 loc) · 2.03 KB

Welcome to my first node module!

feederjs

feederjs is a small, simple to use Atom and RSS parser. It uses the fast and lightweight sax-js Sax parser to parse an Atom or RSS feed into a single JavaScript Object type that mimics the structure (but not exactly) of the Atom Specification.

What this is intended to be:
  • Simple to Implement
  • Simple to Use
What this is NOT intended to be:
  • A Robust feature Rich API
  • One stop library for all Atom/RSS needs

Examples

Install with: > npm install --save feederjs To retreive a feed is very simple. Let's examine the following code.

const feeder = require('feederjs');
feeder.getFeed('http://feeds.reuters.com/news/artsculture?format=xml', (feed) => { console.log(feed.title); });

would output

"Reuters: Arts"

Sometimes, we Err. If your passed url does not specify a protocol, or if the url does not lead to a feed or rss xml object. A FeederException will be thrown. To catch this, consider:

feeder.getFeed('https://google.com', (feed) => {
  if (feed instanceof feeder.FeederException){
    console.log('error: ' + feed.message);
  } else {
    console.log(feed.title);
  }
});

Pretty simple, right? While feederjs aims to be simple, this limits it's use cases. If you are looking for a parser that is more structured around the RSS Specification you might want to try feedparser. Or if you are looking for in depth parsing of the xml structure, you may want to look at sax-js.

Documentation

Documentation can be found Here.

License

MIT

Contributions

Pull and feature requests are welcome. Please use the linting rules in the eslint file. Please open an issue or comment on an existing one to outline your intent of the the Pull Request.

ToDo

  • Add support for reading from files and streams
  • Add support for returning Promises as well as objects.