【问题标题】:wget downloads index.html unnecessarily and halts batch script (Windows)wget 不必要地下载 index.html 并停止批处理脚本 (Windows)
【发布时间】:2015-09-22 16:14:10
【问题描述】:

我在Windows 上遇到wget64 问题:

@echo OFF
FOR /L %%i in (1, 1, 9999) DO (
cls
echo Downloading file %%i
wget64.exe -e robots=off --progress=bar --show-progress -r -np -nd -nc -HDfilepi.com --content-disposition -a wget.log ebooks.info/book/%%i/
)

wget 会下载index.html(我觉得没必要),然后它会继续到托管文件并在目标上不存在该文件时下载它,但无法检索到index.html下一本书并开始下一次下载。

真的有必要下载index.html吗?如果是这样,我如何告诉wget每次都删除并下载新的?

免责声明:我只是询问wget的具体行为,我 我不要求帮助下载脚本,也不宽恕 非法下载文件。

【问题讨论】:

  • 是的,ebooks.info/book/%%i/ 是重定向到文件所在的另一个主机(filepi.com)的主机。
  • 网址ebooks.info/book/%%i 不存在。大多数重定向方法将在其响应中包含主体,这就是 wget 获取 index.html 文件的(可能)原因。需要一个有效的 URL 才能进一步查看。
  • ebooks.info/book/%%i 只是一个占位符,而不是实际页面,因为该页面在 stackoverflow 中被列入黑名单。真正的页面是IT eBooks
  • 以后,您应该在问题中指明使用占位符。让试图帮助的人猜测它只会浪费你的时间。
  • 没想到,会的。

标签: windows batch-file cmd wget


【解决方案1】:

我想你可能想多了。假设 wget 正在检索的所有其他文件都是正确的,因为无论如何您都在使用 FOR 循环,为什么不像这样在每次迭代中删除 index.html:

@echo OFF
FOR /L %%i in (1, 1, 9999) DO (
cls
echo Downloading file %%i
wget64.exe -e robots=off --progress=bar --show-progress -r -np -nd -nc -HDfilepi.com --content-disposition -a wget.log ebooks.info/book/%%i/
if exist index.html del index.html
)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-23
    • 2011-11-16
    • 1970-01-01
    相关资源
    最近更新 更多