Issue
I am usually calling my spider like this:
scrapy crawl Spider -o fileName -t json
and I got the correct data printed in the fileName
file as json formated.
Now I want to call my spider like this:
scrapy crawl Spider
my question
is there a way to print the output to a file without using the -o -t parameters?
Solution
Yes it can be done. add this to your settings
FEED_EXPORTERS = {
'jsonlines': 'scrapy.contrib.exporter.JsonLinesItemExporter',
}
FEED_FORMAT = 'jsonlines'
FEED_URI = "NAME_OF_FILE.json"
For reference
http://doc.scrapy.org/en/latest/topics/feed-exports.html
Answered By - Omair Shamshir
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.