Sometimes a HTML page is served back ; Specify user agent?
See original GitHub issueHi ;
This library is wonderful, and works like a charm. But sometimes, the data returned by the server is a HTML page, when the same feed is actually viewable in a browser, for example this one:
http://www.jesusandmo.net/comic/feed/
Or this one :
https://www.blendernation.com/feed/
So I was wondering if there was some way to control the user agent to test if I can get the feed anyway… Maybe on the request
side?
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Browser detection using the user agent - HTTP - MDN Web Docs
Browser detection using the user agent ... Serving different Web pages or services to different browsers is usually a bad idea. The Web...
Read more >Is it possible to serve AMP pages by user agent alone?
AMP user agents are just regular web browsers, so there really isn't a way to disambiguate them from all other web traffic.
Read more >User Agent parsing: how it works and how it can be used
Deeper information can be returned when the User-Agent string is mapped to an additional set of data about the underlying device.
Read more >Googlebot Updating User Agent String: What Does This Mean ...
Web servers can use user agent information to change how they serve the page. For example, a web server could be configured to...
Read more >How to Change Your Browser's User Agent and Trick Websites
A user agent is a string (line of text) that your browser sends to websites when you access them. It basically serves to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I would suggest setting the
Accept
header to tell it what content-type you want back. Probablyapplication/rss+xml
ortext/xml
It probably makes sense for the parser to pass this header automatically as well.
Currently there’s no way to add headers to the HTTP request, but if you want to send a PR, I’d be happy to take a look. We set the user agent to ‘rss-parser’ right now.
Otherwise, I’d recommend doing the HTTP request yourself, and just using
parseString
instead ofparseURL
.