rbren / rss-parser

A lightweight RSS parser, for Node and the browser
MIT License
1.38k stars 209 forks source link

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

Open hushaudio opened 3 years ago

hushaudio commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

hushaudio commented 3 years ago

Forked it

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