【发布时间】:2020-06-06 17:03:39
【问题描述】:
我对 Scrapy 很陌生,并且有这个要求,我需要将 Scrapy 请求的响应返回到调用它的函数。 目前我通过使用scrapy-inline-requests 库只找到了一种解决方案
在 Scrapy 中是否有任何原生方式?
举例
def parse(self, response):
item = spiderItem()
# Extract some items here from this response using CSS Selectors
# ....
# ....
# Now extract URL from the response
new_url = response.css("div.urls::text").get()
yield scrapy.Request(new_url, callback=self.parse_more)
# Receive the response from parse_more() here. Is it possible?
resp =
def parse_more(self, response):
# This function should be able to return the response back to the parse() function for further processing.
类似于我们在 requests 库中可以做的事情
response = requests.get(url)
【问题讨论】:
标签: web-scraping scrapy