heritrix3.1.0增量爬取
来源:互联网 发布:kindle软件 编辑:程序博客网 时间:2024/05/14 18:34
感谢这三篇文章
https://webarchive.jira.com/wiki/display/Heritrix/Duplication+Reduction+Processors 这个是官网的文章
http://blog.sina.com.cn/s/blog_5f54f0be0101hdep.html
http://blog.csdn.net/historyasamirror/article/details/6706174
然后在得到摘要时我觉得应该去掉某些字符,例如不停变换的当前时间,这也是在一篇文章中看到的,地址忘了。
在crawler-beans.xml中加入
<span style="font-size:12px;"><bean id="httpContentDigest" class="org.archive.modules.extractor.HTTPContentDigest"><property name="stripRegex" value="fds" /> </bean></span>这儿是引入位置
<span style="font-size:12px;"><ref bean="fetchHttp"/><ref bean="httpContentDigest"/><ref bean="fetchHistoryProcessor"/></span>注意顺序。
httpContentDigest中的摘要会将<span style="font-family: Arial, Helvetica, sans-serif;">fetchHttp中的摘要覆盖</span>
在fetchHistoryProcessor中会将摘要保存起来,在fetchHttp中有个默认的摘要生成的方法,这个方法没有过滤。
<span style="font-size:12px;">fetchHistoryProcessor<span style="font-family:Arial, Helvetica, sans-serif;">中将摘要保存。</span></span>
<span style="font-size:12px;"><span style="font-family:SimSun;">想要页面没有</span><span style="font-family:Arial, Helvetica, sans-serif;">改变依然返回</span><span style="font-family:FangSong_GB2312;">200的话</span><span style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; line-height: 20px;">setting the </span><span style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; line-height: 20px; widows: auto;">sendIfModifiedSince</span><span style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; line-height: 20px; widows: auto;"> and </span><span style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; line-height: 20px; widows: auto;">sendIfNoneMatch</span><span style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; line-height: 20px; widows: auto;"> properties of FetchHTTP to false</span></span>
<pre style="background-color: rgb(240, 240, 240);"><span style="font-family:SimSun;font-size:12px;"><span style="color: rgb(51, 51, 51); line-height: 20px; widows: auto;">这</span><span style="line-height: 20px; widows: auto;">是官</span><span style="line-height: 20px; widows: auto;">方文档的</span><span style="line-height: 20px; widows: auto;">话,但是我设置为true,</span><span style="line-height: 20px; widows: auto;">依然把整个页面都反回了。感觉要在服务器手动返回302才行</span></span>
另外为了在MirrorWriterProcessor值保存修改的文件,改了一个方法:<span style="font-size:12px;">protected boolean shouldProcess(CrawlURI curi) {Map[] history = (Map[]) curi.getData().get(RecrawlAttributeConstants.A_FETCH_HISTORY);boolean flg = false;// 已经抓取过的不写入.这里用 history[1] 而不用 history[0],是因为在 FetchHistoryProcessor// 中,会往 history 中加一个新的值进去// 而这个值是没有 A_WRITE_TAG 的,所以实际上上次请求的记录是 history[1]//if (history != null && history[1] != null && history[1].containsKey(RecrawlAttributeConstants.A_WRITE_TAG)) {if(history!= null && history[0] != null && history[0].containsKey(A_CONTENT_DIGEST) && history[1] != null && history[1].containsKey(A_CONTENT_DIGEST) && history[0].get(A_CONTENT_DIGEST).equals(history[1].get(A_CONTENT_DIGEST)) ){flg = false;} else {// 没有抓取过.如果获取成功了.写入flg = isSuccess(curi);}return flg;// return isSuccess(curi);}</span><span style="font-size:12px;"><span style="background-color: rgb(240, 240, 240);">这个和</span><a target=_blank href="http://blog.sina.com.cn/s/blog_5f54f0be0101hdep.html" style="background-color: rgb(240, 240, 240);">http://blog.sina.com.cn/s/blog_5f54f0be0101hdep.html</a><span style="background-color: rgb(240, 240, 240);">这篇文章有点不同,感觉这篇文章的判断</span><span style="font-family: simsun; line-height: 21px; background-color: rgb(255, 255, 255);">history[1].containsKey(A_WRITE_TAG)这儿肯定成立,</span></span><span style="font-size:12px;"><span style="font-family: simsun; line-height: 21px; background-color: rgb(255, 255, 255);">不太对</span></span>
0 0
- heritrix3.1.0增量爬取
- Heritrix3 控制爬取链接
- heritrix3伪装成GOOGLE进行爬取
- heritrix3 伪装成GOOGLE进行爬取
- nutch的定时增量爬取
- nutch 1.2 增量爬取url 完成 recrawl.sh 编写
- nutch 1.4 的增量爬取(recrawl)脚本
- Scrapy如何借助于BloomFilter实现增量爬取
- Heritrix3.0
- CreateSymbolicLinkA Heritrix3
- Scrapy-redis增量爬取以及Simhash相似文档的去重
- Heritrix3.1.1使用教程
- heritrix3 后台运行job
- Heritrix3.1.1使用教程
- kettle入门(七) 之kettle增量方案(一)全量比对取增量-根据唯一标示
- Heritrix3.0 的安装,使用
- Heritrix3.0 CrawlJob控制台界面
- Heritrix3.x蜘蛛配置&使用
- Codejock.Xtreme.Toolkit.Pro.v15.3.1 for MFC 15种皮肤切换
- 开发中客户端路径的编写
- 逻辑回归算法--Logistic回归
- 下载文件
- 31 5个数求最值
- heritrix3.1.0增量爬取
- Android App跳转App以及App跳转指定App页面的实现
- oracle 查询 本周周一到当天的数据
- openjudge-noi-4.6-1455:An Easy Problem
- |Vijos|贪心|P1691 输油管道问题
- Error:Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/suppor
- nginx部署web应用
- 判断图中是否存在环
- jQuery获取地址栏中的链接参数