The request is normal at first. If there are too many requests, this web page will be returned, prompting for verification.
Now that a proxy is added and a header is added, this is returned. I wonder if there is any way to bypass this verification, or can the verification be simulated in the background?
Has anyone encountered similar problems? Simply post the requested code
url = "https://mp.weixin.qq.com/profile?src=3×tamp=1498555925&ver=1&signature=mFCwcLO9hTwe*Js7TGQ457olpvr1d85gJSnVLyFgtYkX072FzolMsfonBR6Av2BOSe2kJ8z-m25ecftpvQ-edw=="
req = urllib2.Request(url)
proxy="218.56.132.155:8080"//尝试了各种代理ip,这边先写死
opener = urllib2.build_opener(urllib2.ProxyHandler({'http':proxy}))
urllib2.install_opener(opener)
req.add_header("User-Agent", "Mozilla/5.0")
req.add_header("Accept-Language", "zh-cn,zh;q=0.5")
req.add_header('Accept-encoding', 'gzip,deflate')
resp = urllib2.urlopen(req)
content = resp.read()
print content
Go to Sogou search and crawl WeChat
I have never crawled through WeChat, but it is recommended to use requests. It is recommended to refer to wechatsogou