Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Somebi committed Apr 21, 2014
1 parent 49925ff commit 98bfe8c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ var url = require('url');

var scrapeProxies = function (next) {
var addProxies = function(window, next) {
window.$('td:contains(":")').toArray().forEach(function(td) {
var text = window.$(td).text();
var match = /^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9]+)$/.exec(text);
if (match) {
proxies.push('http://'+text);
}
});
var text=window.$('td:contains(":")').text();
var reg = /([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9]+)/g;
var proxy;
while(proxy=reg.exec(text)) {
proxies.push('http://'+proxy[0]);
}
next();
};

Expand Down Expand Up @@ -103,6 +102,6 @@ module.exports = function(next) {
});
}
} else {
next(validatedProxies[Math.floor(Math.random()*validatedProxies.length)]);
next(validatedProxies);
}
};

1 comment on commit 98bfe8c

@Somebi
Copy link
Owner Author

@Somebi Somebi commented on 98bfe8c Apr 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.