Running Scrapy from a script with file output

前端 未结 1 2125
情歌与酒
情歌与酒 2021-02-20 14:47

I\'m currently using Scrapy with the following command line arguments:

scrapy crawl my_spider -o data.json

However, I\'d prefer to \'save\' thi

1条回答
  •  南笙
    南笙 (楼主)
    2021-02-20 15:08

    You need to add the FEED_FORMAT and FEED_URI to your CrawlerProcess:

    process = CrawlerProcess({
    'USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)',
    'FEED_FORMAT': 'json',
    'FEED_URI': 'data.json'
    })
    

    0 讨论(0)
提交回复
热议问题