【问题标题】:Nutch not crawling URLs except the one specified in seed.txtNutch 不抓取除 seed.txt 中指定的 URL 之外的 URL
【发布时间】:2017-02-27 23:29:42
【问题描述】:

我使用的是 Apache Nutch 1.12,我尝试抓取的 URL 类似于 https://www.mywebsite.com/abc-def/,这是我的 seed.txt 文件中的唯一条目。由于我不希望抓取任何 URL 中没有“abc-def”的页面,所以我在 regex-urlfilter.txt 中添加了以下行:

+^https://www.mywebsite.com/abc-def/(.+)*$

当我尝试运行以下抓取命令时:

**/bin/crawl -i -D solr.server.url=http://mysolr:3737/solr/coreName $NUTCH_HOME/urls/ $NUTCH_HOME/crawl 3**

它只抓取和索引一个seed.txt url,在第二次迭代中它只是说:

Generator: starting at 2017-02-28 09:51:36

Generator: Selecting best-scoring urls due for fetch.

Generator: filtering: false

Generator: normalizing: true

Generator: topN: 50000

Generator: 0 records selected for fetching, exiting ...

Generate returned 1 (no new segments created)

Escaping loop: no more URLs to fetch now

当我更改 regex-urlfilter.txt 以允许所有内容(+。)时,它开始索引 https://www.mywebsite.com 上的每个 URL,这当然是我不想要的。

如果有人碰巧遇到同样的问题,请分享你是如何解决的。

【问题讨论】:

    标签: apache web-crawler nutch


    【解决方案1】:

    在过去 2 天尝试了多种方法后,解决方法如下:

    由于我要抓取的网站非常重,nutch-default.xml 中的属性将其截断为 65536 字节(默认)。不幸的是,我想抓取的链接没有包含在所选部分中,因此 nutch没有抓取它。当我通过在 nutch-site.xml 中输入以下值将其更改为无限制时,它开始抓取我的页面:

    <property>
      <name>http.content.limit</name>
      <value>-1</value>
      <description>The length limit for downloaded content using the http://
      protocol, in bytes. If this value is nonnegative (>=0), content longer
      than it will be truncated; otherwise, no truncation at all. Do not
      confuse this setting with the file.content.limit setting.
      </description>
    </property>
    

    【讨论】:

      【解决方案2】:

      您可以尝试调整 conf/nutch-default.xml 中可用的属性。也许控制您想要的外链数量或修改获取属性。如果您决定覆盖任何属性,请将该信息复制到 conf/nutch-site.xml 并在那里放置新值。

      【讨论】:

      • 能否请您更具体地说明我应该调整哪个属性以使其工作。我已经通过将它们复制到 nutch-site.xml 尝试了一些,但它没有用。
      • 所以基本上你不想抓取mywebsite.com/abc-def 上的任何外部链接,对吧?如果是这样,尝试将&lt;name&gt;db.ignore.external.links&lt;/name&gt; 的值设置为true?让我知道,我可以相应地编辑答案。
      • 不,我想要路径从 mywebsite.com/abc-def/ 开始的内部链接。无论如何,我想我已经解决了这个问题。感谢您的帮助。
      • 确定,可以分享您正在使用的解决方案吗?
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-27
      • 1970-01-01
      • 1970-01-01
      • 2014-07-27
      相关资源
      最近更新 更多