Scrapyのコマンドメモ
手軽にスクレイピングができるpythonのライブラリ、Scrapyの基本コマンドについてメモ。
genspider
スパイダーを作成
$ scrapy genspider -t basic newspider01 example.com Created spider 'newspider01' using template 'basic' in module: scrapy_sample.spiders.newspider01
作成したnewspider01はhttp://www.example.comをクロールする。
以下のコマンドで、テンプレートを確認できる。
$ scrapy genspider -l
basic
crawl
csvfeed
xmlfeed
crawl
指定したスパイダーでクローリングする。
$ scrapy crawl newspider01
list
作成したスパイダーを一覧表示する。
$ scrapy list newspider01 newspider02
shell
pythonの対話環境で、指定したURLを解析する。
$ scrapy shell http://google.com
詳しくは公式のドキュメントへ
Scrapy 0.19 documentation — Scrapy 0.19.0 documentation