Package Exports
- get-feeds
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (get-feeds) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
get-feeds
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