Skip to content

macieklamberski/feedscout

Repository files navigation

Feedscout

codecov npm version license

Advanced feed autodiscovery for JavaScript. Collect feed information from any webpage using multiple discovery methods.

Finds feeds by scanning links and anchors in HTML content, parsing HTTP headers, and guessing common paths, then validates each URL by fetching and parsing the feed.

Read full docs ↗   ·   Quick Start


Features

Supported Content

Type Description
Feeds RSS, Atom, JSON Feed, and RDF. Each feed is validated and returns metadata like format, title, description, and site URL.
Blogrolls OPML files containing feed subscriptions. Validated and returns title.
WebSub hubs Find hubs for real-time feed update notifications.

Discovery Methods

Method Description
Platform Generates feed URLs for YouTube, GitHub, WordPress, and 30+ other popular platforms using URL pattern matching.
HTML Scans <link> elements with feed MIME types and <a> elements matching feed patterns or labels like "RSS", "Subscribe".
Headers Parses HTTP Link headers for rel="alternate" with feed MIME types per RFC 8288.
Guess Tests common paths (e.g. /feed, /rss.xml, /atom.xml) against the base URL as a fallback.

Customization

Uses native fetch by default but supports custom adapters for Axios, Got, Ky, or any other HTTP client. Discovery methods can be individually enabled or disabled and their options adjusted. Custom extractors let you override the default parser to pull additional metadata from feeds and blogrolls.

Quick Start

For a full overview of all the features, visit the documentation.

Installation

npm install feedscout

Discover Feeds

import { discoverFeeds } from 'feedscout'

const feeds = await discoverFeeds('https://example.com')

// [{
//   url: 'https://example.com/feed.xml',
//   isValid: true,
//   format: 'rss',
//   title: 'Example Blog',
//   description: 'A blog about examples',
//   siteUrl: 'https://example.com',
// }]
const feeds = await discoverFeeds('https://example.com', {
  methods: ['html', 'headers'],
})

Or with existing HTML content:

<html>
  <head>
    <link rel="alternate" type="application/rss+xml" href="/feed.xml" />
  </head>
  <body>
    <a href="/rss">RSS Feed</a>
  </body>
</html>
const feeds = await discoverFeeds(
  { url: 'https://example.com', content: html },
  { methods: ['html'] },
)

// [
//   {
//     url: 'https://example.com/feed.xml',
//     isValid: true,
//     format: 'rss',
//     title: 'Example Blog',
//     description: 'A blog about examples',
//     siteUrl: 'https://example.com',
//   },
//   {
//     url: 'https://example.com/rss',
//     isValid: true,
//     format: 'rss',
//     title: 'Example Blog',
//     description: 'A blog about examples',
//     siteUrl: 'https://example.com',
//   },
// ]

Or with HTTP headers:

Link: </feed.xml>; rel="alternate"; type="application/rss+xml"
const feeds = await discoverFeeds(
  { url: 'https://example.com', headers },
  { methods: ['headers'] },
)

// [{
//   url: 'https://example.com/feed.xml',
//   isValid: true,
//   format: 'rss',
//   title: 'Example Blog',
//   description: 'A blog about examples',
//   siteUrl: 'https://example.com',
// }]

Discover Blogrolls

import { discoverBlogrolls } from 'feedscout'

const blogrolls = await discoverBlogrolls('https://example.com')

// [{
//   url: 'https://example.com/blogroll.opml',
//   isValid: true,
//   title: 'My Blogroll',
// }]

Discover WebSub Hubs

import { discoverHubs } from 'feedscout'

const hubs = await discoverHubs('https://example.com/feed.xml')

// [{
//   hub: 'https://pubsubhubbub.appspot.com',
//   topic: 'https://example.com/feed.xml',
// }]

About

Advanced feed autodiscovery for JavaScript. Collect feeds, hubs, and blogrolls from any webpage using multiple discovery methods.

Topics

Resources

License

Stars

Watchers

Forks

Contributors