Skip to content

Instantly share code, notes, and snippets.

@codesorter2015
Created May 31, 2019 09:04
Show Gist options
  • Save codesorter2015/b21dbeb369d7c3d1ca432993ac608b29 to your computer and use it in GitHub Desktop.
Save codesorter2015/b21dbeb369d7c3d1ca432993ac608b29 to your computer and use it in GitHub Desktop.
const puppeteer = require('puppeteer');
const proxyChain = require('proxy-chain');
(async() => {
const oldProxyUrl = 'http://bob:[email protected]:8000';
const newProxyUrl = await proxyChain.anonymizeProxy(oldProxyUrl);
// Prints something like "http://127.0.0.1:45678"
console.log(newProxyUrl);
const browser = await puppeteer.launch({
args: [`--proxy-server=${newProxyUrl}`],
});
// Do your magic here...
const page = await browser.newPage();
await page.goto('https://www.example.com');
await page.screenshot({ path: 'example.png' });
await browser.close();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment