Skip to content

joakimbeng/get-feeds

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

Name Type Description
html String The HTML document to look for feeds in
options Object Options

Returns: Array of feed objects.

The Feed Object

A feed object has these properties:

Property Type Description
title String The feed title or <title> if feed title is missing
href String The feed url, which takes any <base> tag and options.url into account
type String The 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

About

Get RSS/Atom/ActivityStream feeds from an HTML string

Resources

Stars

Watchers

Forks

Packages

No packages published