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