0.5.5 • Published 3 months ago

@rowanmanning/feed-parser v0.5.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

@rowanmanning/feed-parser

A well-tested and resilient Node.js parser for RSS and Atom feeds.

:warning: This project is not ready for production use yet, and is missing a lot of features :warning:

Table of Contents

Introduction

This is a Node.js-based feed parser for RSS and Atom feeds. The project has the following aims:

  • Run automated tests against real-world feeds. It's currently tested against ~40 feeds via Sample Feeds. This ensures that we support real feeds rather than just the specifications.

  • Related to the point above, be as lenient as possible with feed parsing.

  • Keep up to date with the latest Node.js versions, including dropping support for end-of-life versions.

  • Maintain compatibility with the great parts of node-feedparser, e.g. resolving relative URLs.

Requirements

This library requires the following to run:

Usage

Install with npm:

npm install @rowanmanning/feed-parser

Load the library into your code with a require call:

const parseFeed = require('@rowanmanning/feed-parser');

You can use the parseFeed function to parse an RSS or Atom feed as a string. The return value is an object representation of the feed:

const feed = parseFeed('<channel> etc. </channel>');
console.log(feed.title);

This will try to parse even invalid feeds, but if no data can be pulled out an error will be thrown with a code property set to INVALID_FEED.

Parsed feed

The feed object returned by parseFeed has the following properties.

Feed

Represents an RSS or Atom feed.

FeedAuthor

Represents the author of a Feed or FeedItem.

FeedCategory

Represents the content category of a Feed or FeedItem.

FeedGenerator

Represents software that generated a Feed.

FeedImage

Represents an image for a Feed.

FeedItem

Represents an RSS item or Atom entry in a Feed.

FeedItemMedia

Represents a piece of media attached to a FeedItem.

FeedMeta

Represents meta information about a Feed.

Supported feed formats

Standards

Feeds that adhere to the following standards are supported and most properties will be parsed:

The following XML namespaces are also parsed, and more data will be parsed out for RSS feeds that implement these:

Leniency

Feeds in the real world rarely comply strictly with the standards and can sometimes be invalid XML. We try to be as lenient as possible, only throwing errors if no data can be pulled out of the feed. We test against a suite of real-world feeds.

Contributing

The contributing guide is available here. All contributors must follow this library's code of conduct.

License

Licensed under the MIT license. Copyright © 2022, Rowan Manning

Credit

This library takes inspiration from the following:

0.5.5

3 months ago

0.5.4

4 months ago

0.5.3

4 months ago

0.5.2

4 months ago

0.4.10

10 months ago

0.4.13

8 months ago

0.4.11

10 months ago

0.4.12

10 months ago

0.5.0

8 months ago

0.5.1

6 months ago

0.4.9

11 months ago

0.4.8

1 year ago

0.4.5

1 year ago

0.4.4

1 year ago

0.4.7

1 year ago

0.4.6

1 year ago

0.1.12

1 year ago

0.1.13

1 year ago

0.1.14

1 year ago

0.1.15

1 year ago

0.3.0

1 year ago

0.2.0

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.4.3

1 year ago

0.4.2

1 year ago

0.1.10

1 year ago

0.1.11

1 year ago

0.1.8

1 year ago

0.1.9

1 year ago

0.1.7

1 year ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago