use*_*485 15 command-line wget
我想抓取 www.website.com/XYZ 下的链接,只下载 www.website.com/ABC 下的链接。
我正在使用以下 wget 命令来获取我想要的文件:
wget -I ABC -r -e robots=off --wait 0.25 http://www.website.com/XYZ
Run Code Online (Sandbox Code Playgroud)
当我使用 wget 1.13.4 时,这非常有效。但问题是我必须在具有 wget 1.11 的服务器上使用此命令,当我使用相同的命令时,它最终会下载其他域,例如:
www.website.de
www.website.it
...
Run Code Online (Sandbox Code Playgroud)
我怎样才能避免这个问题?我尝试使用
--exclude domains=www.website.de,www.website.it
Run Code Online (Sandbox Code Playgroud)
但是它一直在下载这些域。
另请注意,我无法使用,--no-parent
因为我想要的文件在上层(我希望通过抓取 website.com/XYZ 下的链接来获取 website.com/ABC 下的文件)。
任何提示?
ken*_*orb 23
您可以尝试--max-redirect 0
或使用--domains example.com
与--exclude-domains example.com
.
看:
-D, --domains=LIST comma-separated list of accepted domains.
--exclude-domains=LIST comma-separated list of rejected domains.
--follow-tags=LIST comma-separated list of followed HTML tags.
--ignore-tags=LIST comma-separated list of ignored HTML tags.
-np, --no-parent don't ascend to the parent directory.
--max-redirect maximum redirections allowed per page.
Run Code Online (Sandbox Code Playgroud)
这是错误的:
--exclude domains=www.website.de,www.website.it
Run Code Online (Sandbox Code Playgroud)
正确的方法是:
--exclude-domains www.website.de,www.website.it
Run Code Online (Sandbox Code Playgroud)
从 wget 手册页:
Run Code Online (Sandbox Code Playgroud)--exclude-domains domain-list Specify the domains that are not to be followed.
归档时间: |
|
查看次数: |
16290 次 |
最近记录: |