Page fetching - Fixed possible incorrect browser user-agent header in playwright/puppeteer/browserless fetchers (#1811)

This commit is contained in:
dgtlmoon
2023-09-24 08:42:24 +02:00
committed by GitHub
parent 51e2e8a226
commit 57de4ffe4f
2 changed files with 7 additions and 5 deletions

View File

@@ -18,7 +18,9 @@ module.exports = async ({page, context}) => {
await page.setBypassCSP(true)
await page.setExtraHTTPHeaders(req_headers);
await page.setUserAgent(user_agent);
if (user_agent) {
await page.setUserAgent(user_agent);
}
// https://ourcodeworld.com/articles/read/1106/how-to-solve-puppeteer-timeouterror-navigation-timeout-of-30000-ms-exceeded
await page.setDefaultNavigationTimeout(0);