【问题标题】:How to get wget to go down and up host hierarchy如何让 wget 上下主机层次结构
【发布时间】:2019-11-03 21:35:20
【问题描述】:

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

我可以让 wget 做的最好的事情就是浏览网站并将 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 mirror


    【解决方案1】:

    好吧,看起来 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 时,当然运行它并停止它太早停止了。

    【讨论】:

      猜你喜欢
      • 2012-12-28
      • 1970-01-01
      • 1970-01-01
      • 2022-01-15
      • 1970-01-01
      • 2016-03-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多