Commit 54164b6d authored by Renán Sosa Guillen's avatar Renán Sosa Guillen

crawlers

parent d715b956
......@@ -11,6 +11,9 @@ from collections import OrderedDict
class JsonWriterPipeline(object):
def __init__(self, filename):
self.filename = filename
@classmethod
def from_crawler(cls, crawler):
# Here you get whatever value was passed through the "filename" command line parameter
......@@ -20,9 +23,6 @@ class JsonWriterPipeline(object):
# Instantiate the pipeline with the file name
return cls(filename)
def __init__(self, filename):
self.filename = filename
def open_spider(self, spider):
self.counter = 0
self.file = open(self.filename, 'w')
......
......@@ -2,7 +2,7 @@ import scrapy, re
"""
USO:
scrapy crawl noticias -t json --nolog -s filename=2018-03-22.json -a year=2017 -a month=3 -a day=22
scrapy crawl noticias --nolog -s filename=2018-03-22.json -a year=2017 -a month=3 -a day=22
"""
TAG_RE = re.compile(r'<[^>]+>')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment