【问题标题】:Scrapy: downloader/response_count vs response_received_countScrapy:下载器/response_count vs response_received_count
【发布时间】:2018-06-12 10:02:29
【问题描述】:

我正在使用scrapy爬取多个网站,我想分析爬取率。 最后转储的统计信息包含一个downloader/response_count 值和一个response_received_count 值。前者在系统性上大于后者。

为什么会有区别,爬虫的哪个元素会增加统计收集器中的两个值?

【问题讨论】:

    标签: python web-scraping scrapy web-crawler


    【解决方案1】:
    • CoreStatsExtension 负责response_received_count
    • DownloaderStats 是负责downloader/response_countMiddleware

    CoreStats 扩展将signals.response_received 的信号连接到增加response_received_count 的值,因此它应该计算您获得的每个响应(甚至是错误状态),而DownloaderStats 中间件处理特定的响应我们可以看到here its order is 850 的顺序,因此以前的下载器中间件(设置为数字低于850 的中间件在处理响应时可能会下降甚至出错,并且downloader/response_count 永远不会增加。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-10-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-05
      • 2018-12-15
      相关资源
      最近更新 更多