与 VPN Gate 的 Puppeteer 代理连接

Cha*_*ard 5 node.js puppeteer

我在 Node.js 和 Puppeteer 上开始了一个需要使用代理的小项目,但我在通过 VPNGate 的代理服务器连接时遇到了一些问题。

这是我到目前为止使用的代码:

async function getIpTest(){
  ips= await new ipGeneration(40);
  console.log(ips['#HostName']);
  proxConnect= '--proxy-server=' + ips['#HostName'] + '.opengw.net';

  const browser= await puppeteer.launch({
    headless: false,
    ignoreHTTPSErrors: true,
    args: [proxConnect]
  });
  const page = await browser.newPage();
  await page.setExtraHTTPHeaders({'Proxy-Authorization': 'Basic' + Buffer.from('vpn:vpn').toString('base64')});
  await page.goto('http://www.whatsmyip.org/');
}
Run Code Online (Sandbox Code Playgroud)

在哪里

IPGeneration()
Run Code Online (Sandbox Code Playgroud)

只是我用来解析他们的 CSV 文件的一个模块。

proxConnect= '--proxy-server=' + ips['#HostName'] + '.opengw.net';
Run Code Online (Sandbox Code Playgroud)

如果我将字符串直接放在 puppeteer.launch args 中,则是解析的一部分并产生相同的结果

我尝试更改端口,或不使用任何端口。我尝试了十几种不同的代理地址,并尝试直接连接到 IP 或主机名

我试图在网上到处寻找,但似乎无法找到为什么它不起作用(我是否应该在不尝试使用代理启动 puppeteer 的情况下提到一切正常)。

只是 VPN Gate 不能与 puppeteer 一起使用吗?

编辑:我在胡闹,看到他们有配置数据可以通过 openVPN 连接。使用 node>openVPN>VPN Gate 服务器是否是一个简单的工作解决方案?我现在试试这个