一、settings.py的作用
自定义所有Scrapy组件的行为,包括核心,扩展,管道和蜘蛛本身。
详见官方文档https://doc.scrapy.org/en/latest/topics/settings.html
二、单个spider的配置
在Spider中加入custom_settings = {……}即可,爬虫启动后会优先使用这里的配置文件,如图1所示。
![13955140-9b909deee4dd9085.png](https://img-blog.csdnimg.cn/img_convert/c95f084f4637898b2620ad9bd6b4f691.png)
图1
三、setting.py的配置
1、DOWNLOAD_FAIL_ON_DATALOSS
![13955140-27a7936e014bb8ff.png](https://img-blog.csdnimg.cn/img_convert/478dd5fa74e527824b9714817fd98fbc.png)
图2
详见https://doc.scrapy.org/en/latest/topics/settings.html#std:setting-DOWNLOAD_FAIL_ON_DATALOSS