最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Specify SOCKS Proxy For NightmareJS? - Stack Overflow

programmeradmin4浏览0评论

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
        });

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
        });
Share Improve this question asked May 4, 2017 at 23:48 xendixendi 2,5325 gold badges43 silver badges70 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 11 +50

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

const nightmare = Nightmare({
    switches: {
        'proxy-server': 'socks5://' + proxyHost + ':' + proxyPort,
    },
});
发布评论

评论列表(0)

  1. 暂无评论