settings.py

 1 # -*- coding: utf-8 -*-
 2 
 3 # Scrapy settings for smzdm project
 4 #
 5 # For simplicity, this file contains only settings considered important or
 6 # commonly used. You can find more settings consulting the documentation:
 7 #
 8 #     https://doc.scrapy.org/en/latest/topics/settings.html
 9 #     https://doc.scrapy.org/en/latest/topics/downloader-middleware.html
10 #     https://doc.scrapy.org/en/latest/topics/spider-middleware.html
11 
12 BOT_NAME = '文件名'
13 
14 SPIDER_MODULES = ['文件名.spiders']
15 NEWSPIDER_MODULE = '文件名.spiders'
16 
17 
18 # Crawl responsibly by identifying yourself (and your website) on the user-agent
19 #USER_AGENT = 'smzdm (+http://www.yourdomain.com)'
20 
21 # Obey robots.txt rules
22 ROBOTSTXT_OBEY = True
23 
24 # Configure maximum concurrent requests performed by Scrapy (default: 16)
25 #CONCURRENT_REQUESTS = 32
26 
27 # Configure a delay for requests for the same website (default: 0)
28 # See https://doc.scrapy.org/en/latest/topics/settings.html#download-delay
29 # See also autothrottle settings and docs
30 #DOWNLOAD_DELAY = 3
31 # The download delay setting will honor only one of:
32 #CONCURRENT_REQUESTS_PER_DOMAIN = 16
33 #CONCURRENT_REQUESTS_PER_IP = 16
34 
35 # Disable cookies (enabled by default)
36 #COOKIES_ENABLED = False
37 
38 # Disable Telnet Console (enabled by default)
39 #TELNETCONSOLE_ENABLED = False
40 
41 # Override the default request headers:
42 #DEFAULT_REQUEST_HEADERS = {
43 #   'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
44 #   'Accept-Language': 'en',
45 #}
46 
47 # Enable or disable spider middlewares
48 # See https://doc.scrapy.org/en/latest/topics/spider-middleware.html
49 #SPIDER_MIDDLEWARES = {
50 #    'smzdm.middlewares.SmzdmSpiderMiddleware': 543,
51 #}
52 MONGO_URI = 'localhost'
53 MONGO_DATABASE = '文件名'
54 # Enable or disable downloader middlewares
55 # See https://doc.scrapy.org/en/latest/topics/downloader-middleware.html
56 #DOWNLOADER_MIDDLEWARES = {
57 #    'smzdm.middlewares.SmzdmDownloaderMiddleware': 543,
58 #}
59 
60 # Enable or disable extensions
61 # See https://doc.scrapy.org/en/latest/topics/extensions.html
62 #EXTENSIONS = {
63 #    'scrapy.extensions.telnet.TelnetConsole': None,
64 #}
65 
66 # Configure item pipelines
67 # See https://doc.scrapy.org/en/latest/topics/item-pipeline.html
68 ITEM_PIPELINES = {
69    # 'smzdm.pipelines.SmzdmPipeline': 300,
70    'smzdm.pipelines.MogoPipleline': 400
71 }
72 
73 # Enable and configure the AutoThrottle extension (disabled by default)
74 # See https://doc.scrapy.org/en/latest/topics/autothrottle.html
75 #AUTOTHROTTLE_ENABLED = True
76 # The initial download delay
77 #AUTOTHROTTLE_START_DELAY = 5
78 # The maximum download delay to be set in case of high latencies
79 #AUTOTHROTTLE_MAX_DELAY = 60
80 # The average number of requests Scrapy should be sending in parallel to
81 # each remote server
82 #AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
83 # Enable showing throttling stats for every response received:
84 #AUTOTHROTTLE_DEBUG = False
85 
86 # Enable and configure HTTP caching (disabled by default)
87 # See https://doc.scrapy.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
88 #HTTPCACHE_ENABLED = True
89 #HTTPCACHE_EXPIRATION_SECS = 0
90 #HTTPCACHE_DIR = 'httpcache'
91 #HTTPCACHE_IGNORE_HTTP_CODES = []
92 #HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
93 FEED_EXPORT_ENCODING = 'utf-8'
94 LOG_LEVEL = 'ERROR'

猜你喜欢

转载自www.cnblogs.com/jswrui/p/10470064.html