我是 Scrapy 的新手,正在尝试使用该框架。真正令人沮丧的是,当我运行“scrapy crawl(蜘蛛名称)”时,它会运行“蜘蛛”文件夹中的每一个蜘蛛。所以我要么必须等待所有运行的蜘蛛,要么注释掉所有蜘蛛,除了我正在使用的蜘蛛。这很烦人。我怎样才能让scrapy一次只运行一只蜘蛛?
最佳答案
您可以从脚本( https://scrapy.readthedocs.io/en/latest/topics/practices.html#run-from-script )运行scrapy,
例如:
import scrapy
from scrapy.crawler import CrawlerProcess
class YourSpider(scrapy.Spider):
# Your spider definition
process = CrawlerProcess()
process.crawl(YourSpider)
process.start()
关于python-3.x - Scrapy 一次运行所有蜘蛛。我只想一次运行一只蜘蛛。 Scrapy crawl <spider>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58573755/