Scrapy 视图返回一个空白页 [英] Scrapy view returns a blank page
本文介绍了Scrapy 视图返回一个空白页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是 Scrapy 的新手,我只是想抓取 http://www.diseasesdatabase.com/一个>
I'm new at Scrapy and I was just trying to scrape http://www.diseasesdatabase.com/
当我输入 scrapy view http://www.diseasesdatabase.com/
时,它显示一个空白页面,但如果我下载该页面并在本地文件上执行它,它会像往常一样显示.为什么会发生这种情况?
When I type scrapy view http://www.diseasesdatabase.com/
, it displays a blank page but if I download the page and do it on the local file, it displays as usual. Why is this happening?
推荐答案
假装是一个提供 User-Agent
标头的真实浏览器:
Pretend being a real browser providing a User-Agent
header:
scrapy view http://www.diseasesdatabase.com/ -s USER_AGENT="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36"
为我工作.
请注意,此处的 -s
选项有助于覆盖内置的 USER_AGENT
设置.
Note that -s
option here helps to override the built-in USER_AGENT
setting.
这篇关于Scrapy 视图返回一个空白页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文