Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify SOCKS Proxy For NightmareJS?

I'm able to set an HTTP proxy just fine for NightmareJS but how do I specify the type (http/socks5/socks4)? Here's the code I use to set an HTTP proxy:

const nightmare = Nightmare({
            show:true,
            switches: {
                'proxy-server': proxyHost + ':' + proxyPort,
                'ignore-certificate-errors': true
            },
            waitTimeout: 400000
        });
like image 620
xendi Avatar asked May 04 '17 23:05

xendi


1 Answers

You can specify the type of the proxy via the URI scheme: socks5://

const nightmare = Nightmare({
    switches: {
        'proxy-server': 'socks5://' + proxyHost + ':' + proxyPort,
    },
});
like image 136
Zyumar Avatar answered Sep 28 '22 15:09

Zyumar