- - mac or linux:pip install scrapy
- - windows:
- - pip install wheel
- - 下载twisted,下载地址为http://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted
- - 安装twisted:pip install Twisted‑17.1.0‑cp36‑cp36m‑win_amd64.whl
-
- - pip install pywin32
- - pip install scrapy
- 测试:在终端里录入scrapy指令,没有报错即表示安装成功!
-
-
- - cd xxxPro
- - 在spiders子目录中创建一个爬虫文件
- - scrapy genspider spiderName www.xxx.com
- - 执行工程:
- - scrapy crawl spiderName
-
- - 创建一个工程:scrapy startproject xxxPro
- - cd xxxPro
- - 在spiders子目录中创建一个爬虫文件
- - scrapy genspider spiderName www.xxx.com
- - 执行工程:
- - scrapy crawl spiderName
-
- scrapy startproject firsBlood
-
-
- cd firsBlood
-
- scrapy genspider first www.xxx.com #first爬虫文件名称随便写
-
- # - scrapy crawl spiderName #spiderName 是first
-
- scrapy crawl first
- scrapy crawl first --nolog #不建议
-
- #把settings。py修改如下
- # Obey robots.txt rules
- ROBOTSTXT_OBEY = False #我们修改
-
- #显示指定类型的日志信息
- LOG_LEVEL = 'ERROR'
-
-
只输出错误日志