开始第一个scrapy爬虫项目

2018/05/04

开始第一个scrapy爬虫项目

本文假设在你已安装好python和scrapy。

第一步,进入shell:

C:\>scrapy startproject spider

输出结果:

C:\>scrapy startproject spider
New Scrapy project 'spider', using template directory 'c:\\program files\\python36\\lib\\site-packages\\scrapy\\templates\\project', created in:
    C:\spider

You can start your first spider with:
    cd spider
    scrapy genspider example example.com

创建成功,目录结构:

C:\>tree /f spider
卷 Windows 10 的文件夹 PATH 列表
卷序列号为 00000028 02DE:BFF0
C:\SPIDER
│  scrapy.cfg
│
└─spider
    │  items.py
    │  middlewares.py
    │  pipelines.py
    │  settings.py
    │  __init__.py
    │
    ├─spiders
    │  │  __init__.py
    │  │
    │  └─__pycache__
    └─__pycache__


Post Directory