Srapy - Architecture overview【Data flow】

#Data flow

The data flow in Scrapy is controlled by the execution engine, and goes like this:

  1. The Engine gets the initial Requests to crawl from the Spider.
  2. The Engine schedules the Requests in the Scheduler and asks for the
    next Requests to crawl.
  3. The Scheduler returns the next Requests to the Engine.
  4. The Engine sends the Requests to the Downloader, passing through the
    Downloader Middleware (requests direction).
  5. Once the page finishes downloading the Downloader generates a
    Response (with that page) and sends it to the Engine, passing
    through the Downloader Middleware (response direction).
  6. The Engine receives the Response from the Downloader and sends it to
    the Spider for processing, passing through the Spider Middleware
    (input direction).
  7. The Spider processes the Response and returns scraped items and new
    Requests (to follow) to the Engine, passing through the Spider
    Middleware (output direction).
  8. The Engine sends processed items to Item Pipelines, then send
    processed Requests to the Scheduler and asks for possible next
    Requests to crawl.
  9. The process repeats (from step 1) until there are no more requests
    from the Scheduler.

Scrapy的架构初探
https://zhuanlan.zhihu.com/p/21320942

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值