我实际上是在做一个用刮擦来报废的项目,最后我得到了37蜘蛛。我想为这些蜘蛛做一个cron工作,但是首先我想把我的37只蜘蛛重新组合到一个主蜘蛛中。通过这样做,我将在主蜘蛛上完成一个单一的任务,而不是37个任务。你有什么想法吗?
发布于 2022-07-21 07:56:53
为什么不创建一个运行所有这些蜘蛛的脚本并使用cron来调度呢?
有关创建脚本,请参见文档。
下面是我的一个项目的一个示例片段:
def run_spider_crawler(self):
# .. other code here..
runner = CrawlerRunner()
@defer.inlineCallbacks
def crawl():
yield runner.crawl(spider1)
yield runner.crawl(spider2)
yield runner.crawl(spider3)
yield runner.crawl(spider4)
yield runner.crawl(spider5)
reactor.stop()
crawl()
reactor.run() # the script will block here until the last crawl call is finishedhttps://stackoverflow.com/questions/73053623
复制相似问题