日志标签 nutch
改变 Nutch 对 robots.txt 的解析实现
6月3日
昨天晚上,改进后的 Nutch 终于在公司内网环境中部署了,爬了一个晚上,今天早晨发现服务器CPU占用 100%,Nutch 爬虫仍在抓取 Redmine 管理平台下各个项目的版本库相关页面。我的天,一定是 robots.txt 缺乏相应配置造成的。
robots.txt 的配置如下:
User-agent: * Disallow: /issues/gantt Disallow: /issues/calendar Disallow: /activity Disallow: /redmine/repositories/ Disallow: /redmine/projects/redmine/repository Disallow: /redmine/projects/redmine/issues Disallow: /redmine/projects/redmine/activity Disallow: /redmine/issues/gantt Disallow: /redmine/issues/calendar Disallow: /redmine/activity
我们知道 redmine 下每个项目的版本库浏览的 URL 为: http://bj.ossxp.com/redmine/projects/<PROJECTNAME>/repository, 难道要一一为每个项目进行配置么?
看了一下王胜之前的两个博文(robots.txt参考1, robots.txt参考2),以及 wikipedia 上的相关参考,尤其是 WikiPedia 上的这句话,让我眼前一亮。
The robots.txt patterns are matched by simple substring comparisons, so care should be taken to make sure that patterns matching directories have the final ‘/’ character appended, otherwise all files with names starting with that substring will match, rather than just those in the directory intended.
如果 Disallow: 后面的字符串配置是使用的 substring,那么不就是说可以是路径中任意的一部分么,那么使用 Disallow: /repository 是不是就可以限制搜索引擎对 redmine 版本库的抓取呢?
Nutch 深度的测试
3月19日
今天下午我做了一个Nutch深度的测试。先在apache2下建立一个小网站,这个网站用Git作版本控制工具,它只有5个网页,分别是a.html,b.html,c.html,d.html,index.html。它们的链接关系index.html中有a.html,a.html有b.html,依次类推。

最新评论