我使用Scrapy Shell并使用以下命令:
scrapy shell https://www.off---white.com/en/DE/men/t/seasons/ss-2020
没有错误消息,但是响应对象的类型为None,我不知道为什么。我寻求帮助!
@ Toobi77
听起来像是防止未知设备报废。您应该将标头添加到对此网站的请求中。我尝试搜索文档,如果标题可以通过CLI添加,但事实并非如此。
只需打开刮y的外壳:
scrapy shell
然后手动发出请求:
>>> from scrapy import Request
>>> my_header = {
'Connection': 'keep-alive',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36',
# some other here
}
>>> req = Request('yoururl.com', headers=my_header)
>>> fetch(req)
这将使用当前请求更新您的shell。