rss-parser icon indicating copy to clipboard operation
rss-parser copied to clipboard

xml2json attrkey option not used in utils.js getLink()

Open hushaudio opened this issue 4 years ago • 3 comments

the function getLink does not use the attrkey specified in xml2json. You need to pass these options to this function or setting attrkey will break the parser. I have created a new version of utils.js that sets module.exports to a function with the argument of (options) that can be passed in require('utils')(options)

This fixes it if you refacter the getLink function to use the attrKey options

hushaudio avatar Nov 04 '21 21:11 hushaudio

You also need to go refacter parser.js to require the utils file in the constructor so you can pass the options, and change utils to this.utils like so ->

PARSER.JS

Screen Shot 2021-11-04 at 4 31 57 PM Screen Shot 2021-11-04 at 4 32 40 PM

UTILS.JS

Screen Shot 2021-11-04 at 4 33 21 PM

hushaudio avatar Nov 04 '21 21:11 hushaudio

This is important for storing feed data into mongodb as the default attrKey is $ which is a reserved key in mongodb

hushaudio avatar Nov 04 '21 21:11 hushaudio

Forked it

https://github.com/hushaudio/rss-parser

hushaudio avatar Nov 04 '21 22:11 hushaudio