proxy-rotator-uploader
v1.0.0
Published
Upload and rotate proxies
Downloads
4
Readme
Proxy Rotator Uploader
const Rotator = require('./main.js');
(async () => {
const rotator = new Rotator();
await rotator.initialize({
uploadFromTxt: 'https://apify-uploads-prod.s3.amazonaws.com/839ae956-9285-4df0-9376-d84202ba510a_proxy-list.txt',
});
for (let i = 0; i < 10; i++) {
const proxy = rotator.pick();
console.log(proxy);
}
})();
You can also initialize with a custom formatter.
const defaultFormatter = (line) => {
const [host, port, username, password] = line.split(':');
return `http://${username}:${password}@${host}:${port}`;
}
await rotator.initialize({
uploadFromTxt: 'https://apify-uploads-prod.s3.amazonaws.com/839ae956-9285-4df0-9376-d84202ba510a_proxy-list.txt',
formatter: defaultFormatter,
});
// ...