Skip to content
Discussion options

You must be logged in to vote

One thing worth knowing before writing any C: Node's fetch doesn't run JavaScript either. It downloads the raw HTML, same as lynx. So if your Node script gets the page and lynx doesn't, the site isn't actually demanding JS. It's rejecting something about lynx's request, and the usual suspect is the User-Agent (plenty of sites block unknown or text-mode browsers), with TLS or HTTP/2 handling after that.

So try the cheap fix first:

lynx -useragent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0 Safari/537.36" https://the-site

If that works, you can set it permanently in lynx.cfg (USERAGENT:).

If you still want a C fetcher, libcurl is the standard way and…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ArthurPeabody
Comment options

Answer selected by ArthurPeabody
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants