Closed mayureshw closed 3 years ago
You can check: elinks --source URL > file wget or curl are better for it.
Well I made it clear. My question starts with, when wget/curl/python don't work but elinks does.
Some examples please. Likely cookies are required or correct HTTP-Referer. python-requests are best candidate IMO. If you insist on ELinks. add pre_format_html_hook in your favourite scripting language. This hook can save files. Start normal elinks session, and in script call elinks --remote with appropriate command. Not tested at all, just guess.
There is no particular reason to use elinks, other than that curl/wget/python did not work, after trying to set their identity to firefox/elinks etc while elinks works. If you can advise options of any of these, I can use those as well.
Does ELinks login on this page automatically, or you must click something?
In src/network/socket.c there is: / To enable logging of tranfers, for debugging purposes. /
^^^^^ set this to 1
2) set connection.max_connections = 1 set connection.max_connections_to_host = 1 disable compression
recompile elinks.
Run ELinks and get some logs in /tmp/log . Later see what ELinks sends and what it receives, especially in headers and write script, for example in python, which do similar things. No other ideas.
Does ELinks login on this page automatically, or you must click something?
Oh sorry, I didn't realize the cookie was lurking in my .elinks/cookies. I thought it's a public link. So, I can try and use that cookie with wget/curl/python and that should solve it.
On some URLs where wget/curl/python fail to download a binary file at the URL (presumably as the server snubs them), elinks downloads the file correctly (although interactively).
I also tried using a different browser identification strings in wget/curl/python so that the server doesn't snub those clients, including using the identity string of elinks, but it did not work.
It will be nice if elinks lets download the file non-interactively. elinks -dump -color-mode 0 does not help, as it shows ASCII text for the file. I just need to download it exactly as the download dialogue in elinks does, but wish to do it non interactively so that I can embed it in a script.