如何防止用apache nutch爬行外部链接?

时间:2016-04-05 20:10:28

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

我想只抓取nutch上的特定域名。为此,我将db.ignore.external.links设置为 true ,就像在FAQ link中所说的那样

问题是nutch开始只抓取种子列表中的链接。例如,如果我把" nutch.apache.org"到seed.txt,它只找到相同的url(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

最好的问候

3 个答案:

答案 0 :(得分:2)

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

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

您应该尝试使用nutch1 tutorial

示例中的conf/regex-urlfilter.txt
+^http://([a-z0-9]*\.)*your.specific.domain.org/

答案 1 :(得分:1)

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

中列出的网址

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

答案 2 :(得分:0)

在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>