博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
获取免费代理推荐
阅读量:7080 次
发布时间:2019-06-28

本文共 2153 字,大约阅读时间需要 7 分钟。

一些免费到代理地址

 

function getProxyList() {    // http://www.66ip.cn/nm.html    var apiURL = 'http://www.66ip.cn/nmtq.php?getnum=100&isp=0&anonymoustype=0&start=&ports=&export=&ipaddress=&area=0&proxytype=0&api=66ip';    return new Promise((resolve, reject) => {        var options = {            method: 'GET',            url: apiURL,            gzip: true,            encoding: null,            headers: {                'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',                'Accept-Encoding': 'gzip, deflate',                'Accept-Language': 'zh-CN,zh;q=0.8,en;q=0.6,zh-TW;q=0.4',                'User-Agent': 'Mozilla/8.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',                'referer': 'http://www.66ip.cn/'            },        };        request(options, function (error, response, body) {            try {                if (error) throw error;                if (/meta.*(charset=gb2312|charset=GBK)/.test(body)) {                    body = iconv.decode(body, 'gbk');                }                var ret = body.match(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d{1,4}/g);                resolve(ret);            } catch (e) {                return reject(e);            }        });    })}getProxyList().then(function (proxyList) {    proxyList.forEach(function (proxyurl) {        request({            method: 'GET',            url: 'http://ip.chinaz.com/getip.aspx',            timeout: 30000,            encoding: null,            proxy: 'http://' + proxyurl        }, function (err, _res, body) {            if (err) {                console.error("fail", err.message)             } else {                try {                    // 将 buffer 转化为字符串                    body = body.toString();                    // 序列化                    body = eval('(' + body + ')')                    console.log("success", body.address, proxyurl);                } catch(err) {                    console.log('fail page');                }             }        })    });}).catch(e => {    console.log(e);})

 

转载于:https://www.cnblogs.com/CyLee/p/9211921.html

你可能感兴趣的文章
JavaScript闭包总结
查看>>
关于点击率模型,你知道这三点就够了
查看>>
HDU 5726 GCD
查看>>
HDU 5813 Elegant Construction
查看>>
POJ 3139 Balancing the Scale
查看>>
hdu 3367 Pseudoforest
查看>>
ZOJ 1967 POJ 2570 Fiber Network
查看>>
使用oracle来计算方差及标准差
查看>>
jQuery[补1] - 事件冒泡和阻止冒泡
查看>>
awk入门
查看>>
【声明】前方不设坑位,不收费!~ 我为NET狂官方学习计划
查看>>
[笔记] APIO 2018 Day1
查看>>
一张图彻底了解Unity脚本的生命周期
查看>>
ASP.NET MVC, Url长度过长问题解决,404.15问题
查看>>
HttpClient使用详解
查看>>
char、varchar、nchar、nvarchar的区别
查看>>
锐捷、赛尔认证MentoHUST
查看>>
前后台传值 201...
查看>>
POJ 2133 暴搜
查看>>
BZOJ 1379 模拟退火
查看>>