我有一个html
文件page.html:
<html>
<body>
<img src="picture.png">
</body>
</html>
但是当我wget
按如下方式运行时,它不会获取图片。为什么?在执行时,我在主目录中,而页面和相应的图片在/tmp
目录中。
wget -kF -i /tmp/page.html -B /tmp -A png
wget output
:
No URLs found in /tmp/page.html.
Converted links in 0 files in 0 seconds.
或许这有点容易,但我现在无法应对。
答案1
从man wget
If this function is used, no URLs need be present on the command
line. If there are URLs both on the command line and in an input
file, those on the command lines will be the first ones to be
retrieved. If --force-html is not specified, then file should
consist of a series of URLs, one per line.
你必须指定--force-html
这将输出错误消息/tmp/foo.html: Cannot resolve incomplete link picture.png.
,因为它不是一个完整的 URL,并且相对 URL 对于本地文件来说实际上没有意义。