1. # -*- coding: utf-8 -*-
  2.  
  3. # Scrapy settings for JobBole 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. # http://doc.scrapy.org/en/latest/topics/settings.html
  9. # http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
  10. # http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
  11.  
  12. BOT_NAME = 'JobBole'
  13.  
  14. SPIDER_MODULES = ['JobBole.spiders']
  15. NEWSPIDER_MODULE = 'JobBole.spiders'
  16.  
  17. # Crawl responsibly by identifying yourself (and your website) on the user-agent
  18. #USER_AGENT = 'JobBole (+http://www.yourdomain.com)'
  19.  
  20. # 是否遵守爬虫协议,默认遵守,改成Fals,不遵守
  21. ROBOTSTXT_OBEY = False
  22.  
  23. # Configure maximum concurrent requests performed by Scrapy (default: 16)
  24. #CONCURRENT_REQUESTS = 32
  25.  
  26. # Configure a delay for requests for the same website (default: 0)
  27. # See http://scrapy.readthedocs.org/en/latest/topics/settings.html#download-delay
  28. # See also autothrottle settings and docs
  29. #DOWNLOAD_DELAY = 3
  30. # The download delay setting will honor only one of:
  31. #CONCURRENT_REQUESTS_PER_DOMAIN = 16
  32. #CONCURRENT_REQUESTS_PER_IP = 16
  33.  
  34. # Disable cookies (enabled by default)
  35. #COOKIES_ENABLED = False
  36.  
  37. # Disable Telnet Console (enabled by default)
  38. #TELNETCONSOLE_ENABLED = False
  39.  
  40. # Override the default request headers:
  41. #DEFAULT_REQUEST_HEADERS = {
  42. # 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  43. # 'Accept-Language': 'en',
  44. #}
  45.  
  46. # Enable or disable spider middlewares
  47. # See http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
  48.  
  49. # SPIDER_MIDDLEWARES = {
  50. # 'JobBole.middlewares.JobboleSpiderMiddleware': 543,
  51. # }
  52.  
  53. # 图片下载配置
  54. import os
  55. IMAGES_URLS_FIELD = 'img_url'
  56. base_dir = os.path.abspath(os.path.dirname(__file__))
  57. IMAGES_STORE = os.path.join(base_dir, 'images')
  58.  
  59. # Enable or disable downloader middlewares
  60. # See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
  61. # DOWNLOADER_MIDDLEWARES = {
  62. # 'JobBole.middlewares.MyCustomDownloaderMiddleware': 543,
  63. # }
  64.  
  65. # Enable or disable extensions
  66. # See http://scrapy.readthedocs.org/en/latest/topics/extensions.html
  67. #EXTENSIONS = {
  68. # 'scrapy.extensions.telnet.TelnetConsole': None,
  69. #}
  70.  
  71. # Configure item pipelines
  72. # See http://scrapy.readthedocs.org/en/latest/topics/item-pipeline.html
  73.  
  74. ITEM_PIPELINES = {
  75. 'JobBole.pipelines.JobboleImagerPipeline': 1,
  76. 'JobBole.pipelines.SqlSave': 2,
  77. }
  78.  
  79. # 数据库基本配置
  80. SQL_DBA= {
  81. 'host': 'localhost',
  82. 'db': 'jobole',
  83. 'user': 'root',
  84. 'password': 'password',
  85. 'charset': 'utf-8',
  86. 'use_unicode': True
  87. }
  88.  
  89. # Enable and configure the AutoThrottle extension (disabled by default)
  90. # See http://doc.scrapy.org/en/latest/topics/autothrottle.html
  91. #AUTOTHROTTLE_ENABLED = True
  92. # The initial download delay
  93. #AUTOTHROTTLE_START_DELAY = 5
  94. # The maximum download delay to be set in case of high latencies
  95. #AUTOTHROTTLE_MAX_DELAY = 60
  96. # The average number of requests Scrapy should be sending in parallel to
  97. # each remote server
  98. #AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
  99. # Enable showing throttling stats for every response received:
  100. #AUTOTHROTTLE_DEBUG = False
  101.  
  102. # Enable and configure HTTP caching (disabled by default)
  103. # See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
  104. #HTTPCACHE_ENABLED = True
  105. #HTTPCACHE_EXPIRATION_SECS = 0
  106. #HTTPCACHE_DIR = 'httpcache'
  107. #HTTPCACHE_IGNORE_HTTP_CODES = []
  108. #HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'

  

爬取知名社区技术文章_setting_5的更多相关文章

  1. 爬取知名社区技术文章_items_2

    item中定义获取的字段和原始数据进行处理并合法化数据 #!/usr/bin/python3 # -*- coding: utf-8 -*- import scrapy import hashlib ...

  2. 爬取知名社区技术文章_pipelines_4

    获取字段的存储处理和获取普通的路径 #!/usr/bin/python3 # -*- coding: utf-8 -*- import pymysql import gevent import pym ...

  3. 爬取知名社区技术文章_article_3

    爬虫主逻辑处理,获取字段,获取主url和子url #!/usr/bin/python3 # -*- coding: utf-8 -*- import scrapy from scrapy.http i ...

  4. 第4章 scrapy爬取知名技术文章网站(2)

    4-8~9 编写spider爬取jobbole的所有文章 # -*- coding: utf-8 -*- import re import scrapy import datetime from sc ...

  5. 爬取博主所有文章并保存到本地(.txt版)--python3.6

    闲话: 一位前辈告诉我大学期间要好好维护自己的博客,在博客园发布很好,但是自己最好也保留一个备份. 正好最近在学习python,刚刚从py2转到py3,还有点不是很习惯,正想着多练习,于是萌生了这个想 ...

  6. 爬虫实战——Scrapy爬取伯乐在线所有文章

    Scrapy简单介绍及爬取伯乐在线所有文章 一.简说安装相关环境及依赖包 1.安装Python(2或3都行,我这里用的是3) 2.虚拟环境搭建: 依赖包:virtualenv,virtualenvwr ...

  7. Node爬取简书首页文章

    Node爬取简书首页文章 博主刚学node,打算写个爬虫练练手,这次的爬虫目标是简书的首页文章 流程分析 使用superagent发送http请求到服务端,获取HTML文本 用cheerio解析获得的 ...

  8. 使用Python爬取微信公众号文章并保存为PDF文件(解决图片不显示的问题)

    前言 第一次写博客,主要内容是爬取微信公众号的文章,将文章以PDF格式保存在本地. 爬取微信公众号文章(使用wechatsogou) 1.安装 pip install wechatsogou --up ...

  9. Python3.6+Scrapy爬取知名技术文章网站

    爬取分析 伯乐在线已经提供了所有文章的接口,还有下一页的接口,所有我们可以直接爬取一页,再翻页爬. 环境搭建 Windows下安装Python: http://www.cnblogs.com/0bug ...

随机推荐

  1. 第五章:大数据 の HBase 进阶

    本课主题 HBase 读写数据的流程 HBase 性能优化和最住实践 HBase 管理和集群操作 HBase 备份和复制 引言 前一篇 HBase 基础 (HBase 基础) 简单介绍了NoSQL是什 ...

  2. JDK1.8中的线程池

    上面这段代码一直在用,面试的时候也经常被问到,却从未深究过,不知道线程池到底是怎么回事,今天看看源代码,一探其究竟 线程池主要控制的状态是ctl,它是一个原子的整数,其包含两个概念字段: worker ...

  3. sql基本知识

    1.类型转换 用convert,cast float转换出现科学计数字母的问题:可以先转成numeric再转成varchar declare @fl float set @fl=1234567.123 ...

  4. Go同步和异步执行多个任务封装

    同步执行类RunnerAsync 支持返回超时检测,系统中断检测 错误常量定义 //超时错误 var ErrTimeout = errors.New("received timeout&qu ...

  5. 2017 年的 人生 hard 模式终于结束了,2018年回归初心

    2017 年的 人生 hard 模式终于结束了,2018年回归初心 2017年对于我个人来讲, 毫不夸张的说 算是近十年来除了高考那一年,最最惊心动魄的一年了,没有之一. >>>开篇 ...

  6. 前端工程化webpack(一)

    webpack 的基本用法   1.app.js 引入模块 import moduleLog from './module.js' //引入moduleLog从./module.js 2.module ...

  7. 一个InnoDB性能超过Oracle的调优Case

    年前抽空到兄弟公司支援了一下Oracle迁移MySQL的测试,本想把MySQL调优到接近Oracle的性能即可,但经过 @何_登成 @淘宝丁奇 @淘宝褚霸 @淘伯松 诸位大牛的指导和帮助(排名不分先后 ...

  8. 记一个http-proxy-middleware 代理访问nginx映射的接口不通过的问题(connection close)

    工作过程中遇见一个问题,使用Vue-cli 搭建了一个工程,由于跨域的问题 使用了自带的dev-server Express Server(A后台) http-proxy-middleware 去访问 ...

  9. myeclipse 扩展内存大小

    工具中修改设置Default VM ArgumentsWindows-> Preferences->Java->Installed JREs,点击右侧的jdk,然后点击"E ...

  10. css的学习笔记

    CSS3有哪些新特性? 1. CSS3实现圆角(border-radius),阴影(box-shadow), 2. 对文字加特效(text-shadow.),线性渐变(gradient),旋转(tra ...