Scrapy : storing the data

梦想的初衷 提交于 2019-12-20 12:34:41

问题


I'm new with python and scrapy. I'm tring to follow the Scrapy tutorial but I don't understand the logic of the storage step.

scrapy crawl spidername -o items.json -t json

scrapy crawl spidername --set FEED_URI=output.csv --set FEED_FORMAT=csv 

I dont understand the signification of :

  • -o
  • -t
  • --set

Thank you for your help


回答1:


You can view a list of available commands by typing scrapy crawl -h from within your project directory.

scrapy crawl spidername -o items.json -t json
  • -o specifies the output filename for dumped items (items.json)
  • -t specifies the format for dumping items (json)

scrapy crawl spidername --set FEED_URI=output.csv --set FEED_FORMAT=csv

  • --set is used to set/override a setting
  • FEED_URI is used to set the storage backend for the item dumping. In this instance it is set to "output.csv" which is using the local filesystem ie a simple output file.(for current example - output.csv)
  • FEED_FORMAT is used to set the serialization format for the (output) feed ie (for current example csv)

References (Scrapy documentation):

  1. Available tool commands (for the command line)
  2. Feed exports


来源:https://stackoverflow.com/questions/14073442/scrapy-storing-the-data

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!