macieklamberski/feedsmith: Robust and fast parser and generator for RSS, Atom, JSON Feed, and RDF feeds, with support for Podcast, iTunes, Dublin Core, and OPML files.
Robust and fast JavaScript parser and generator for RSS, Atom, JSON Feed, and RDF feeds, with support for popular namespaces and OPML files. It provides both universal and format-specific parsers that maintain the original feed structure while offering helpful normalization.
Feedsmith maintains the original feed structure in a clean, object-oriented format. It intelligently normalizes legacy elements, providing you with complete access to all feed data without compromising simplicity.
Normalizes legacy elements ✨ — Upgrades feed elements to their modern equivalents so that you never need to worry about reading feeds in older formats.
CaSe INSENsiTive — Handles fields and attributes in any case (lowercase, uppercase, mixed).
Performance and type-safety
Fast parsing — One of the fastest feed parsers in JavaScript (see benchmarks).
Type-safe API — TypeScript type definitions are available for each feed format, making it easy to work with the data.
Tree-shakable — Only include the parts of the library you need, reducing bundle size.
Well-tested — Comprehensive test suite with 1200+ tests and 99% code coverage.
Works in Node.js and all modern browsers.
Works with plain JavaScript, you don’t need to use TypeScript.
✅ Available
·
⌛️ Work in progress
·
📋 Planned
Format
Versions
Parsing
Generating
RSS
0.9x, 2.0
✅
⏳
Atom
0.3, 1.0
✅
⏳
JSON Feed
1.0, 1.1
✅
✅
RDF
0.9, 1.0
✅
⏳
Name
Prefix
Supported in
Parsing
Generating
Atom
,
RSS, RDF
✅
⏳
Dublin Core
RSS, Atom, RDF
✅
⏳
Syndication
RSS, Atom, RDF
✅
⏳
Content
RSS, RDF
✅
⏳
Slash
RSS, Atom, RDF
✅
⏳
iTunes
RSS, Atom
✅
⏳
Podcast
RSS
✅
⏳
Media RSS
RSS, Atom, RDF
✅
⏳
Geo RSS
⏳
⏳
⏳
Dublin Core Terms
📋
📋
📋
Administrative
📋
📋
📋
Atom Threading
📋
📋
📋
Format
Versions
Parsing
Generating
OPML
1.0, 2.0
✅
✅
The easiest way to parse any feed is to use the universal parseFeed function:
If you know the format in advance, you can use the format-specific parsers:
import{parseAtomFeed,parseJsonFeed,parseRssFeed,parseRdfFeed}from'feedsmith'// Parse the feed contentconstatomFeed=parseAtomFeed('atom content')constjsonFeed=parseJsonFeed('json content')constrssFeed=parseRssFeed('rss content')constrdfFeed=parseRdfFeed('rdf content')// Then read the TypeScript suggestions for the specific feed typerssFeed.titlerssFeed.dc?.creatorrssFeed.dc?.daterssFeed.sy?.updateBaserssFeed.items?.[0]?.title
Parsing OPML files is as simple:
import{parseOpml}from'feedsmith'// Parse the OPML contentconstopml=parseOpml('opml content')// Then read the TypeScript suggestionsopml.head?.titleopml.body?.outlines?.[0].textopml.body?.outlines?.[1].xmlUrl
The objects returned from the parser functions are highly comprehensive, aiming to recreate the actual feed structure and its values, including all the supported namespaces. Below are some examples of what is available.
import{parseAtomFeed}from'feedsmith'constatomFeed=parseAtomFeed(`Example Feedexample-feedJohn DoeJane Smith2022-01-01T12:00+00:00This is an example of description.2000-01-01T12:00+00:00hourly1Example Entryexample-entryJack Jackson2022-01-01T12:00+00:00`)atomFeed.title// → Example FeedatomFeed.dc?.contributor// → Jane SmithatomFeed.dc?.date// → 2022-01-01T12:00+00:00atomFeed.sy?.updateFrequency// → 1atomFeed.entries?.[0]?.title// → Example EntryatomFeed.entries?.[0]?.dc?.creator// → Jack Jackson
import{parseRssFeed}from'feedsmith'constrssFeed=parseRssFeed(` http://example.org/For documentation <em>only</em>enwebmaster@example.orgSat, 19 Mar 1988 07:15:00 GMTSat, 19 Mar 1988 07:15:00 GMTExamples2Sample Toolkithttp://feedvalidator.org/docs/rss2.html60Example bannerhttp://example.org/banner.png http://example.org/Quos placeat quod ea temporibus ratione8015Searchq http://example.org/mt/mt-search.cgi020212223MondayWednesdayFridayFirst item title http://example.org/item/1Some description of the first item.http://example.org/comments/1http://example.org/guid/1Thu, 05 Sep 2002 0:00:01 GMTExample's Realm`)rssFeed.title// → Sample FeedrssFeed.textInput?.description// → Search this site:rssFeed.items?.length// → 1rssFeed.items?.[0]?.enclosure?.url// → http://example.org/audio/demo.mp3
import{parseOpml}from'feedsmith'constopml=parseOpml(`Tech SitesMon, 15 Jan 2024 09:45:30 GMTJack Smith`)opml.head?.title// → Tech Sitesopml.body?.outlines?.[0].text// → The Vergeopml.body?.outlines?.[1].xmlUrl// → https://techcrunch.com/feed/
For more examples, check the */references folders in the source code. There, you’ll find the complete objects returned from the parser functions for the various feed formats and versions.
If the feed is unrecognized or invalid, an Error will be thrown with a descriptive message.
import{detectAtomFeed,detectJsonFeed,detectRssFeed,detectRdfFeed}from'feedsmith'if(detectAtomFeed(content)){console.log('This is an Atom feed')}if(detectJsonFeed(content)){console.log('This is a JSON feed')}if(detectRssFeed(content)){console.log('This is an RSS feed')}if(detectRdfFeed(content)){console.log('This is an RDF feed')}
Warning
Detect functions are designed to quickly identify the feed format by looking for its signature, such as the tag in the case of RSS feeds. However, the function may detect an RSS feed even if it is invalid. The feed will be fully validated only when using the parseRssFeed function.
Although JSON feeds are simply JSON objects that can be easily generated manually, the generateJsonFeed function provides helpful type hints, which can aid in feed generation. Additionally, you can use Date objects for dates, which are automatically converted to the correct format in the background.
The functionality for generating the remaining feed formats is currently under development and will be introduced gradually. For more information, see the Supported formats.
A comprehensive set of benchmarks, categorized by various file sizes, is available in the /benchmarks directory. These benchmarks were conducted using both Tinybench and Benchmark.js.
See full benchmark results →
For a quick overview, here are the results of parsing RSS, Atom, and RDF feeds using various JS packages with Tinybench. Feedsmith’s results are marked with an asterisk (*).
Why should I use Feedsmith instead of alternative packages?
The key advantage of Feedsmith is that it preserves the original feed structure exactly as provided in each specific feed format.
Many alternative packages attempt to normalize data by:
Merging distinct fields like author, dc:creator, and creator into a single property.
Combining date fields such as dc:date and pubDate without preserving their sources.
Handling multiple elements inconsistently, sometimes keeping only the first or last one or ignoring different rel attributes.
Some libraries try to combine different feed formats into one universal structure.
While this approach can be useful for quick reading of feed data, it often results in a loss of information that may be crucial for certain applications, such as reading data from specific namespaces.
Why are date fields returned as strings?
In the course of parsing hundreds of thousands of feeds, I have found that dates in feeds use many different formats. Rather than attempting to parse them all (and potentially introducing errors), dates are returned in their original string form. This approach allows you to use your preferred date parsing library or simply the Date object.
Does Feedsmith validate feeds?
Feedsmith focuses on parsing feeds rather than validating them. It will extract whatever valid data it can find, even from partially valid feeds. This approach makes it more resilient when dealing with feeds found in the wild.
It will only fail if the feed is completely invalid or it does not contain all the fields required according to the specification.
How does Feedsmith handle missing or incomplete data?
Feedsmith is designed to be forgiving. It will extract whatever valid data it can find and ignore missing or invalid elements. This makes it suitable for use with real-world feeds that may not strictly follow specifications.
Does Feedsmith work in the browser?
Even though Feedsmith is more suited for the Node.js environments, it was also tested in modern browsers where it works seamlessly. It’s provided as an ES module.
Licensed under the MIT license. Copyright 2025 Maciej Lamberski