pedroslopez / whatsapp-web.js

A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app
https://wwebjs.dev
Apache License 2.0
15.36k stars 3.66k forks source link

use http proxy,can not be set proxy authentication #275

Closed tianvier closed 4 years ago

tianvier commented 4 years ago

Hi,

Because i want to use http proxy. I want to set page.authenticate()

Thanks!

pedroslopez commented 4 years ago

It seems like http proxy is done in puppeteer through the launch args (I'm just reading https://blog.scrapinghub.com/how-to-use-a-proxy-in-puppeteer). You can do this through the client constructor:

const client = new Client({
    puppeteer: {
        args: [] // args here
    }
})

I'm not sure why you would need to use page.authenticate(), but in any case, the puppeteer page is available through client.pupPage

tianvier commented 4 years ago

Hi pedroslopez,

const client = new Client({
    puppeteer: {
        args: ['--proxy-server=127.0.0.1:7890'] // args here
    }
})

Just set the proxy address and port.

If the agent needs to be verified, it needs to be passed page.authenticate()

https://pptr.dev/#?product=Puppeteer&version=v4.0.1&show=api-pageauthenticatecredentials

https://github.com/puppeteer/puppeteer/issues/2234

DragoLifer commented 1 year ago

Hello, I read everything, but it doesn't work for me, why? Can you help?

Знімок екрана_20221113_015632 Знімок екрана_20221113_015650

kellen0903 commented 1 year ago

Hi @DragoLifer is the issue solved ? I'm facing same net::ERR_CONNECTION_RESET issue with proxy

xnodcorp commented 11 months ago

try with proxy-chain