Socket
Socket
Sign inDemoInstall

rss-to-json-feed

Package Overview
Dependencies
6
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    rss-to-json-feed

Convert RSS and ATOM feeds to the JSON Feed format


Version published
Weekly downloads
2
increased by100%
Maintainers
1
Install size
5.12 MB
Created
Weekly downloads
 

Readme

Source

rss-to-json-feed

The of this project is to convert RSS or ATOM feeds to the json-feed format.

Installation

npm install --save rss-parser

Usage

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

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

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);
  })
})

Output

Check out output examples in test/output/reddit.json

Options

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

Contributions welcome!

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

Fork of rss-parser

This project was originally forked from bobby-brennan/rss-parser. It's mostly his work, I've just changed the output to match the JSON-Feed spec.

Keywords

FAQs

Last updated on 14 Sep 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc