【发布时间】:2018-10-25 22:48:15
【问题描述】:
我显然太健忘(w)获取所有幻灯片。
拥有一个 pdf 和 ppt 填充的网站:http://some.uni.edu/~name/slides.html 我想一次性下载所有(许多)链接文件。 到目前为止,该目录是由 wget 创建的,但它是空的。
我试过了:
wget -r -A.pdf,.ppt http://some.uni.edu/~name/slides.html
wget -e robots=off -A.pdf,.ppt -r -l1 http://some.uni.edu/~name/slides.html
wget -nd -l -r -e robots=off http://some.uni.edu/~name/slides.html
wget -r -np -R "slides.html" http://some.uni.edu/~name/slides.html
wget -r -np -R "slides.html" http://some.uni.edu/~name/
例如:
$ wget -r https://web.cs.ucla.edu/~kaoru/
--2018-10-29 21:38:50-- https://web.cs.ucla.edu/~kaoru/
Resolving web.cs.ucla.edu (web.cs.ucla.edu)... 131.179.128.29
Connecting to web.cs.ucla.edu (web.cs.ucla.edu)|131.179.128.29|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 623 [text/html]
Saving to: ‘web.cs.ucla.edu/~kaoru/index.html’
web.cs.ucla.edu/~ka 100%[===================>] 623 --.-KB/s in 0s
2018-10-29 21:38:51 (19.1 MB/s) - ‘web.cs.ucla.edu/~kaoru/index.html’ saved [623/623]
Loading robots.txt; please ignore errors.
--2018-10-29 21:38:51-- https://web.cs.ucla.edu/robots.txt
Reusing existing connection to web.cs.ucla.edu:443.
HTTP request sent, awaiting response... 200 OK
Length: 95 [text/plain]
Saving to: ‘web.cs.ucla.edu/robots.txt’
web.cs.ucla.edu/rob 100%[===================>] 95 --.-KB/s in 0s
2018-10-29 21:38:51 (3.10 MB/s) - ‘web.cs.ucla.edu/robots.txt’ saved [95/95]
--2018-10-29 21:38:51-- https://web.cs.ucla.edu/~kaoru/paper11.gif
Reusing existing connection to web.cs.ucla.edu:443.
HTTP request sent, awaiting response... 200 OK
Length: 10230 (10.0K) [image/gif]
Saving to: ‘web.cs.ucla.edu/~kaoru/paper11.gif’
web.cs.ucla.edu/~ka 100%[===================>] 9.99K --.-KB/s in 0.001s
2018-10-29 21:38:51 (12.3 MB/s) - ‘web.cs.ucla.edu/~kaoru/paper11.gif’ saved [10230/10230]
FINISHED --2018-10-29 21:38:51--
Total wall clock time: 0.9s
Downloaded: 3 files, 11K in 0.001s (12.2 MB/s)
仍然不下载文件:
$ ls
$ index.html paper11.gif
【问题讨论】:
-
你试过
--ignore-case吗?否则-A.pdf与.PDF不匹配。 -
谢谢!刚试了一下,没有成功..
-
目标 PDF 是否在同一台服务器上?尝试
-H以允许 wget 访问其他主机。显然,如果不访问相关页面,就很难回答。 -
我明白,是的,所有文件都位于“some.uni.edu/~name”,例如“some.uni.edu/~name/slides001.pdf”、“some.uni.edu/~name/slides002.ppt”等。
-
好的,那应该工作。这不太可能,但服务器可能会基于用户代理(等)被阻止。你能
wget那些直接文件 URL 之一吗?例如:wget https://some.uni.edu/~name/slides002.ppt