Skip to content

a7ul/rss-parser-browser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rss-parser

Installation

NodeJS

npm install --save rss-parser

Web

bower install --save rss-parser

Usage

You can parse RSS from a URL, local file (NodeJS only), or a string.

  • parseString(xml, callback)
  • parseFile(filename, callback)
  • parseURL(url, [options,] callback)

Check out the output format in test/output/reddit.json

NodeJS

var parser = require('rss-parser'); parser.parseURL('https://www.reddit.com/.rss', function(err, parsed) { console.log(parsed.feed.title); parsed.feed.entries.forEach(function(entry) { console.log(entry.title + ':' + entry.link); }) })

Web

<script src="/bower_components/rss-parser/dist/rss-parser.min.js"></script> <script> RSSParser.parseURL('https://www.reddit.com/.rss', function(err, parsed) { console.log(parsed.feed.title); parsed.feed.entries.forEach(function(entry) { console.log(entry.title + ':' + entry.link); }) }) </script>

Redirects

By default, parseURL will follow up to one redirect. You can change this with options.maxRedirects.

parser.parseURL('https://reddit.com/.rss', {maxRedirects: 3}, function(err, parsed) { console.log(parsed.feed.title); });

Contributing

Running Tests

The tests run the RSS parser for several sample RSS feeds in test/input and outputs the resulting JSON into test/output. If there are any changes to the output files the tests will fail.

To check if your changes affect the output of any test cases, run

npm test

To update the output files with your changes, run

WRITE_GOLDEN=true npm test

Publishing Releases

grunt build git commit -a -m "browserify" npm version minor # or major/patch npm publish git push --follow-tags

About

A simple, light-weight RSS parser for browser. Parse strings, URLs and get a JS object back

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 11