Start scrapy from Flask route
问题 I want to build a crawler which takes the URL of a webpage to be scraped and returns the result back to a webpage. Right now I start scrapy from the terminal and store the response in a file. How can I start the crawler when some input is posted on to Flask, process, and return a response back? 回答1: You need to create a CrawlerProcess inside your Flask application and run the crawl programmatically. See the docs. import scrapy from scrapy.crawler import CrawlerProcess class MySpider(scrapy