如何让 wget 向下和向上移动主机层次结构



wget 递归到倒数第二的级别,不再进一步。 如果我指定底层 HTML 文件作为源,它会解析它并进一步。 我认为这可能是由于从HTML文档链接的PDF文件位于服务器上的不同根文件路径中引起的。 我需要它从这个层次结构的叶子中检索所有PDF文件,因为我将一起推广它们,作为抑郁症意识运动的一部分。

我正在使用基于 linux-gnu 构建的 GNU Wget 1.19.4。

我已经尝试过,--exclude,--exclude-directory,-l2,-l10,--continue和许多其他开关。 我需要使用 --include 命令或 wget 抓取整个站点。 如果我使用 -np,它不会"向上"进入/docs

这段代码为我提供了HTML文件,但不遵循"最底部"的链接 HTML 文件。

wget  --mirror --include docs/default-source/research-project-files --include about-us/research-projects/research-projects/ https://www.beyondblue.org.au/about-us/research-projects/research-projects/

当我手动指定 HTML 文件时,此代码会获取我想要的 PDF 文件。

wget  --mirror --include docs/default-source/research-project-files --include about-us/research-projects/research-projects https://www.beyondblue.org.au/about-us/research-projects/research-projects/online-forums-user-research

我希望它访问此分支中的所有 HTML 文件,取出其中的所有 PDF 链接,并从/docs 中检索所有 PDF 文件

https://www.beyondblue.org.au/about-us/research-projects/research-projects/online-forums-user-research

这是其中一个 PDF。/docs 目录没有列表。

https://www.beyondblue.org.au/docs/default-source/research-project-files/online-forums-2015-report.pdf?sfvrsn=3d00adea_2

我能做的最好的事情就是浏览网站并将HTML文件降低到这个级别:

https://www.beyondblue.org.au/about-us/research-projects/research-projects/online-forums-user-research
https://www.beyondblue.org.au/about-us/research-projects/research-projects/networks-of-advocacy-and-influence-peer-mentors-in-beyond-blue-s-mental-health-forums
...
150 of them

这似乎是一个深度限制设置或路径遍历限制之类的。 我怀疑这是一个容易发现的。 再次感谢!

好吧,看起来 wget 可能首先是广度。 这意味着在递归到页面之前获取目录中的所有内容。 我不确定这一点,但我让下面的文件运行,它似乎得到了所有的叶 HTML 文件,但在获得所有文件后递归到它们中。

wget  -r  --verbose --include /docs/default-source/research-project-files/,/about-us/research-projects/research-projects/ https://www.beyondblue.org.au/about-us/research-projects/research-projects/

当然,运行它并在它似乎在底部 HTML 层停止并且没有获得 PDF 时停止它太早了。

最新更新