Scrapy同时启动多个爬虫

Scrapy同时启动多个爬虫,第1张

概述1. 在项目文件夹中新建一个commands文件夹 2. 在command的文件夹中新建一个文件 crawlall.py 3.在crawlall.py 中写一个command类,该类继承 scrapy.commands from scrapy.commands import ScrapyCommandclass Command(ScrapyCommand): requires

1. 在项目文件夹中新建一个commands文件夹

2. 在command的文件夹中新建一个文件 crawlall.py

3.在crawlall.py 中写一个command类,该类继承 scrapy.commands

from scrapy.commands import Scrapycommandclass Command(Scrapycommand):    requires_project = True    def Syntax(self):        return [options]    def short_desc(self):        return Runs all of the spIDers    def run(self,args,opts):        spIDer_List = self.crawler_process.spIDers.List()        for name in spIDer_List:            self.crawler_process.crawl(name,**opts.__dict__)        self.crawler_process.start()
总结

以上是内存溢出为你收集整理的Scrapy同时启动多个爬虫全部内容,希望文章能够帮你解决Scrapy同时启动多个爬虫所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/1191705.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-03
下一篇2022-06-03

发表评论

登录后才能评论

评论列表(0条)

    保存