question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sometimes a HTML page is served back ; Specify user agent?

See original GitHub issue

Hi ;

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:closed
  • Created 6 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
rbrencommented, Dec 29, 2017

I would suggest setting the Accept header to tell it what content-type you want back. Probably application/rss+xml or text/xml

It probably makes sense for the parser to pass this header automatically as well.

1reaction
rbrencommented, Dec 26, 2017

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 of parseURL.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found