问题描述:
由于在Scrapy项目中写了多个爬虫文件,并且使用了多个管道,但是在爬虫的过程中,出现了如下的报错信息:TypeError: 'NoneType' object is not subscriptable
问题分析:
之前在仅有一个管道的情况下,上述爬虫可以正常运行。因此考虑是管道优先级发生冲突导致爬虫错误:
问题解决:
因此通过将setting.py中爬虫对应的管道调整到优先级最大:(管道优先级,对应的数值越小,其优先级越大)
ITEM_PIPELINES = {
'spider.pipelines.SpiderPipeline': 500,
'spider.DuplicatePipeline.MysqlRemovePipeline': 300,
# 'spider.NewsDuplicatePipeline.NewsRemovePipeline': 600
}
文章来源
发表评论