前言
fetch指令是通过scrapy下载器对给定的一个url进行抓取,并将抓取结果进行输出
代码调试
进入fetch模块的run方法
参数校验,如果参数不是1个或者不是标准的url格式,则抛出用法错误:
if len(args) != 1 or not is_url(args[0]): raise UsageError()
def is_url(text): return text.partition("://
fetch指令是通过scrapy下载器对给定的一个url进行抓取,并将抓取结果进行输出
进入fetch模块的run方法
参数校验,如果参数不是1个或者不是标准的url格式,则抛出用法错误:
if len(args) != 1 or not is_url(args[0]): raise UsageError()
def is_url(text): return text.partition("://