Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async function RotateProxy(proxyList, targetUrl) {
- for (const proxy of proxyList) {
- try {
- const proxyUrl = `http://${proxy.host}:${proxy.port}`;
- const proxyAgent = new HttpsProxyAgent(proxyUrl);
- const response = await fetch(targetUrl, { agent: proxyAgent });
- const html = await response.text();
- console.log(html);
- } catch (error) {
- console.error(error);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement