scrapy
2025年9月5日小于 1 分钟
scrapy genspider mydomain mydomain.com
log
scrapy crawl myspider -s LOG_LEVEL=INFO -s LOG_FILE=scrapy.log
self.log(message)等同于 self.logger.debug(message)
self.log(f"开始爬取 {stock_type['name']}", level=log.INFO)
中间件
- 如果想禁止内置的中间件,就必须在项目的SPIDER_MIDDLEWARES设置中定义该中间件,并将其值赋为None