有人可以解释一下两者之间的区别吗运行蜘蛛 and crawl命令?应该在什么情况下使用它们?
在命令中:
scrapy crawl [options] <spider>
<spider>
是项目名称(在settings.py中定义,如BOT_NAME
).
并在命令中:
scrapy runspider [options] <spider_file>
<spider_file>
是包含蜘蛛的文件的路径。
否则,选项是相同的:
Options
=======
--help, -h show this help message and exit
-a NAME=VALUE set spider argument (may be repeated)
--output=FILE, -o FILE dump scraped items into FILE (use - for stdout)
--output-format=FORMAT, -t FORMAT
format to use for dumping items with -o
Global Options
--------------
--logfile=FILE log file. if omitted stderr will be used
--loglevel=LEVEL, -L LEVEL
log level (default: DEBUG)
--nolog disable logging completely
--profile=FILE write python cProfile stats to FILE
--lsprof=FILE write lsprof profiling stats to FILE
--pidfile=FILE write process ID to FILE
--set=NAME=VALUE, -s NAME=VALUE
set/override setting (may be repeated)
--pdb enable pdb on failure
Since runspider
不依赖于BOT_NAME
参数,具体取决于您自定义抓取工具的方式,您可能会发现runspider
更灵活。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)