python 爬虫框架 scrapy两种运行方法

runspider 爬虫文件名  和 crawl 爬虫名

四、runspider

运行蜘蛛除了使用:scrapy crawl XX之外,我们还能用:runspider,前者是基于项目运行,后者是基于文件运行,也就是说你按照scrapy的蜘蛛格式编写了一个py文件,那你不想创建项目,那你就可以使用runspider,比如你编写了一个:scrapyd_cn.py的蜘蛛,你要直接运行就是:

scrapy runspider scrapy_cn.py

猜你喜欢

转载自www.cnblogs.com/stillstep/p/11100098.html
今日推荐