nutch

How to parse content located in specific HTML tags using nutch plugin?

冷暖自知 提交于 2019-12-04 06:53:50
I am using Nutch to crawl websites and I want to parse specific sections of html pages crawled by Nutch. For example, <h><title> title to search </title></h> <div id="abc"> content to search </div> <div class="efg"> other content to search </div> I want to parse div element with id ="abc" and class="efg" and so on. I know that I have to create a plugin for customized parsing as htmlparser plugin provided by Nutch removes all html tags, css and javascript content and leaves only text content. I refered to this blog http://sujitpal.blogspot.in/2009/07/nutch-custom-plugin-to-parse-and-add.html

connection refused error when running Nutch 2

隐身守侯 提交于 2019-12-04 05:18:18
I am trying to run Nutch 2 crawler on my system but I get the following error: Exception in thread "main" org.apache.gora.util.GoraException: java.io.IOException: java.sql.SQLTransientConnectionException: java.net.ConnectException: Connection refused at org.apache.gora.store.DataStoreFactory.createDataStore(DataStoreFactory.java:167) at org.apache.gora.store.DataStoreFactory.createDataStore(DataStoreFactory.java:135) at org.apache.nutch.storage.StorageUtils.createWebStore(StorageUtils.java:69) at org.apache.nutch.crawl.InjectorJob.run(InjectorJob.java:243) at org.apache.nutch.crawl.Crawler

Nutch 关于读取资源数据的命令

醉酒当歌 提交于 2019-12-04 03:52:54
资料来源: http://adt.haotui.com/thread-278-1-1.html 关于读取资源数据的命令 最近在研究 nutch ,整理了一下关于读取资源数据的命令。 1. 查看 crawldb 数据库: bin/nutch readdb url/crawldb/ -stats 这个命令可以查看 url 地址总数和它的状态及评分。 查看每个 url 地址的详细内容,导出数据: bin/nutch readdb url/crawldb/ -dump crawldb( 导出的地址 ) 查看具体的 url ,以 163 为例: bin/nutch readdb url/crawldb/ -url http://www.163.com/ 2. 查看 linkdb 数据库的链接情况: bin/nutch readlinkdb url/linkdb/ -url http://www.163.com/ 导出 linkdb 数据库文件: bin/nutch readlinkdb url/linkdb/ -dump linkdb( 导出的地址 ) 3. 查看 segments : bin/nutch readseg -list -dir url/segments/ 可以看到每一个 segments 的名称,产生的页面数,抓取的开始时间和结束时间,抓取数和解析数。 导出 segments

《Nutch笔记》Nutch-2.2+MySQL集成

孤街浪徒 提交于 2019-12-03 23:05:45
一、MySQL配置 1、my.ini 配置 找到 [mysqld]在下面添加 skip-grant-tables和 character-set-server=utf8 找到[mysql]、[client] 在下面添加default-character-set=utf8 重启mysql服务 (注:)如果已有的话就不需要添加 2、 创建数据库与表 CREATE TABLE `webpage` ( `id` varchar(767) CHARACTER SET latin1 NOT NULL, `headers` blob, `text` mediumtext, `status` int(11) DEFAULT NULL, `markers` blob, `parseStatus` blob, `modifiedTime` bigint(20) DEFAULT NULL, `score` float DEFAULT NULL, `typ` varchar(32) CHARACTER SET latin1 DEFAULT NULL, `baseUrl` varchar(512) CHARACTER SET latin1 DEFAULT NULL, `content` mediumblob, `title` varchar(2048) DEFAULT NULL, `reprUrl`

nutch与起点R3集成之笔记(四)

自闭症网瘾萝莉.ら 提交于 2019-12-03 23:05:32
通过“ nutch与起点R3集成之笔记(一、二、 三)”中的步骤,我们可以建立起一个行业内部网的搜索引擎,但搜索引擎一个最重要的功能,就是必须能搜索到网络中最新的内容。这就要求nutch能及时采集到网络中的最新网页信息,同时将这些新采集到的信息更新到solr索引库中。故本篇介绍如何实现索引的更新和去重问题。 我们随时可以使用nutch的crawl命令来爬行网站,例如,今天上午8:00采集一次新浪网站 http://www.sina.com.cn ,并通过nutch 的solrindex索引到solr索引库中,然后上午10:00再采集一次新浪网站,再通过solrindex索引到solr库中。这样做,可以保证用户能搜索到网络中较新的信息。在solr中实现没有什么问题,因为solr使用的是update方式更新索引库,因为索引field名为id的是主键,只要id是唯一的,update到索引库的操作就是成功的。 我们回过头来看看 《nutch与起点R3集成之笔记(二)》,在该篇中,我们是定义了用digest作为id,而没有采用在nutch的conf 的solrconfig.xml中定义用url作为id。其原因在于,如果用url作为id,在起点R3中会出现看不到索引数据等一些问题,我分析了很久,估计是由于url中会出现: / ? & 字符,这些字符不通过escape转换

nutch与起点R3集成之笔记(三)

北慕城南 提交于 2019-12-03 23:04:53
四、抓取网页,建立solr索引 在抓取网页前,要保证起点R3处在运行状态。即 在浏览器中键入 http://127.0.0.1:880/ 后,会出现如下窗口: 在linux或cygwin中运行nutch抓取网页命令为 :bin/nutch crawl url -solr http://127.0.0.1:880 -dir test -depth 3 -topN ,其dir、depth、topN参数的含义网上介绍有很多,在这里不做解释。参数solr表示将抓取后的网页solr索引到一个提供solr服务的服务器索引库中,这里的127.0.0.1是指当nutch和起点R3都安装在同一台机器上,如果两者不在同一台机器上,这里的127.0.0.1要改成起点R3机器的IP。 在eclipse环境里,先在apache-nutch-1.3的项目里建立一个main类 为org.apache.nutch.crawl.Crawl的java运行应用程序,如下图: 对应的自变量设置为: 点击“运行”后,最后,在eclipse的控制台出现: 表示网页抓取和solr索引建立完毕。这时,可以在浏览器上通过起点R3的查询界面,实现对抓取的页面进行搜索了。如下图: 五、总结 nutch与起点R3集成,其实与nutch和solr集成实现原理是一样:1.定义solr的索引字段

nutch与起点R3集成之笔记(一)

依然范特西╮ 提交于 2019-12-03 23:04:38
百度、google帮我们找Internet的信息,但对于一个行业内部网(intranet)来说,百度、google就无法帮忙了。并且,对一个行业来说,更多的信息都是放在行业内部网上,并且采用网页、office文档、图片、视频、音频等格式存放。如何方便,快捷,安全地获取行业内部的信息内容,建立一个行业内部网的搜索引擎就显得尤为重要。 佛山起点软件( http://www.rivues.com )推出了起点R3软件,是一个开箱即用的企业级搜索引擎产品,并且已开源,下载地址 http://sourceforge.net/projects/rivues/files/ ,最新版本是5.3,安装后,试了一下,非常不错,很快可以建一个桌面搜索(对本地文件建一个搜索引擎),但没有看到对网站内容采集界面。 nutch是apache项目的一个开源软件,最新版本是1.3,是一个强大的网页、索引工具,1.3版本好像只对solr建立索引,去掉了lucene索引(bin/nutch index 命令不能使用)。solr也是apache项目的一个开源软件,主要是基于lucene的一个索引工具,但搜索结果返回的是xml、json等格式,需要用户开发html展示模块。 其实,起点R3软件也是基于solr建立的索引,有非常完善展示界面。笔者通过对起点R3源码进行分析后,实现了用nutch来采集网站信息

Apache Nutch to index only part of page content

血红的双手。 提交于 2019-12-03 21:42:55
Going to use Apache Nutch v1.3 to extract only some specific content from the webpages. Checked parse-html plugin. Seems it normalizes each html page using tagsoup or nekohtml. This is good. I need to extract only text inside <span class='xxx'> and <span class='yyy'> elemetns on the web-page. Would be great if extracted texts are saved into different fields (e.g. content_xxx , content_yyy ). My question is: should I write my own plugin or this could be done using some standard way? The best way would be apply XSLT on normalized web-page and get the result. Is that possible? Building your own

How to increase number of documents fetched by Apache Nutch crawler

被刻印的时光 ゝ 提交于 2019-12-03 21:26:05
I am using Apache Nutch 2.3 for crawling. There were about 200 urls in seed at start. Now as the time elasped, number of documents crawler are going to decrease or atmost same as at start. How I can configure Nutch so that my documents crawled should be increased? Is there any parameter that can be used to control number of documents? Second, how I can count number of documents crawled per day by nutch? m5khan One crawl cycle consists of four steps: Generate, Fetch, Parse and Update DB. for detailed information, read my answer here . Whats causing limited URL fetch can be caused by the

Re-crawling websites fast

亡梦爱人 提交于 2019-12-03 20:46:58
I am developing a system that has to track content of few portals and check changes every night (for example download and index new sites that have been added during the day). Content of this portals will be indexed for searching. The problem is in re-crawling this portals - first crawling of portal takes very long (examples of portals: www.onet.pl, www.bankier.pl, www.gazeta.pl ) and I want to re-crawl it faster (as fast as it is possible) for example by checking date of modification but I have used wget to download www.bankier.pl but in response it complains that there is no last