爬虫類総括(三)--cloud scrapy


比較的面白いものを見つけて、scrapinghub、cloud scrapyを遊んでみました.それは無料だからです.最大の利点は爬虫類を可視化できることです.ここでは、使い方を簡単に記録します.
アカウントの登録&scrapy cloud projectの新規作成
scrapyinghubの公式サイトでアカウントを登録してログインした後にcreate project、新しいプロジェクトの下で、Code&Deploysを見て、API keyとProject IDを見つけます
Deploy your project
$ pip install shub

loginとAPI keyの入力
$ shub login
Enter your API key from https://dash.scrapinghub.com/account/apikey
API key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Validating API key...
API key is OK, you are logged in now.

deploy Project IDを入力
$ shub deploy ProjectID
Packing version ed6b3b8-master
Deploying to Scrapy Cloud project "76180"
{"status": "ok", "project": 76180, "version": "ed6b3b8-master", "spiders": 1}
Run your spiders at: https://dash.scrapinghub.com/p/76180/

Schedule your spider
自分のプロジェクトパネルの下でrun spiderを選択して爬虫類を開くか、コマンドラインで開くこともできます.
shub schedule Zhidao
Spider Zhidao scheduled, job ID: 76153/2/2
Watch the log on the command line:
    shub log -f 2/2
or print items as they are being scraped:
    shub items -f 2/2
or watch it running in Scrapinghub's web interface:
    https://dash.scrapinghub.com/p/76153/job/2/3

最新のロゴとitems JOBIDフォーマットを見てください:2/2,2/1...
shub log JOBID
shub items JOBID

またはDashboardが結果を表示する
Dashbordにより、crawler jobの状況、リクエスト数、キャプチャされたite m数、log、error情報、実行時間などをリアルタイムで監視することもでき、一目瞭然です.
Save items
curl -u APIkey: http://storage.scrapinghub.com/items/76153/2/2 > items.json 

ぶんぷしき爬虫類
cloud scrapyも分布式爬虫類の選択を提供しており、もちろん有料です.
Crawlera
強力なCrawleraはban防止のメカニズムを提供し、ip、user-agent、cookieなどの設置を通じて爬虫類の禁止を防止し、詳細はbillingを参照
完全なコード
参照リンク:http://doc.scrapinghub.com/scrapy-cloud.html#deploying-a-scrapy-spider
原文住所:http://www.shuang0420.com/2016/06/15/%E7%88%AC%E8%99%AB%E6%80%BB%E7%BB%93-%E4%B8%89-scrapinghub/