Skip to content

Commit

Permalink
Log loaded proxies
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterbrandsen authored Mar 18, 2024
1 parent 88103ca commit c6e0214
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/helper/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,22 @@ async function getProxies(page) {
}
}

let proxyList = []
let proxyList = [];
let promises = [];

for (let i = 1; i <= Math.ceil(Number(WEBSHARE_PROXYAMOUNT) / 100); i += 1) {
getProxies(i).then((proxies) => {
promises.push(getProxies(i));
}

Promise.all(promises).then((results) => {
results.forEach((proxies) => {
proxyList = proxyList.concat(proxies);
});
}
// Now you can use the proxyList
console.log(`Loaded ${proxyList.length} proxies from Webshare`);
}).catch((error) => {
console.error(error);
});

export default function getProxy(index) {
return proxyList[index];
Expand Down

0 comments on commit c6e0214

Please sign in to comment.