Comments (2)
本身就是文件缓存的,关闭后重新启动会从上次结束的位置继续爬。
源码见 ZhihuFolloweePageProcessor
类的 main
方法:
Spider.create(new ZhihuFolloweePageProcessor())
.setScheduler(//new QueueScheduler()
new FixedFileCacheQueueScheduler(pipelinePath)
.setDuplicateRemover(new BloomFilterDuplicateRemover(crawlSize)))
.addPipeline(new FilePipeline(pipelinePath))
.addUrl(generateMemberUrl("hydro-ding"))
.thread(20)
.run();
其中 FixedFileCacheQueueScheduler
就是文件缓存之前下载过的链接。具体原理可以阅读源码,在此不赘述。
另, FixedFileCacheQueueScheduler 是由于 webmagic 0.5.3 有 bug (见 webmagic 的 issue #400 修复FileCacheQueueScheduler的NullPointerException问题 ),我按照作者回答临时修复的。后续 webporter 会升级 webmagic 到 0.6.0,这个类会去掉。
from webporter.
谢谢,我也刚刚看到这个方法。
from webporter.
Related Issues (13)
- 请问图表是用什么工具生成的? HOT 2
- 关于fastjason HOT 1
- 怎么启动项目啊 HOT 1
- 爬虫api是不是已经失效了呀
- 该项目已经不能用了 是吗 HOT 1
- 请求商务推广合作 HOT 2
- javascript支持,性能,反扒 HOT 2
- 没找到authorization字段 HOT 27
- 请问一下Kibana要怎么配置pattern HOT 3
- 启动zhihufolloweepageprocessor后一直报编码的警告,没有内容被爬出来 HOT 1
- 知乎是不是已经做了反爬虫了 HOT 6
- 知乎反爬 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webporter.