Scrapy overwrite json files instead of appending the file

后端 未结 6 1191
长情又很酷
长情又很酷 2020-12-28 10:57

Is there a way to overwrite the said file instead of appending it?

Example)

scrapy crawl myspider -o \"/path/to/json/my.json\" -t json    
scrapy cra         


        
6条回答
  •  我在风中等你
    2020-12-28 11:44

    Since, the accepted answer gave me problems with unvalid json, this could work:

    find "/path/to/json/" -name "my.json" -exec rm {} \; && scrapy crawl myspider -t json -o "/path/to/json/my.json"
    

提交回复
热议问题