0

Normally I use wget to get files that trigger a download.

However, I'm currently using a site that takes a few seconds to generate the download, so wget downloads the html instead of the zip file I want it to.

What tool can I use to get the triggered download?

  • Ask for it, wait x seconds, ask again, and throw away the HTML file. – K7AAY Jun 17 at 20:24
0

It doesn't look promising. The following was as close to an option along the lines your looking for that I could find. curl didn't offer anything better.

I'm pretty sure that timeout (countdown) was designed to thwart exactly this type of activity.

-T seconds, --timeout=seconds

Set the network timeout to seconds seconds. This is equivalent to specifying --dns-timeout, --connect-timeout, and --read-timeout, all at the same time.

When interacting with the network, Wget can check for timeout and abort the operation if it takes too long. This prevents anomalies like hanging reads and infinite connects. The only timeout enabled by default is a 900-second read timeout. Setting a timeout to 0 disables it altogether. Unless you know what you are doing, it is best not to change the default timeout settings.

All timeout-related options accept decimal values, as well as subsecond values. For example, 0.1 seconds is a legal (though unwise) choice of timeout. Subsecond timeouts are useful for checking server response times or for testing network latency.

--dns-timeout=seconds

Set the DNS lookup timeout to seconds seconds. DNS lookups that don't complete within the specified time will fail. By default, there is no timeout on DNS lookups, other than that implemented by system libraries.

--connect-timeout=seconds

Set the connect timeout to seconds seconds. TCP connections that take longer to establish will be aborted. By default, there is no connect timeout, other than that implemented by system libraries.

--read-timeout=seconds

Set the read (and write) timeout to seconds seconds. The "time" of this timeout refers to idle time: if, at any point in the download, no data is received for more than the specified number of seconds, reading fails and the download is restarted. This option does not directly affect the duration of the entire download.

Of course, the remote server may choose to terminate the connection sooner than this option requires. The default read timeout is 900 seconds.

Altho you might be able to script up something like this:

#!/bin/sh -

# an attempt to pause long enough for countdown before opening an accept port

wget https://some/long/url/download-file

sleep 9

exit

HTH

  • Thanks for the tips! The site is from this answer, so I don't think it was intended to be hard to use. This comment lead me to ask the question. – Pro Q Jun 17 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.