# pipelines.py import json class OliveYoungPipeline: def __init__(self): self.file = None def open_spider(self, spider): self.file = open('output.json', 'w') def close_spider(self, spider): self.file.close() def process_item(self, item, spider): line = json.dumps(item) + "\n" self.file.write(line) return item