我想从网站下载一组文件。HTML 文档链接为
<a href="https://website.com/path/to/folder/jjxx.70" data-linktype="relative-path">bla</a>
Run Code Online (Sandbox Code Playgroud)
下载主文件后,路径/到/文件夹将按预期删除。剩下的一行是:
<a href="jjxx.70" data-linktype="relative-path">bla</a>
Run Code Online (Sandbox Code Playgroud)
但是,尽管我传递了镜像参数,但 wget 并没有下载引用的文件。我得到的只是:
c:\>wget-1.12 -m -p -E https://website.com/path/to/folder/jjroot
... progress information ...
2018-09-15 18:52:33 (708 KB/s) - `website.com/path/to/folder/jjroot.html' saved [25784/25784]
FINISHED --2018-09-15 18:52:33--
Downloaded: 1 files, 25K in 0.04s (708 KB/s)
Run Code Online (Sandbox Code Playgroud)
编辑:既然有人问我:wget 的版本是 1.12。我也使用 wget 1.19.4 得到相同的结果。
小智 8
命令是:
wget -r -np -l 1 -A zip http://example.com/download/
Run Code Online (Sandbox Code Playgroud)
选项含义:
-r, --recursive specify recursive download.
-np, --no-parent don't ascend to the parent directory.
-l, --level=NUMBER maximum recursion depth (inf or 0 for infinite).
-A, --accept=LIST comma-separated list of accepted extensions
Run Code Online (Sandbox Code Playgroud)
您可以使用-A参数自定义所需的扩展
参考
/sf/ask/947325221/
Run Code Online (Sandbox Code Playgroud)