Coder Social home page Coder Social logo

crawler.engine's Introduction

Crawler.Engine

爬虫框架

主要有4个模块组成:

Crawler.IDownloader

下载模块,结果传递给Crawler.IDownloadResultProcesser模块。

Crawler.IDownloadResultProcesser

结果处理模块。 1.找到所有的Url,传递到Crawler.IScheduler模块。 2.把结果传递到Crawler.IPipeline模块。

Crawler.IScheduler

Urls管理模块。

Crawler.IPipeline

结果处理管道。实现了树形管道。

使用:

using (new Engine(
    new Downloader(),
    new DownloadResultProcesser(),
    new Scheduler())
    .AddUrls(new List<string> { "https://www.baidu.com/" })
    .AddPipeline(
        new FindAllUrlsPipeline()
        .NextPipeline(new WriteUrlsToConsolePipeline())
        .NextPipeline(new WriteUrlsToFilePileline("urls.txt"))
    ).Run()) {

    while ('y' != Console.ReadKey().KeyChar) ;
}

当然,你需要写自己的管道逻辑来处理你的业务,你只需要继承AbstractPipeline即可,适当扩展,就可以。

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.