在adidas.com上,以下代码以无头但非头的形式返回403,是的,我知道这已经被问过了,以前没有解决方案。
resolve((async (url) => {
let browser = await puppeteer.launch({
headless: false,
args: ["--no-sandbox", "--enable-features=NetworkService", "--ignore-certificate-errors"]
});
let page = await browser.newPage();
await page.goto(url, {waitUntil: 'networkidle2'});
await page.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.75 Safari/537.36');
let body = await page.evaluate(() => document.documentElement.outerHTML);
await browser.close();
return body;
})(url))