【发布时间】:2020-12-15 05:40:37
【问题描述】:
我想点击 django 网站上的一个按钮,我的蜘蛛应该开始抓取。我尝试 CrawlerProcess 但因为我使用不同的蜘蛛。我决定使用 CrawlerRunner。在第一次爬行之后一切都很好,但第二个过程给了我这个错误。
twisted.internet.error.ReactorNotRestartable
我尝试了这个主题的解决方案: ReactorNotRestartable error in while loop with scrapy
所以我尝试以下代码的解决方案,但爬虫永远不会停止,它说ReactorAlreadyRunning
def test():
configure_logging({'LOG_FORMAT': '%(levelname)s: %(message)s'})
runner = CrawlerRunner(get_project_settings())
d = runner.crawl(myspider.My_Spider)
d.addBoth(lambda _: reactor.stop(stop_after_crawl=False))
reactor.run()
这不是让我爬另一只蜘蛛。那么如何在我的网站上在不同时间运行爬取多个蜘蛛呢?
【问题讨论】: