我想点击django网站上的一个按钮,我的蜘蛛应该开始抓取。我尝试爬虫程序,但因为我使用不同的蜘蛛。我决定使用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()
它不会让我再爬一只蜘蛛。那么,如何在我的网站上的不同时间运行多个爬行器呢
这个话题帮助我解决了这个问题。我只需要安装钩针并在代码顶部添加setup()
Solution link
相关问题 更多 >
编程相关推荐