【问题标题】:Apache Nutch url's in regex-urlfilter.txt fileregex-urlfilter.txt 文件中的 Apache Nutch url
【发布时间】:2019-10-07 07:25:31
【问题描述】:

我是爬行新手,特别是 apache nutch。 apache nutch 的配置非常复杂。我一直在通过 apache nutch 进行大量研究,并找到了 regex-urlfilter.txt 文件,您必须在其中提及要抓取哪些页面并限制您的抓取。因为,没有一个好的/简单的教程,这就是我在这里的原因。问题的解释如下。

解释

假设我有一个名为https://www.example.com 的网站。现在为了只抓取这个网站并限制我的抓取,我知道我必须像这样编辑我的 regex-urlfilter.txt 文件+^https://www.example.com/ 现在如果我想限制更多呢?例如,我只想抓取这个给定网站的一些页面。

https://www.example.com/something/details/1
https://www.example.com/something/details/2
https://www.example.com/something/details/3
https://www.example.com/something/details/4
https://www.example.com/something/details/5
.
.
.
https://www.example.com/something/details/10

P.S:作为一个新成员,我可能在问一个好问题时犯了很多错误。请帮助我改进问题,而不是给出-1。我会非常感谢你们。

【问题讨论】:

  • “某些页面”是什么意思。对于正则表达式,您需要一个规则。它可以是您想要允许的列表 id,大于、小于等
  • @aelor 我想将我的抓取限制在网站的某些页面上。例如,我只想要来自给定 url 的数据,比如说www.example.com。因此,我不想爬取整个站点,而只想爬取www.example.com/something/details/ 斜线(/)之后的所有页面,仅此而已。我读到你可以用正则表达式限制你的抓取,但不知道如何提及..

标签: regex web-crawler nutch


【解决方案1】:

如果只想爬https://www.example.com/something/details/及以下,请将regex-urlfilter.txt的最后一行替换为:

# accept anything else
+.

收件人:

+https://www.example.com/something/details/
-.

这将仅包括包含 https://www.example.com/something/details/ 的 URL,并忽略所有其他 URL。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多