Created
April 17, 2020 20:06
-
-
Save ofarukcaki/1e22d90037152cb164df1ecb0d58f6e6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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