在 wget 下载之间等待

use*_*925 3 shell ubuntu wget command-line-interface

我正在尝试从网站下载目录(包括 subs)。我正在使用:

wget -r -e robots=off --no-parent --reject "index.html*" http://example.com/directory1/
Run Code Online (Sandbox Code Playgroud)

问题是,服务器稍后拒绝连接,我认为短时间内连接太多。所以我想做的是在每次下载/查找之间插入一个等待时间(5 秒)。那可能吗?如果是这样,如何?

Mar*_*oij 6

您可以使用--wait. 来自wget(1)

   -w seconds
   --wait=seconds
       Wait the specified number of seconds between the retrievals.  Use
       of this option is recommended, as it lightens the server load by
       making the requests less frequent.  Instead of in seconds, the time
       can be specified in minutes using the "m" suffix, in hours using
       "h" suffix, or in days using "d" suffix.

       Specifying a large value for this option is useful if the network
       or the destination host is down, so that Wget can wait long enough
       to reasonably expect the network error to be fixed before the
       retry.  The waiting interval specified by this function is
       influenced by "--random-wait", which see.
Run Code Online (Sandbox Code Playgroud)

我也不知道这一点,但我使用wget联机帮助页在 15 秒内找到了这个答案:

  • 键入man wget
  • 你可以/用来搜索,所以我用了/wait.
  • 这是第一击!
  • q退出。