Scrapy view returns a blank page

柔情痞子 提交于 2019-12-20 04:25:11

问题


I'm new at Scrapy and I was just trying to scrape 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?


回答1:


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"

Worked for me.

Note that -s option here helps to override the built-in USER_AGENT setting.



来源:https://stackoverflow.com/questions/31189588/scrapy-view-returns-a-blank-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!