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 finished
1条答案
按热度按时间tjvv9vkg1#
为什么不创建一个运行所有这些蜘蛛的脚本,并使用cron来调度它呢?
有关创建脚本的信息,请参阅文档。
下面是我的一个项目的示例片段: