@webalytics/rss
TypeScript icon, indicating that this package has built-in type declarations

0.3.1 • Public • Published

@webalytics/rss

TypeScript Build Status styled with prettier License: LGPL v3

Given some RSS or Atom feed xml, extract common metadata fields and items. Part of the Webalytics Toolbox.

Installation

npm install --save @webalytics/rss

Extracted Properties (if possible)

interface Feed {
  title: string
  description: string
  url: string
  items: Item[]
}

interface Item {
  title: string
  description: string
  url: string
  image: string
  pubDate: string
  keywords: string[]
}

Usage (convenience)

This package works out-of-the-box with any Rss/Atom feed without further configuration:

import rss from '@webalytics/rss'

const xml = '<rss><title>abc</title></rss>'
const data = rss(html) // { title: 'abc' }

Usage (convenience, with url aid)

When given an additional hint with the base url of the feed document, relative urls can be resolved correctly:

import rss from '@webalytics/rss'

const url = 'http://example.com'
const xml = '<rss><image><url>/img</url></image></rss>'
const data = rss(xml, url) // { image: 'http://example.com/img' }

License

LGPL v3. You can use this code any way you want without restrictions, but I want bugfixes and improvements to flow back to this repository to benefit everyone.

Dependencies (1)

Dev Dependencies (2)

Package Sidebar

Install

npm i @webalytics/rss

Weekly Downloads

0

Version

0.3.1

License

LGPL-3.0

Unpacked Size

39.4 kB

Total Files

35

Last publish

Collaborators

  • anonyfox