请解释“ scrapy crawl”命令的第一个参数

时间:2020-05-09 13:14:44

标签: python scrapy

the scrapy tutorial中,我们看到项目命令crawl正在运行:

scrapy crawl quotes

我想知道参数quotes是因为earlier in the tutorial蜘蛛被命名为quotes_spider.py

1 个答案:

答案 0 :(得分:3)

class QuotesSpider(scrapy.Spider):
    name = "quotes"

在文档中列出了“抓取的引号”之后,下一行对此进行了说明。

此命令运行带有我们刚刚添加的名称引号的蜘蛛, 将会发送对quotes.toscrape.com域的一些请求

在上面显示的类中,蜘蛛的名称定义为name =“ quotes”。

您现在正在运行该蜘蛛类,因此参数是要运行的蜘蛛的名称。

相关问题