A TypeScript library for discovering RSS and Atom feeds from website URLs through HTML parsing and intelligent path detection, compatible with both Node.js and browsers.
This is a TypeScript port of the original Go implementation, mostly ported by AI.
- URL-based Feed Discovery: Automatically discovers RSS and Atom feeds from any website URL
- Intelligent HTML Parsing: Searches for feed links in
<link>and<a>tags within web pages - Smart Path Detection: Checks common feed file locations and well-known paths
- Universal: Works in both Node.js (≥22) and browser environments
- Fast: Concurrent processing for optimal performance
- Type Safe: Full TypeScript support with comprehensive type definitions
- Third-party Services: Additional support for GitHub, Reddit, and YouTube feeds
npm install feedfinder-tsimport { find } from "feedfinder-ts";
// Discover feeds from a blog or news website
const feeds = await find("https://example.com/blog");
console.log(feeds);
// Output:
// [
// { title: "Latest Posts", link: "https://example.com/feed.xml" },
// { title: "RSS Feed", link: "https://example.com/rss.xml" },
// { title: "Blog Updates", link: "https://example.com/atom.xml" }
// ]
// Works with any website that has RSS/Atom feeds
const newsFeeds = await find("https://news.ycombinator.com");import { find } from "feedfinder-ts";
const feeds = await find("https://example.com/blog", {
timeout: 30000,
userAgent: "My App/1.0.0",
headers: {
"Accept-Language": "en-US,en;q=0.9",
},
});import { FeedFinder } from "feedfinder-ts";
const finder = new FeedFinder("https://example.com/blog", {
timeout: 60000,
});
const feeds = await finder.find();
console.log(feeds);The library discovers feeds from URLs using multiple intelligent strategies:
The core feed discovery method that analyzes web page content:
- Link tag analysis: Searches for
<link>tags with feed types:application/rss+xmlapplication/atom+xmlapplication/jsonapplication/feed+json
- Anchor tag discovery: Finds
<a>tags containing "RSS", "Feed", or "Atom" text - Content-based detection: Intelligently parses HTML to locate feed references
Systematically checks common feed file locations:
- Standard feed files:
atom.xml,feed.xml,rss.xml,index.xml - JSON feeds:
atom.json,feed.json,rss.json,index.json - Common directories:
feed/,rss/
Searches both under the target URL path and the root domain for comprehensive coverage.
Enhanced support for popular platforms:
- GitHub: Repository feeds (commits, releases, tags, wiki), user feeds
- Reddit: Subreddit feeds (hot, new, top, rising), user feeds, comment feeds
- YouTube: Channel and playlist feeds (extracted from page content)
Main entry point to find feeds for a given URL.
Parameters:
target: The URL to search for feedsoptions: Optional configuration object
Returns: Promise that resolves to an array of Feed objects
interface FeedFinderOptions {
requestProxy?: string; // HTTP proxy URL
timeout?: number; // Request timeout in milliseconds (default: 60000)
userAgent?: string; // Custom User-Agent header
headers?: Record<string, string>; // Additional HTTP headers
}interface Feed {
title: string; // Feed title
link: string; // Feed URL
}The library works in modern browsers that support:
- ES2020 features
- Fetch API
- AbortController
For older browsers, you may need polyfills.
Requires Node.js ≥22.0.0.
# Install dependencies
pnpm install
# Run tests
pnpm test
# Run tests with coverage
pnpm run test:coverage
# Build the library
pnpm run build
# Run linting
pnpm run lint
# Type checking
pnpm run typecheck- Original Go implementation: 0x2E/feedfinder
- XML parsing: fast-xml-parser
- HTML parsing: cheerio
MIT