代码很简单:
import requests url = "http://weixin.sogou.com/weixin?type=1&query=luoji" for i in range(1,200): headers = {"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36", "Referer":"http://weixin.sogou.com/weixin?type=1&query=luojisw" } response = requests.get(url,headers=headers) print ("罗技" in response.content.decode())
因为一开始访问的比较猛,所以访问了大约12个页面以后,就被禁止掉了.但是很奇怪,本地的浏览器都可以正常访问!?~~??一般封ip不是连我这个都禁止了~??
现在不管怎么修改,(完全模拟他的浏览器头),采集的话,也会出现空页面....如何才能顺利的采集下去?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...