Multiple enclosure tags get overwritten
I need to parse an RSS to JSON which has multiple enclosure tags within an item
<item>
<title>...</title>
<enclosure url="..." type="..." />
<enclosure url="..." type="..." />
<enclosure url="..." type="..." />
</item>
My resulted JSON Object only has a single enclosure object instead of an array. I tried using keepArray option already but it still happens.
It seems it gets overwritten in parser.js https://github.com/rbren/rss-parser/blob/2ea1d8f901bc804b064798d1a45ca82d984ebbee/lib/parser.js#L214
It's hard coded taking only the first enclosure item
Did you find another solution @black-hawk85? I want to parse and display images, which are referenced with RSS enclosure.
Unfortunately I had to use another lib for that.
It works with rss-to-json-v2
I have fixed this in a fork: https://github.com/rhyst/rss-parser and PR https://github.com/rbren/rss-parser/pull/282
It adds an item.enclosures property which is an array of all enclosures. Additionally it adds a couple of obscure enclosure tags to the same list ppg:enclosureSecure and ppg:enclosureLegacy which are used at least by the BBC for some of their podcasts.
You can install now with:
npm i git+https://github.com/rhyst/rss-parser.git