【问题标题】:How to prevent crawling external links with apache nutch?如何防止使用 apache nutch 抓取外部链接?
【发布时间】:2016-04-05 20:10:27
【问题描述】:

我只想在 nutch 上抓取特定域。为此,我将 db.ignore.external.links 设置为 true,正如 FAQ link

中所说

问题是 nutch 开始只抓取种子列表中的链接。例如,如果我将“nutch.apache.org”放入seed.txt,它只会找到相同的网址(nutch.apache.org)。

我通过运行深度为 200 的爬网脚本得到结果。它完成一个周期并生成下面的输出。

我该如何解决这个问题?

我正在使用 apache nutch 1.11

Generator: starting at 2016-04-05 22:36:16
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

最好的问候

【问题讨论】:

    标签: solr web-crawler nutch information-retrieval external-links


    【解决方案1】:

    您只想从特定域中获取页面。

    您已经尝试过db.ignore.external.links,但这限制了除了 seek.txt 网址之外的任何内容。

    你应该试试conf/regex-urlfilter.txt,就像nutch1 tutorial的例子一样:

    +^http://([a-z0-9]*\.)*your.specific.domain.org/
    

    【讨论】:

      【解决方案2】:

      您是否使用“抓取”脚本?如果是,请确保您给出的级别大于 1。如果您运行类似“bin/crawl seedfoldername crawlDb http://solrIP:solrPort/solr 1”的内容。它只会抓取在 seed.txt 中列出的 url

      要抓取特定域,您可以使用 regex-urlfiltee.txt 文件。

      【讨论】:

      • 是的,我正在使用深度为 200 的爬网脚本。当我编辑引用 url 过滤结果时与以前相同。
      • 如果你正在运行爬虫脚本,我建议删除你的 crawldb 文件夹然后重新运行..
      • 并确保您的种子 url 页面具有爬虫可以爬入的其他链接
      【解决方案3】:

      在 nutch-site.xml 中添加以下属性

      <property> 
      <name>db.ignore.external.links</name> 
      <value>true</value> 
      <description>If true, outlinks leading from a page to external hosts will be ignored. This is an effective way to limit the crawl to include only initially injected hosts, without creating complex URLFilters. </description> 
      </property>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2010-11-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-08-04
        • 1970-01-01
        相关资源
        最近更新 更多