scrapy爬虫-setting.py
生活随笔
收集整理的這篇文章主要介紹了
scrapy爬虫-setting.py
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
# Obey robots.txt rules
ROBOTSTXT_OBEY = False 不遵從網站的robots.txt法則
# See also autothrottle settings and docs
DOWNLOAD_DELAY = 3 每次下載延遲3秒,防止造成網站攻擊
# Override the default request headers:
DEFAULT_REQUEST_HEADERS = {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 設置默認請求頭
'Accept-Language': 'en',
} # Configure item pipelines
# See https://doc.scrapy.org/en/latest/topics/item-pipeline.html
ITEM_PIPELINES = {
'xiaoshuo.pipelines.XiaoshuoPipeline': 300, 數字越小,優先級越高
}
FEED_EXPORT_ENCODING ='utf-8' 文件亂碼設置
ROBOTSTXT_OBEY = False 不遵從網站的robots.txt法則
# See also autothrottle settings and docs
DOWNLOAD_DELAY = 3 每次下載延遲3秒,防止造成網站攻擊
# Override the default request headers:
DEFAULT_REQUEST_HEADERS = {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 設置默認請求頭
'Accept-Language': 'en',
} # Configure item pipelines
# See https://doc.scrapy.org/en/latest/topics/item-pipeline.html
ITEM_PIPELINES = {
'xiaoshuo.pipelines.XiaoshuoPipeline': 300, 數字越小,優先級越高
}
FEED_EXPORT_ENCODING ='utf-8' 文件亂碼設置
轉載于:https://www.cnblogs.com/ShadowXie/p/9699800.html
總結
以上是生活随笔為你收集整理的scrapy爬虫-setting.py的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 梦到好多蟑螂是什么意思
- 下一篇: Oracle快速备份表数据