Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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