Parse OPML lists of podcasts
npm install node-opml-parserParses an OPML feed into flat list of items.
Each item in the OPML feed is added to an array
``json`
[
{
"title": "
"url": "
"feedUrl": "
"feedType": "
}
]
``
npm install --save node-opml-parser
`js
const parseOpml = require('node-opml-parser');
parsePodcast('
if (err) {
console.error(err);
return;
}
// items is a flat array of all items in opml
console.log(items);
});
`
``
npm run test
```
npm run cover
In case duplicates are found they are removed. The matching is done based on feed url so anything else can differ.
OPML can contain a directory structure but it is ignored here; a flat structure is always returned back.
In case multiple inconsistent titles are found only one is picked.
Precedence:
1. title
2. text
3. description
The parser just tries to find items quite aggressively so it doesn't care too much about structure.
This means an incorrectly formatted OPML feed might still contain items, make sure the input is not too broken.
This should not be used to validate OPML feeds!
OPML doesn't distinguish between feeds for blogs or podcasts so there's not really a way to know without downloading the feed url and looking for enclosures.
This module doesn't make any effort trying to separate what's what.