一个页面包含指向一组 .zip 文件的链接,我想下载所有这些文件。我知道这可以通过 wget 和 curl 来完成。它是如何完成的?
问问题
72862 次
3 回答
135
命令是:
wget -r -np -l 1 -A zip http://example.com/download/
选项含义:
-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.
于 2012-11-26T22:12:50.677 回答
89
上述解决方案对我不起作用。对我来说只有这个有效:
wget -r -l1 -H -t1 -nd -N -np -A.mp3 -erobots=off [url of website]
选项含义:
-r recursive
-l1 maximum recursion depth (1=use only this directory)
-H span hosts (visit other hosts in the recursion)
-t1 Number of retries
-nd Don't make new directories, put downloaded files in this one
-N turn on timestamping
-A.mp3 download only mp3s
-erobots=off execute "robots.off" as if it were a part of .wgetrc
于 2013-09-10T02:09:13.747 回答
6
对于其他具有一些并行魔法的场景,我使用:
curl [url] | grep -i [filending] | sed -n 's/.*href="\([^"]*\).*/\1/p' | parallel -N5 wget -
于 2018-01-11T20:34:49.027 回答