settings.py 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. # Scrapy settings for wangdu_spider project
  2. #
  3. # For simplicity, this file contains only settings considered important or
  4. # commonly used. You can find more settings consulting the documentation:
  5. #
  6. # https://docs.scrapy.org/en/latest/topics/settings.html
  7. # https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
  8. # https://docs.scrapy.org/en/latest/topics/spider-middleware.html
  9. BOT_NAME = 'content_spider'
  10. SPIDER_MODULES = ['content_spider.spiders']
  11. NEWSPIDER_MODULE = 'content_spider.spiders'
  12. # Crawl responsibly by identifying yourself (and your website) on the user-agent
  13. #USER_AGENT = 'content_spider (+http://www.yourdomain.com)'
  14. # Obey robots.txt rules
  15. ROBOTSTXT_OBEY = False
  16. # Configure maximum concurrent requests performed by Scrapy (default: 16)
  17. # CONCURRENT_REQUESTS = 32
  18. # Configure a delay for requests for the same website (default: 0)
  19. # See https://docs.scrapy.org/en/latest/topics/settings.html#download-delay
  20. # See also autothrottle settings and docs
  21. # DOWNLOAD_DELAY = 3
  22. # The download delay setting will honor only one of:
  23. # CONCURRENT_REQUESTS_PER_DOMAIN = 16
  24. # CONCURRENT_REQUESTS_PER_IP = 16
  25. # Disable cookies (enabled by default)
  26. COOKIES_ENABLED = False
  27. # Disable Telnet Console (enabled by default)
  28. # TELNETCONSOLE_ENABLED = False
  29. # Override the default request headers:
  30. DEFAULT_REQUEST_HEADERS = {
  31. 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  32. 'Accept-Language': 'zh-CN,zh;q=0.8',
  33. 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36'
  34. }
  35. # Enable or disable spider middlewares
  36. # See https://docs.scrapy.org/en/latest/topics/spider-middleware.html
  37. # SPIDER_MIDDLEWARES = {
  38. # 'content_spider.middlewares.WangduSpiderSpiderMiddleware': 543,
  39. # }
  40. # Enable or disable downloader middlewares
  41. # See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
  42. # DOWNLOADER_MIDDLEWARES = {
  43. # 'content_spider.middlewares.ContentSpiderDownloaderMiddleware': 543,
  44. # }
  45. # Enable or disable extensions
  46. # See https://docs.scrapy.org/en/latest/topics/extensions.html
  47. # EXTENSIONS = {
  48. # 'scrapy.extensions.telnet.TelnetConsole': None,
  49. # }
  50. # Configure item pipelines
  51. # See https://docs.scrapy.org/en/latest/topics/item-pipeline.html
  52. ITEM_PIPELINES = {
  53. 'content_spider.pipelines.ChapterItemPipeline': 300,
  54. }
  55. # Enable and configure the AutoThrottle extension (disabled by default)
  56. # See https://docs.scrapy.org/en/latest/topics/autothrottle.html
  57. # AUTOTHROTTLE_ENABLED = True
  58. # The initial download delay
  59. # AUTOTHROTTLE_START_DELAY = 5
  60. # The maximum download delay to be set in case of high latencies
  61. # AUTOTHROTTLE_MAX_DELAY = 60
  62. # The average number of requests Scrapy should be sending in parallel to
  63. # each remote server
  64. # AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
  65. # Enable showing throttling stats for every response received:
  66. # AUTOTHROTTLE_DEBUG = False
  67. # Enable and configure HTTP caching (disabled by default)
  68. # See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
  69. # HTTPCACHE_ENABLED = True
  70. # HTTPCACHE_EXPIRATION_SECS = 0
  71. # HTTPCACHE_DIR = 'httpcache'
  72. # HTTPCACHE_IGNORE_HTTP_CODES = []
  73. # HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
  74. MYSQL_HOST = '121.37.176.94'
  75. MYSQL_USER = 'otestzy_wzq'
  76. MYSQL_PWD = 'zy_wzq2023%2023'
  77. MYSQL_DB = 'test_zy_book_content'
  78. # MYSQL_HOST = 'rm-bp1z1dto3n2rdb02f.mysql.rds.aliyuncs.com'
  79. # MYSQL_USER = 'yueduyun'
  80. # MYSQL_PWD = "yueduyun2017#Ydy"
  81. # MYSQL_DB = 'book_club'