Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function proxynova(){
- var options = {method: 'GET', host: 'www.proxynova.com', path: '/proxy_list.txt'};
- var req = http.request(options, function(response) {
- var res_data = '';
- response.on('data', function(chunk) {res_data += chunk;});
- response.on('end', function() {
- var m=res_data.match(/(\d+\.\d+\.\d+\.\d+:\d+)/gim);
- if (m) console.log("proxy test: " +m.join(", "));
- m && m.forEach(function(v,i,a){
- /* proxy test */
- var p1=v.split(":");
- var options = {method: 'GET', 'path': 'http://imgur.com/stats', headers: {'Host': 'imgur.com' }};
- options.host=p1[0];
- options.port=p1[1];
- var req = http.request(options, function(response) {
- var bytes1=0;
- response.on('data', function(chunk) {bytes1+= chunk.length;});
- response.on('end', function() {
- console.log(response.statusCode,bytes1,req.proxy,response.statusCode==200&&bytes1==26777);
- if (response.statusCode==200&&bytes1>25000) {
- pl.push(req.proxy);
- }
- })
- });
- req.proxy=v;
- req.on('error', function(e) {console.log("# ERROR\t",req.proxy,e)});
- req.setTimeout(30000,function(){req.abort()});
- req.write('');
- req.end();
- /* */
- })
- });
- })
- req.on('error', function(e) {});
- req.write('');
- req.end();
- }
- var pl=[];
- proxynova();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement