【发布时间】:2020-01-20 14:41:08
【问题描述】:
我使用 inspect_response() 函数运行我的 shell。我想退出 Scrapy shell,所以我使用 Ctrl-D(或 Windows 中的 Ctrl-Z)来执行此操作。但是,我不能完全做到这一点,因为 Spider 会抓取连续的 URL,因此会执行新的 Scrapy shell。您知道在不关闭终端的情况下执行此操作的任何快捷方式吗?
def parse_volumes(self, response):
all_issues = response.css('h6 a')
for issue in all_issues:
issue_url = issue.css('::attr(href)').get()
yield scrapy.Request(issue_url, callback = self.parse_issue)
def parse_issue(self, response):
for article in response.css('tr'):
access = article.css('.accessIconContainer div').xpath('./img/@alt').get()
inspect_response(response, self)
【问题讨论】:
-
尝试两次
ctrl+c终止并尝试ctrl+z+Enter退出。
标签: python scrapy scrapy-shell