Advertisement
dereksir

Untitled

May 11th, 2023 (edited)
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. async function RotateProxy(proxyList, targetUrl) {
  2.   for (const proxy of proxyList) {
  3.     try {
  4.       const proxyUrl = `http://${proxy.host}:${proxy.port}`;
  5.       const proxyAgent = new HttpsProxyAgent(proxyUrl);
  6.  
  7.       const response = await fetch(targetUrl, { agent: proxyAgent });
  8.       const html = await response.text();
  9.  
  10.       console.log(html);
  11.     } catch (error) {
  12.       console.error(error);
  13.     }
  14.   }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement