Answers for "how to run scrapy inside a nm"

0

how to run scrapy inside a nm

import scrapy
from scrapy.crawler import CrawlerProcess

class MySpider(scrapy.Spider):
    # Your spider definition
    ...

process = CrawlerProcess(settings={
    "FEEDS": {
        "items.json": {"format": "json"},
    },
})

process.crawl(MySpider)
process.start() # the script will block here until the crawling is finished
Posted by: Guest on May-10-2020

Python Answers by Framework

Browse Popular Code Answers by Language