问题
Here's my Nodejs code in which I'm trying to access a https site using https proxy but it doesn't seem to work, meanwhile the http proxy works fine. I have researched but nothing worked.
const puppeteer = require("puppeteer-extra");
const useProxy = require("puppeteer-page-proxy");
const StealthPlugin = require("puppeteer-extra-plugin-stealth");
const AdblockerPlugin = require("puppeteer-extra-plugin-adblocker");
puppeteer.use(StealthPlugin());
puppeteer.use(AdblockerPlugin({ blockTrackers: true }));
(async () => {
//proxies are from hidemy.name/en/proxy-list
const proxy = {
http: "http://89.187.177.91:80",
https: "https://51.68.207.81:80",
};
const launchOptions = {
executablePath: "/usr/bin/google-chrome",
headless: false,
args: [
"--ignore-certificate-errors",
"--disable-web-security",
"--disable-setuid-sandbox",
"--no-sandbox",
],
ignoreHTTPSErrors: true,
};
const browser = await puppeteer.launch(launchOptions);
const page = await browser.newPage();
//not working
//await useProxy(page, proxy.https);
//const url = "https://www.google.com/";
//working
const url = "http://httpbin.org/get";
await useProxy(page, proxy.http);
await page.goto(url, { waitUntil: "domcontentloaded" });
await useProxy(page, null);
await page.waitForTimeout(4000);
await page.wait;
await page.close();
await browser.close();
})();
来源:https://stackoverflow.com/questions/65372704/puppeteer-cant-access-https-site-with-proxy-server