列出来自scrapy shell的蜘蛛并运行单个蜘蛛

时间:2016-02-25 03:42:47

标签: web-scraping scrapy scrapy-spider scrapy-shell

我想从" scrapy项目文件夹"内部访问scrapy shell。在终端。并希望在我的项目中列出所有可用的蜘蛛。我也喜欢运行单个蜘蛛并玩响应。

一旦我进入scrapy shell,我就会得到以下对象:

[s] Available Scrapy objects:
[s]   crawler    <scrapy.crawler.Crawler object at 0x10b75cbd0>
[s]   item       {}
[s]   settings   <scrapy.settings.Settings object at 0x10cba1b90>
[s] Useful shortcuts:
[s]   shelp()           Shell help (print this help)
[s]   fetch(req_or_url) Fetch request (or URL) and update local objects
[s]   view(response)    View response in a browser

我最好的猜测是,我使用来自&#34; crawler&#34;的方法。对象列出可用的蜘蛛。但我没有运气。也请在列出之后让我知道如何运行蜘蛛。

1 个答案:

答案 0 :(得分:0)

  

列出我项目中所有可用的蜘蛛

使用crawler.spiders.list()

>>> for spider_name in crawler.spiders.list():
...     print(spider_name)
相关问题