scrapy日志信息解读

2023-05-17 15:45:55 浏览数 (2)

此条日志打印出Scrapy的版本信息,和我们要爬取的域...

请注意,本文编写于 989 天前,最后修改于 989 天前,其中某些信息可能已经过时。

此条日志打印出Scrapy的版本信息,和我们要爬取的域名:

代码语言:javascript复制
2020-08-31 18:09:12 [scrapy.utils.log] INFO: Scrapy 2.3.0 started (bot: Baidu)

此条日志打印出了Scrapy使用的Python模块的版本信息:

代码语言:javascript复制
2020-08-31 18:09:12 [scrapy.utils.log] INFO: Versions: lxml 4.5.2.0, libxml2 2.9.5, cssselect 1.1.0, parsel 1.6.0, w3lib 1.22.0, Twisted 20.3.0, Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)], pyOpenSSL 19.1.0 (OpenSSL 1.1.1g  21 Apr 2020), cryptography 3.1, Platform Windows-10-10.0.18362-SP0

此条日志信息... 我也不知道干啥的。

代码语言:javascript复制
2020-08-31 18:09:12 [scrapy.utils.log] DEBUG: Using reactor: twisted.internet.selectreactor.SelectReactor

此条日志信息反映了我们在setting.py重写了哪些设置(Scrapy默认是有一个类似于setting.py的文件,当我们自己启用项目中的设置文件后,就会覆盖默认的设置文件)。

代码语言:javascript复制
2020-08-31 18:09:12 [scrapy.crawler] INFO: Overridden settings:
{'BOT_NAME': 'Baidu',
 'DUPEFILTER_CLASS': 'scrapy_splash.SplashAwareDupeFilter',
 'HTTPCACHE_STORAGE': 'scrapy_splash.SplashAwareFSCacheStorage',
 'NEWSPIDER_MODULE': 'Baidu.spiders',
 'SPIDER_MODULES': ['Baidu.spiders']}

下面这个... 我也不懂...

代码语言:javascript复制
2020-08-31 18:09:12 [scrapy.extensions.telnet] INFO: Telnet Password: a83367742a88cae9

下面这条日志是Scrapy下载件默认开启的一些扩展:

代码语言:javascript复制
2020-08-31 18:09:12 [scrapy.middleware] INFO: Enabled extensions:
['scrapy.extensions.corestats.CoreStats',
 'scrapy.extensions.telnet.TelnetConsole',
 'scrapy.extensions.logstats.LogStats']

Scrapy开启的一些下载中间件:

代码语言:javascript复制
2020-08-31 18:09:12 [scrapy.middleware] INFO: Enabled downloader middlewares:
['scrapy.downloadermiddlewares.httpauth.HttpAuthMiddleware',
 'scrapy.downloadermiddlewares.downloadtimeout.DownloadTimeoutMiddleware',
 'scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware',
 'scrapy.downloadermiddlewares.useragent.UserAgentMiddleware',
 'scrapy.downloadermiddlewares.retry.RetryMiddleware',
 'scrapy.downloadermiddlewares.redirect.MetaRefreshMiddleware',
 'scrapy.downloadermiddlewares.redirect.RedirectMiddleware',
 'scrapy.downloadermiddlewares.cookies.CookiesMiddleware',  # COOKIE中间件可以帮助我们自动保存cookie信息以及更新
 'scrapy_splash.SplashCookiesMiddleware',
 'scrapy_splash.SplashMiddleware',
 'scrapy.downloadermiddlewares.httpproxy.HttpProxyMiddleware',
 'scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware',
 'scrapy.downloadermiddlewares.stats.DownloaderStats']

Scrapy开启的一些爬虫中间件:

代码语言:javascript复制
2020-08-31 18:09:12 [scrapy.middleware] INFO: Enabled spider middlewares:
['scrapy.spidermiddlewares.httperror.HttpErrorMiddleware',
 'scrapy.spidermiddlewares.offsite.OffsiteMiddleware',
 'scrapy.spidermiddlewares.referer.RefererMiddleware',
 'scrapy.spidermiddlewares.urllength.UrlLengthMiddleware',
 'scrapy.spidermiddlewares.depth.DepthMiddleware']

Scrapy开启的数据处理pipeline列表:

代码语言:javascript复制
2020-08-31 18:09:12 [scrapy.middleware] INFO: Enabled item pipelines:
[]

Scrapy开始运行:

代码语言:javascript复制
2020-08-31 18:09:12 [scrapy.core.engine] INFO: Spider opened

Scrapy运行速度:

代码语言:javascript复制
2020-08-31 18:09:12 [scrapy.extensions.logstats] INFO: Crawled 0 pages (at 0 pages/min), scraped 0 items (at 0 items/min)

Scrapy控制台地址:

代码语言:javascript复制
2020-08-31 18:09:12 [scrapy.extensions.telnet] INFO: Telnet console listening on 127.0.0.1:6023

Scrapy经由本地哪个端口去访问哪个网页,已经请求访问过程中,对方服务器返回的状态码:

代码语言:javascript复制
2020-08-31 18:09:23 [scrapy.core.engine] DEBUG: Crawled (200) <GET https://www.baidu.com/s?wd=曼亚灿 via http://127.0.0.1:8050/render.html> (referer: None)

Scrapy结束运行:

代码语言:javascript复制
2020-08-31 18:09:23 [scrapy.core.engine] INFO: Closing spider (finished)

Scrapy状态信息:

代码语言:javascript复制
2020-08-31 18:09:23 [scrapy.statscollectors] INFO: Dumping Scrapy stats:
{'downloader/request_bytes': 523,  # 发送请求的内容大小为523字节
 'downloader/request_count': 1,  # 请求的数量为1
 'downloader/request_method_count/POST': 1,  # 发送的POST请求数量
 'downloader/response_bytes': 3745,  # 响应体大小为3745字节
 'downloader/response_count': 1,  # 响应数量
 'downloader/response_status_count/200': 1,  # 响应状态码个数
 'elapsed_time_seconds': 10.543638,  # 不懂
 'finish_reason': 'finished',  # 爬虫结束原因
 'finish_time': datetime.datetime(2020, 8, 31, 10, 9, 23, 367071),  # 爬虫结束时间
 'log_count/DEBUG': 1,  # DEBUG日志数量
 'log_count/INFO': 10,  # INFO日志数量
 'log_count/WARNING': 1,  # 警告日志数量
 'response_received_count': 1,  # 响应体数量
 'scheduler/dequeued': 2,  # 调度器中任务队列出队列的请求数
 'scheduler/dequeued/memory': 2,  # 调度器中任务队列使用的内存
 'scheduler/enqueued': 2, # 调度器中任务队列入队列的请求数
 'scheduler/enqueued/memory': 2,  # 调度器中任务队列入队列的请求数
 'splash/render.html/request_count': 1, 
 'splash/render.html/response_count/200': 1,
 'start_time': datetime.datetime(2020, 8, 31, 10, 9, 12, 823433)}  # 爬虫开始时间
2020-08-31 18:09:23 [scrapy.core.engine] INFO: Spider closed (finished)

----- END -----

0 人点赞