【Exception】爬虫代理报错java.net.UnknownHostException

加一个代理:

    public static void MyProxy() {
        System.setProperty("http.maxRedirects", "50");
        System.getProperties().setProperty("proxySet", "true");
        System.getProperties().put("https.proxyHost", "proxy.lfk.360es.cn");  
        System.getProperties().put("https.proxyPort", "3128");//注意端口为String类型。
    }

发布了223 篇原创文章 · 获赞 77 · 访问量 23万+

猜你喜欢

转载自blog.csdn.net/qq_40374604/article/details/99542912