Scrapy view returns a blank page

2020-04-18 07:22发布

问题:

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.