settings.py 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # -*- coding: utf-8 -*-
  2. # Scrapy settings for image360 project
  3. #
  4. # For simplicity, this file contains only settings considered important or
  5. # commonly used. You can find more settings consulting the documentation:
  6. #
  7. # https://doc.scrapy.org/en/latest/topics/settings.html
  8. # https://doc.scrapy.org/en/latest/topics/downloader-middleware.html
  9. # https://doc.scrapy.org/en/latest/topics/spider-middleware.html
  10. BOT_NAME = 'image360'
  11. SPIDER_MODULES = ['image360.spiders']
  12. NEWSPIDER_MODULE = 'image360.spiders'
  13. MONGO_URL = 'mongodb://120.77.222.217:27017'
  14. MONGO_DB = 'image360'
  15. # Crawl responsibly by identifying yourself (and your website) on the user-agent
  16. USER_AGENT = 'Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19'
  17. # Obey robots.txt rules
  18. ROBOTSTXT_OBEY = False
  19. # Configure maximum concurrent requests performed by Scrapy (default: 16)
  20. CONCURRENT_REQUESTS = 2
  21. # Configure a delay for requests for the same website (default: 0)
  22. # See https://doc.scrapy.org/en/latest/topics/settings.html#download-delay
  23. # See also autothrottle settings and docs
  24. DOWNLOAD_DELAY = 3
  25. RANDOMIZE_DOWNLOAD_DELAY = True
  26. # The download delay setting will honor only one of:
  27. #CONCURRENT_REQUESTS_PER_DOMAIN = 16
  28. #CONCURRENT_REQUESTS_PER_IP = 16
  29. # Disable cookies (enabled by default)
  30. #COOKIES_ENABLED = False
  31. # Disable Telnet Console (enabled by default)
  32. #TELNETCONSOLE_ENABLED = False
  33. # Override the default request headers:
  34. #DEFAULT_REQUEST_HEADERS = {
  35. # 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  36. # 'Accept-Language': 'en',
  37. #}
  38. # Enable or disable spider middlewares
  39. # See https://doc.scrapy.org/en/latest/topics/spider-middleware.html
  40. #SPIDER_MIDDLEWARES = {
  41. # 'image360.middlewares.Image360SpiderMiddleware': 543,
  42. #}
  43. # Enable or disable downloader middlewares
  44. # See https://doc.scrapy.org/en/latest/topics/downloader-middleware.html
  45. DOWNLOADER_MIDDLEWARES = {
  46. # 'image360.middlewares.Image360DownloaderMiddleware': 543,
  47. 'image360.middlewares.TaobaoDownloaderMiddleWare': 500,
  48. }
  49. # Enable or disable extensions
  50. # See https://doc.scrapy.org/en/latest/topics/extensions.html
  51. #EXTENSIONS = {
  52. # 'scrapy.extensions.telnet.TelnetConsole': None,
  53. #}
  54. IMAGES_STORE = './resources/'
  55. # Configure item pipelines
  56. # See https://doc.scrapy.org/en/latest/topics/item-pipeline.html
  57. # ITEM_PIPELINES = {
  58. # 'image360.pipelines.SaveImagePipeline': 300,
  59. # 'image360.pipelines.SaveToMongoPipeline': 301,
  60. # }
  61. LOG_LEVEL = 'DEBUG'
  62. # Enable and configure the AutoThrottle extension (disabled by default)
  63. # See https://doc.scrapy.org/en/latest/topics/autothrottle.html
  64. #AUTOTHROTTLE_ENABLED = True
  65. # The initial download delay
  66. #AUTOTHROTTLE_START_DELAY = 5
  67. # The maximum download delay to be set in case of high latencies
  68. #AUTOTHROTTLE_MAX_DELAY = 60
  69. # The average number of requests Scrapy should be sending in parallel to
  70. # each remote server
  71. #AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
  72. # Enable showing throttling stats for every response received:
  73. #AUTOTHROTTLE_DEBUG = False
  74. # Enable and configure HTTP caching (disabled by default)
  75. # See https://doc.scrapy.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
  76. #HTTPCACHE_ENABLED = True
  77. #HTTPCACHE_EXPIRATION_SECS = 0
  78. #HTTPCACHE_DIR = 'httpcache'
  79. #HTTPCACHE_IGNORE_HTTP_CODES = []
  80. #HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'