1.1.0 • Published 8 years ago

get-feeds v1.1.0

Weekly downloads
19
License
MIT
Repository
github
Last release
8 years ago

get-feeds

Build status Coverage Status NPM version XO code style

Get RSS/Atom/ActivityStream feeds from an HTML string

Installation

Install get-feeds using npm:

npm install --save get-feeds

Usage

Module usage

const getFeeds = require('get-feeds');

const feeds = getFeeds(`
	<html>
		<head>
			<link rel="alternate" type="application/rss+xml" href="feed.xml" title="My feed">
		</head>
		<body>
			Lorem ipsum...
		</body>
	</html>
`, {
	url: 'http://the.location.of/the.html?used=for&absolute=urls'}
);
/*
[{
	type: 'application/rss+xml',
	title: 'My feed',
	href: 'http://the.location.of/feed.xml'
}]

API

getFeeds(html, options)

NameTypeDescription
htmlStringThe HTML document to look for feeds in
optionsObjectOptions

Returns: Array of feed objects.

The Feed Object

A feed object has these properties:

PropertyTypeDescription
titleStringThe feed title or <title> if feed title is missing
hrefStringThe feed url, which takes any <base> tag and options.url into account
typeStringThe feed content type, e.g: "application/atom+xml"

options.url

Type: String

Should be the full URL of the HTML document, it's used to make feed URLs absolute.

License

MIT © Joakim Carlstein