feed vs rss-parser vs rss vs feedparser
Choosing feed consumption or multi-format publishing
feedrss-parserrssfeedparser

Choosing feed consumption or multi-format publishing

Choose whether the application consumes existing feed XML or publishes its own content, then select streaming/object parsing or the required output formats.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
feed2,388,9221,41427.3 kB354 months agoMIT
rss-parser1,236,4681,5301.87 MB844 years agoMIT
rss223,9931,042-4810 years agoMIT
feedparser28,5061,97184.1 kB117 days agoMIT

Start with the data direction

Publishing a feed serializes the application’s content. Consuming a feed turns another document into application data. An import-and-republish workflow may use both layers, but a parser cannot be replaced by a generator merely because both mention RSS.

Publish application content

feed exposes a Feed class, addItem and output methods rss2, atom1 and json1. It fits a publisher that wants multiple syndication formats from its chosen metadata and item model. The current package requires Node 20 or later. Validate that the supplied IDs, links, dates, content and per-format fields express the intended published content.

rss builds an RSS feed and items and serializes the document. Its custom namespace and Atom link support do not turn its RSS root into a native Atom feed. Choose it when its RSS-specific builder is sufficient, or choose a multi-format generator when those other outputs are actually required.

The two generators have different metadata and item contracts. Changing the output function alone does not translate every field or host the resulting document at a public endpoint.

Consume existing feeds

feedparser is a Node object-stream route for RSS, Atom and RDF. The application supplies input bytes, handles the source request if one is needed and consumes parsed items/metadata. It is not an HTTP fetch operation simply because a documentation example pipes a response into it.

rss-parser provides parseURL and parseString with callback or Promise styles and returns a feed containing items. Its actual parser recognizes supported Atom and RSS forms. Choose that completed-object contract when it fits better than incremental item handling.

Selection

Choose consume versus publish first, then the required feed format and result contract. Preserve stable item identity, dates and links when transforming data, and deliberately map custom fields between tools. Stream completion, all downstream processing and publication of a generated document are separate workflow milestones.

How to Choose: feed vs rss-parser vs rss vs feedparser

  • feed:

    Choose it to publish application metadata and items through RSS, Atom and JSON Feed output methods.

  • rss-parser:

    Choose it for a Parser with URL/string helpers and a collected feed/items object through Promises or callbacks.

  • rss:

    Choose it for an RSS generator with its own feed/item builder and XML output, not for native Atom generation.

  • feedparser:

    Choose it for a Node stream that parses RSS, Atom and RDF into normalized metadata and items from supplied XML bytes.

README for feed

Feed for Node.js
npm version License: MIT

jpmonette/feed - RSS 2.0, JSON Feed 1.0, and Atom 1.0 generator for Node.js
Making content syndication simple and intuitive!


👩🏻‍💻 Developer Ready: Quickly generate syndication feeds for your Website.

💪🏼 Strongly Typed: Developed using TypeScript / type-safe.

🔒 Tested: Tests & snapshot for each syndication format to avoid regressions.

Getting Started

Installation

$ pnpm add feed

Example

import { Feed } from "feed";

const feed = new Feed({
  title: "Feed Title",
  description: "This is my personal feed!",
  id: "http://example.com/",
  link: "http://example.com/",
  language: "en", // optional, used only in RSS 2.0, possible values: http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
  image: "http://example.com/image.png",
  favicon: "http://example.com/favicon.ico",
  copyright: "All rights reserved 2013, John Doe",
  updated: new Date(2013, 6, 14), // optional, default = today
  generator: "awesome", // optional, default = 'https://github.com/jpmonette/feed'
  feedLinks: {
    json: "https://example.com/json",
    atom: "https://example.com/atom",
  },
  author: {
    name: "John Doe",
    email: "[email protected]",
    link: "https://example.com/johndoe",
  },
});

posts.forEach((post) => {
  feed.addItem({
    title: post.title,
    id: post.url,
    link: post.url,
    description: post.description,
    content: post.content,
    author: [
      {
        name: "Jane Doe",
        email: "[email protected]",
        link: "https://example.com/janedoe",
      },
      {
        name: "Joe Smith",
        email: "[email protected]",
        link: "https://example.com/joesmith",
      },
    ],
    contributor: [
      {
        name: "Shawn Kemp",
        email: "[email protected]",
        link: "https://example.com/shawnkemp",
      },
      {
        name: "Reggie Miller",
        email: "[email protected]",
        link: "https://example.com/reggiemiller",
      },
    ],
    date: post.date,
    image: post.image,
  });
});

feed.addCategory("Technologie");

feed.addContributor({
  name: "Johan Cruyff",
  email: "[email protected]",
  link: "https://example.com/johancruyff",
});

console.log(feed.rss2());
// Output: RSS 2.0

console.log(feed.atom1());
// Output: Atom 1.0

console.log(feed.json1());
// Output: JSON Feed 1.0

Options

Feed Options

PropertyTypeDescription
titlestringRequired. Feed title
idstringFeed identifier (required for Atom)
linkstringURL to the feed's website
descriptionstringFeed description/subtitle
copyrightstringCopyright notice
languagestringLanguage code (e.g., "en", "fr-CA")
updatedDateLast update date (default: now)
generatorstringGenerator name (default: "https://github.com/jpmonette/feed")
imagestringURL to feed image/logo
faviconstringURL to feed favicon
authorAuthorFeed author
feedLinksobjectLinks to feed formats ({ rss, atom, json })
feedstringSelf-referencing feed URL
hubstringWebSub/PubSubHubbub hub URL
ttlnumberTime to live in minutes (RSS)
docsstringRSS specification docs URL
stylesheetstringURL to XSL stylesheet
podcastbooleanEnable iTunes/Google podcast extensions
categorystringPodcast category name

Item Options

PropertyTypeDescription
titlestringRequired. Item title
linkstringRequired. URL to the item
dateDateRequired. Last modified/updated date
idstringUnique identifier (Atom/JSON)
guidstringRSS-specific GUID
descriptionstringBrief summary or excerpt
contentstringFull content (HTML allowed)
authorAuthor[]Item authors
contributorAuthor[]Item contributors
categoryCategory[]Item categories
publishedDateOriginal publication date
copyrightstringItem copyright notice
imagestring | EnclosureImage attachment
audiostring | EnclosureAudio attachment
videostring | EnclosureVideo attachment
enclosureEnclosureGeneric media enclosure
extensionsExtension[]Custom extensions

Types

interface Author {
  name?: string;
  email?: string;
  link?: string;
  avatar?: string; // JSON Feed only
}

interface Enclosure {
  url: string;
  type?: string; // MIME type (e.g., "audio/mpeg")
  length?: number; // File size in bytes
  title?: string;
  duration?: number; // Duration in seconds (for podcasts)
}

interface Category {
  name?: string;
  domain?: string; // RSS
  scheme?: string; // Atom
  term?: string; // Atom
}

interface Extension {
  name: string;
  objects: Record<string, unknown>;
}

Migrating from < 3.0.0

If you are migrating from a version older than 3.0.0, be sure to update your import as we migrated to ES6 named imports.

If your environment supports the ES6 module syntax, you can import as described above:

import { Feed } from "feed";

Otherwise, you can stick with require():

- const Feed = require('feed');
+ const Feed = require('feed').Feed;

Star History

Star History Chart

More Information

License

Copyright (C) 2013, Jean-Philippe Monette [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.