[ scrapy分布式爬虫基础 ]


scrapy基本使用

  1. 安装
pip install scrapy
  1. 创建项目
scrapy startporject 项目名
  1. 创建爬虫文件
cd 项目名 # 进入项目文件夹
scrapy genspider chf www.xxxx.com # chf是爬虫文件名, www.xxx.com是要爬的网站域名
  1. 运行
    • 保存为jsn文件
    • 保存为csv文件
scrapy crawl 爬虫文件名 -o wangzhan.json
或
scrapy crawl 爬虫文件名 -o wangzhan.csv