gpt4 book ai didi

wget 只下载一个 index.html 文件而不是其他大约 500 个 html 文件

转载 作者:行者123 更新时间:2023-12-01 12:46:20 26 4
gpt4 key购买 nike

使用 Wget 我通常只收到一个 -- index.html 文件。我输入以下字符串:

wget -e robots=off -r http://www.korpora.org/kant/aa03

它只返回一个 index.html 文件。

目录aa03是康德的书,第三卷,里面肯定有560个文件(页)左右。这些页面可在线阅读,但无法下载。有什么办法吗?!谢谢

最佳答案

点击该链接将我们带到:

http://korpora.zim.uni-duisburg-essen.de/kant/aa03/

wget 不会跟踪指向用户未指定域的链接。由于 korpora.zim.uni-duisburg-essen.de 不等于 korpora.org,wget 将不会访问索引页面上的链接。

要解决此问题,请使用 --span-hosts 或 -H。 -rH 是一个非常 危险的组合 - 结合起来,您可能会不小心抓取整个 Internet - 因此您需要非常紧密地关注它的范围。此命令将执行您打算执行的操作:

wget -e robots=off -rH -l inf -np -D korpora.org,korpora.zim.uni-duisburg-essen.de http://korpora.org/kant/aa03/index.html

(-np 或 --no-parent,会将爬行限制为 aa03/。-D 会将其限制为仅这两个域。-l inf 将爬行无限深,受 -D 和 -np 约束)。

关于wget 只下载一个 index.html 文件而不是其他大约 500 个 html 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15434173/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com