← All packages

@lacspace/feed-reader

v1.0.0Newsroom Kit1 @lacspace dep

Read the feeds you follow — the read-side complement to @lacspace/rss. Parse a fetched RSS 2.0, RSS 1.0 (RDF), Atom 1.0 or JSON Feed 1.1 body into one normalized shape, autodiscover the feeds a web page advertises, and score each source's health (staleness vs its own cadence, duplicate/poisoned items, volume spikes, missing fields, fetch error rate) so a large source list prunes itself. Robots.txt respect via @lacspace/robots. Deterministic, isomorphic, zero third-party deps, bring-your-own-fetch.

npm i @lacspace/feed-reader

Usage

feed-reader.ts
import { discoverFeeds, readFeed, feedFetchAllowed } from "@lacspace/feed-reader";

const feeds = discoverFeeds(html, "https://example.com/");
if (feedFetchAllowed(feeds[0].href, robotsTxt, "MyBot")) {
  const body = await fetch(feeds[0].href).then(r => r.text());
  const { feed, health } = readFeed(body);
  // health → { score, status, ageHours, postsPerDay, duplicateRatio, spike, reasons }
}

Exports 9

parseFeeddiscoverFeedscommonFeedPathsscoreFeedHealthreadFeedfeedFetchAllowedparseRobotsisAllowedtoISO

Keywords

rssatomjson-feedfeed-parserfeed-readerautodiscoveryfeed-healthnewsroom

More in Newsroom Kit