LoginSignup
0
1

Scrapyの環境構築 備忘録

Posted at

Scrapy のインストール

pip intall scrapy

プロジェクトの作成(作業フォルダの作成込み)

scrapy startproject test_project /Users/user/ScrapyTest

上記のコマンドを入力すると
指定した場所に「test_project」という名前のプロジェクトが作成される

プロジェクトの中身

ScrapyTest
├── test_project
│   ├── __init__.py
│   ├── items.py
│   ├── middlewares.py
│   ├── pipelines.py
│   ├── settings.py
│   └── spiders
│          └── __init__.py
└── scrapy.cfg

Spiderの作成

scrapy genspider get_scraping_list URL 

scrapy genspider [スパイダー名] [URL]で目的のサイトを指定したspiderの作成を行う。
※指定するURLはhttps://と最後の/を消しておく必要がある。

コマンドを実行すると、spidersフォルダの下にspiderのファイル、get_scraping_list.pyが作成される

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1