Advertisement
dereksir

Untitled

Aug 31st, 2023 (edited)
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const { chromium } = require('playwright-extra')
  2.  
  3. // Configure and add the proxy router plugin with a default proxy
  4. const ProxyRouter = require('@extra/proxy-router')
  5. chromium.use(
  6.   ProxyRouter({
  7.     proxies: { DEFAULT: 'http://164.132.170.100:80' },
  8.   })
  9. )
  10.  
  11. chromium.launch({ headless: true }).then(async browser => {
  12.   const page = await browser.newPage()
  13.  
  14.   // Navigate to target URL
  15.   await page.goto('http://httpbin.io/ip');
  16.   // Get page HTML
  17.   const textContent = await page.evaluate(() => document.body.textContent);
  18.  
  19.   console.log(textContent);
  20.  
  21.   await browser.close()
  22. })
  23.  
  24.  
  25.  
  26.  
  27. /*
  28. {
  29.   "origin": "164.132.170.100"
  30. }
  31. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement