scrapy已经支持python3,以下是在mac python3环境下使用记录,假设已经安装python3。
scrapy安装
- pip3 install scrapy
scrapy知识点
scrapy使用
- 创建项目
scrapy startproject tutorial
- 项目结构
- 定义Item
- 编写第一个爬虫(Spider)
- 爬取
scrapy crawl dmoz
scrapy抓取的数据保存到数据库
- 编写pipelines.py
- 设置setting.py
ITEM_PIPELINES = {'tutorial.pipelines.TutorialPipeline': 300,}