猫史档案馆


隧道转发爬虫代理的优势

用户:LaicalLaical查看:0 回复:0 评论:0 创建时间:2021-01-28T17:09:19


隧道爬虫代理:

“亿牛云爬虫代理IP”通过固定云代理服务地址,建立专线网络链接,代理平台自动实现毫秒级代理IP切换,保证了网络稳定性和速度,避免爬虫客户在代理IP策略优化上投入精力。

隧道转发爬虫代理加强版的优势:

加强版的IP分布于全国90多个地区,IP量大适合于大型网站或对IP数量、质量要求很高的采集任务。

隧道转发高匿爬虫代理加强版和普匿代理,同样作为匿名代理ip,爬虫代理与普通匿名代理ip在使用过程中是有区别的,经常使用爬虫代理的用户就能观察出来,首先隧道转发的爬虫代理的使用方式完全不同,那么隧道转发的爬虫代理高匿IP和普通匿名IP还有其他区别吗?

普通匿名代理ip在用户使用的过程中虽然隐藏了用户的真实ip,虽然发出了请求,但是对于网络爬虫来说,目标网站还是分析出了使用了代理IP,所以目标网站服务器还是会限制。所以网络爬虫使用普通的匿名IP ,网站很容易就能发现使用了代理IP,而本机的真实IP也有可能被检测出。则相反,使用隧道转发的爬虫代理加强版的高匿代理IP爬虫,就不用顾虑这些。隧道转发爬虫代理是真实发出请求,不仅使目标网站无法检测是否使用了代理IP,也无法检测出自己的本地IP,完全隐藏了自己的本地IP。所以网络爬虫要选择代理IP,一定要选择高匿的爬虫代理加强版

import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

public class Demo {

    public static void main(String[] args) {

        try{

            // 代理服务器(产品官网 www.16yun.cn)
            final static String ProxyHost = "t.16yun.cn";
            final static String ProxyPort = "31111";

            System.setProperty("http.proxyHost", ProxyHost);
            System.setProperty("https.proxyHost", ProxyHost);

            System.setProperty("http.proxyPort", ProxyPort);
            System.setProperty("https.proxyPort", ProxyPort);

            // 代理验证信息
            final static String ProxyUser = "username";
            final static String ProxyPass = "password";
import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

public class Demo {

    public static void main(String[] args) {

        try{

            // 代理服务器(产品官网 www.16yun.cn)
            final static String ProxyHost = "t.16yun.cn";
            final static String ProxyPort = "31111";

            System.setProperty("http.proxyHost", ProxyHost);
            System.setProperty("https.proxyHost", ProxyHost);

            System.setProperty("http.proxyPort", ProxyPort);
            System.setProperty("https.proxyPort", ProxyPort);

            // 代理验证信息
            final static String ProxyUser = "username";
            final static String ProxyPass = "password";

            System.setProperty("http.proxyUser", ProxyUser);
            System.setProperty("http.proxyPassword", ProxyPass);

            System.setProperty("https.proxyUser", ProxyUser);
            System.setProperty("https.proxyPassword", ProxyPass);




            // 设置IP切换头
            final static String ProxyHeadKey = "Proxy-Tunnel";

            // 设置Proxy-Tunnel
            Random random = new Random();
            int tunnel = random.nextInt(10000);
            String ProxyHeadVal = String.valueOf(tunnel);



            // 处理异常、其他参数
            Document doc = Jsoup.connect(url).timeout(3000).header(ProxyHeadKey, ProxyHeadVal).get();

            if(doc != null) {
                System.out.println(doc.body().html());
            }

        }catch (IOException e)
        {
            e.printStackTrace();
        }

    }
}


回复

上一页1 页 / 共 0下一页