Advertisement
dereksir

Untitled

Dec 26th, 2023
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const puppeteer = require('puppeteer');
  2.  
  3. (async () => {
  4.   // specify the proxy server
  5.   const proxyServer = 'http://20.219.176.57:3129';
  6.  
  7.   // launch Puppeteer with the proxy
  8.   const browser = await puppeteer.launch({
  9.     args: [`--proxy-server=${proxyServer}`],
  10.   });
  11.  
  12.   // open a new page
  13.   const page = await browser.newPage();
  14.  
  15.   // navigate to a website to check the IP (httpbin.org in this case)
  16.   await page.goto('http://httpbin.org/ip');
  17.  
  18.   // get the HTML text content
  19.   const htmlTextContent = await page.evaluate(() => document.body.textContent);
  20.  
  21.   // log only the HTML text content
  22.   console.log(htmlTextContent);
  23.  
  24.   // close the browser
  25.   await browser.close();
  26. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement