[英]Get response from the request in Scrapy
有沒有辦法可以從我的解析方法返回響應?
我試過這個:
yield {
'content': scrapy.Request(url, callback=self.parse_page),
}
但回應是:
'content': <GET https://example.com>
我希望結果是這樣的:
'content': 'some text'
因為 parse_page() 方法是從一些 css 選擇器中解析的。
謝謝你,對不起我的英語不好。
它是 object:
scrapy.Request(url, callback=self.parse_page)
參數體,這就是你需要的:
response = scrapy.Request(url, callback=self.parse_page)
content = response.body
yield {
'content': content,
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.