Skip to content

Instantly share code, notes, and snippets.

@ofarukcaki
Created April 17, 2020 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ofarukcaki/1e22d90037152cb164df1ecb0d58f6e6 to your computer and use it in GitHub Desktop.
Save ofarukcaki/1e22d90037152cb164df1ecb0d58f6e6 to your computer and use it in GitHub Desktop.
const puppeteer = require('puppeteer');
// PROXY and PORT
const proxy = 'zproxy.lum-superproxy.io';
const port = 22225;
// USER and PASS
let proxyUsername = 'username';
const proxyPassword = 'password';
// This is luminati specific thing and not required for you in most cases
const session_id = (1000000 * Math.random()) | 0;
proxyUsername = proxyUsername + '-session-' + session_id;
(async () => {
const browser = await puppeteer.launch({
defaultViewport: false,
headless: false,
args: [
`--proxy-server=${proxy}:${port}`, // Or whatever the address is
],
});
// get the initial tab instead of creating a new one
const page = (await browser.pages())[0];
// authenticate the browser to use your proxy
await page.authenticate({ username: proxyUsername, password: proxyPassword });
// check the ip
await page.goto('https://www.wtfismyip.com/');
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment