Scrapy創建項目

從網頁中刮取數據,首先需要創建Scrapy項目,用於編寫存儲代碼。要創建一個新的目錄下,運行下面的命令:

scrapy startproject first_scrapy

Scrapy創建項目
上面的代碼將創建一個名稱爲 first_scrapy 的一個目錄,它將包含以下結構:

first_scrapy/
scrapy.cfg # deploy configuration file
first_scrapy/ # project's Python module, you'll import your code from here
__init__.py
items.py # project items file
pipelines.py # project pipelines file
settings.py # project settings file
spiders/ # a directory where you'll later put your spiders
__init__.py