2012-08-07 153 views
1

我已经安装了apache nutch进行网络抓取。我想抓取一个网站,有以下robots.txtapache nutch不抓取网站

User-Agent: * 
Disallow:/

有什么办法抓取本网站使用Apache Nutch的?

+0

我将如何在nutch-site.xml中设置Protocol.CHECK_ROBOTS false – jackyesind 2013-07-08 09:24:24

回答

2

在Nutch的-site.xml中,设置protocol.plugin.check.robots假

OR

您可以注释掉在机器人检查完成的代码。 在Fetcher.java中,第605-614行正在进行检查。评论整个块

 if (!rules.isAllowed(fit.u)) { 
     // unblock 
     fetchQueues.finishFetchItem(fit, true); 
     if (LOG.isDebugEnabled()) { 
      LOG.debug("Denied by robots.txt: " + fit.url); 
     } 
     output(fit.url, fit.datum, null, ProtocolStatus.STATUS_ROBOTS_DENIED, CrawlDatum.STATUS_FETCH_GONE); 
     reporter.incrCounter("FetcherStatus", "robots_denied", 1); 
     continue; 
     } 
+0

如何设置Protocol.CHECK_ROBOTS false在nutch-site.xml – muthu 2013-05-27 13:17:43

2

您可以在nutch-site.xml中将属性“Protocol.CHECK_ROBOTS”设置为false以忽略robots.txt。

+1

我怎么能做到这一点? (设置Protocol.CHECK_ROBOTS“false) – Amir 2012-08-11 07:27:47

+0

它是好的解决方案nutch 2.2.1? – 2014-06-04 12:01:41