Giter VIP home page Giter VIP logo

Comments (2)

brianway avatar brianway commented on June 17, 2024

本身就是文件缓存的,关闭后重新启动会从上次结束的位置继续爬。

源码见 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.

Arvinshu avatar Arvinshu commented on June 17, 2024

谢谢,我也刚刚看到这个方法。

from webporter.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.