Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parseUrl different behaviour on Firefox vs Chrome #111

Closed
vibonacci opened this issue May 22, 2019 · 1 comment
Closed

parseUrl different behaviour on Firefox vs Chrome #111

vibonacci opened this issue May 22, 2019 · 1 comment

Comments

@vibonacci
Copy link

vibonacci commented May 22, 2019

Using parseUrl, under Firefox I get successfully a proper JS feed object.
Using the same code and same external URL on Chrome I get the following error:

sax.js?a9cf:651 Uncaught (in promise) Error: Unexpected close tag
Line: 9
Column: 7
Char: >
at error (sax.js?a9cf:651)
at strictFail (sax.js?a9cf:677)
at closeTag (sax.js?a9cf:871)
at SAXParser.write (sax.js?a9cf:1436)
at Parser.exports.Parser.Parser.parseString (parser.js?28dc:322)
at Parser.eval [as parseString] (parser.js?28dc:5)
at eval (parser.js?a485:32)
at new Promise ()
at Parser.parseString (parser.js?a485:31)
at exports.IncomingMessage.eval

The rss feed used is : https://cors-anywhere.herokuapp.com/http://feeds.foxnews.com/foxnews/most-popular

Further used: node 10, rss-parser 3.7.0

The used code is nothing far from the provided example in the docs:

BreakingNewsService.prototype.fetchRSS = function (feedUrl) { return new Promise((resolve, reject) => { console.log(feedUrl) parser.parseURL(feedUrl) .then((feed) => { console.info('NewsfeedObject', feed) resolve(feed) }) .catch((err) => { reject(err) }) }) }

Any idea what may be causing this?

@vibonacci
Copy link
Author

vibonacci commented May 22, 2019

Well, turns out the issue is unrelated to this plugin, but some might be interested in the solution: for Chrome you need to append '?format=xml' at the end of the URL. Some RSS sources have both a HTML version, for having a styled view in a browser, and a XML version. Chrome won't interpret the URL as XML without appending '?format=xml'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant