1import scrapy
2from scrapy.crawler import CrawlerProcess
3
4class MySpider(scrapy.Spider):
5 # Your spider definition
6 ...
7
8process = CrawlerProcess(settings={
9 "FEEDS": {
10 "items.json": {"format": "json"},
11 },
12})
13
14process.crawl(MySpider)
15process.start() # the script will block here until the crawling is finished
16