scrapy顺序执行多个爬虫

428次阅读
没有评论
scrapy顺序执行多个爬虫

爬虫的时候写了一个main.py,里面使用下面代码: import sys import os from scrapy.cmdline import execute sys.path.append(os.path.dirname(os.path.abspath(__file__)))

execute(["scrapy", "crawl", "shanghaione"]) time.sleep(30) sys.path.append(os.path.dirname(os.path.abspath(__file__))) execute(["scrapy", "crawl", "shanghaitwo"])

本来以为可以运行,但是执行完第一句爬虫就停了。

于是有了我找到了新方法:

import sys import os import time from scrapy.cmdline import execute import os os.system("scrapy crawl shanghaione") time.sleep(300) os.system("scrapy crawl shanghaitwo")这样一来就可以了


神龙|纯净稳定代理IP免费测试>>>>>>>>天启|企业级代理IP免费测试>>>>>>>>IPIPGO|全球住宅代理IP免费测试

相关文章:

版权声明:Python教程2022-10-25发表,共计482字。
新手QQ群:570568346,欢迎进群讨论 Python51学习