【发布时间】:2012-03-29 16:21:29
【问题描述】:
我想用scrapy来抓取网页。有没有办法从终端本身传递起始 URL?
documentation 中给出了蜘蛛的名称或 URL 都可以给出,但是当我给出 url 时它会抛出错误:
//我的蜘蛛名称是示例,但我给出的是 url 而不是我的蜘蛛名称(如果我给出蜘蛛名称,它可以正常工作)。
scrapy crawl example.com
错误:
文件 "/usr/local/lib/python2.7/dist-packages/Scrapy-0.14.1-py2.7.egg/scrapy/spidermanager.py", 第 43 行,在创建中 raise KeyError("Spider not found: %s" % spider_name) KeyError: 'Spider not found: example.com'
我怎样才能让scrapy在终端给出的url上使用我的蜘蛛??
【问题讨论】:
-
是否将 example.com 添加到您的蜘蛛的 allowed_domains 中?
-
是的 example.com 已添加到 allowed_domains。我真正想要的是从命令行给出 start_url 。我该怎么做?
标签: scrapy web-crawler