简体   繁体   中英

Scrapy Access Denied crawling the head of a website

I wanna crawler a website, but I got the next error:

'<head>\n<title>Access Denied</title>\n</head>'

I just trying in the console:

scrapy shell https://www.zara.com/es/en/
response.css("head").get()

在此处输入图像描述

What I am doing wrong? Is related to the User-Agent? Does the website have an anti-crawling method? How can crawl this website?

Set USER_AGENT = 'zara (+http://www.yourdomain.com)' in settings.py. Solves the issue. You could put your own user agent if you like also.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM