峰子_ 2019-03-09 17:26 采纳率: 100%
浏览 1381
已采纳

爬虫代理ip无法使用,换了好几个了都一样

public static void main(String[] args) throws IOException {

        Map<String,String> header=new HashMap<>();

        header.put("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
        header.put("Accept-Language","zh-CN,zh;q=0.8");
        header.put("Cache-Control","max-age=0");
        header.put("Connection","keep-alive");
        header.put("Host","www.xicidaili.com ");
        header.put("If-None-Match","W/\"f9ed210d1bd9f787ddddffceef37c9bc\"");
        header.put("User-Agent","Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0");
        header.put("Upgrade-Insecure-Requests","1");

        String content=Jsoup.connect("https://www.xicidaili.com/wt/").referrer("https://www.xicidaili.com/wn")
                .proxy("59.62.164.68", 9999)
                .ignoreContentType(true)
                .ignoreHttpErrors(true)
                .headers(header)
                .execute().parse()
                .toString();
        System.out.println(content);
    }

请问我这个为啥一直报这个错误
Exception in thread "main" java.net.ConnectException: Connection refused: connect

代理ip我已经换了好几个 都是这样
代理ip来源:https://www.xicidaili.com

麻烦大佬解答一下 多谢

  • 写回答

4条回答 默认 最新

  • threenewbee 2019-03-09 23:47
    关注

    这种公开的代理服务器,肯定是很多黑产都在用,服务器肯定都封了。还能让你来用。
    另外就是代理服务器未必是匿名代理,如果是透明代理,还可以通过x-forward-for得到你原始的ip。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料