Python爬虫用了高匿名代理ip,爬快了为啥还是会封掉本机ip

1.代理可能并不高匿。你可以使爬虫访问您的IP地址,来检测代理是否生效。2.服务器可能通过请求头中的X-Real-IP、X-Forwarded-For等信息来获取真实ip。可以在发起请求时伪造这些值。下面是我用于投票的一部分代码(nodejs):function postRequest(url,data,callback,charset=\u0026#39;utf8\u0026#39;,cookie){ var proxy = getProxy(\u0026#39;https\u0026#39;); console.log("Posting through proxy @ "+proxy) SA.post(url) .proxy(proxy) .set("Cookie",cookie) .set(\u0026#39;User-Agent\u0026#39;,randomUA()) .set(\u0026#39;X-Forwarded-For\u0026#39;,randomIP()) .set(\u0026#39;X-Real-IP\u0026#39;,randomIP()) .set(\u0026#39;Content-Type\u0026#39;,\u0026#39;application/x-www-form-urlencoded\u0026#39;) .send(data) .timeout(5000) .end(function(err,res){ if (typeof(res)!="undefined"){ callback(res); }else{ console.log("Conect failed, try next proxy "); postRequest(url,data,callback,null,cookie) } });}获取代理ip,可以使用我写的这个脚本:Pingze-github/proxy-finder
■网友
每个ip有生存期
■网友
【Python爬虫用了高匿名代理ip,爬快了为啥还是会封掉本机ip】 那怎么鉴别买的IP是不是高匿名呢?


    推荐阅读