Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save Scrapy crawl Command output

Tags:

python

scrapy

I am trying to save the output of the scrapy crawl command I have tried scrapy crawl someSpider -o some.json -t json >> some.text But it doesn't worked ...can some body tell me how i can save output to a text file....I mean the logs and information printed by scrapy...

like image 789
Vaibhav Jain Avatar asked May 20 '13 13:05

Vaibhav Jain


People also ask

How do you extract data from scrapy?

While working with Scrapy, one needs to create scrapy project. In Scrapy, always try to create one spider which helps to fetch data, so to create one, move to spider folder and create one python file over there. Create one spider with name gfgfetch.py python file. Move to the spider folder and create gfgfetch.py .

How do you leave scrapy shells?

Finally you hit Ctrl-D (or Ctrl-Z in Windows) to exit the shell and resume the crawling: >>> ^D 2014-01-23 17:50:03-0400 [scrapy.

How do you use scrapy in CMD?

Using the scrapy tool You can start by running the Scrapy tool with no arguments and it will print some usage help and the available commands: Scrapy X.Y - no active project Usage: scrapy <command> [options] [args] Available commands: crawl Run a spider fetch Fetch a URL using the Scrapy downloader [...]

What is scrapy CFG file?

The scrapy.cfg file is a project root directory, which includes the project name with the project settings. For instance − [settings] default = [name of the project].settings [deploy] #url = http://localhost:6800/ project = [name of the project]


1 Answers

You can add these lines to your settings.py:

LOG_STDOUT = True
LOG_FILE = '/tmp/scrapy_output.txt'

And then start your crawl normally:

scrapy crawl someSpider
like image 83
claire_ Avatar answered Sep 23 '22 06:09

claire_