claimer for Amazon Prime Gaming (no ext stores)

This commit is contained in:
Ralf Vogler 2022-01-13 20:04:13 +01:00
parent 349aec8deb
commit 747a2a5621
3 changed files with 113 additions and 18 deletions

14
util.js Normal file
View file

@ -0,0 +1,14 @@
// stealth with playwright: https://github.com/berstend/puppeteer-extra/issues/454#issuecomment-917437212
const newStealthContext = async (browser, contextOptions = {}) => {
if (!debug) { // fix userAgent in headless mode
const dummyContext = await browser.newContext();
const originalUserAgent = await (await dummyContext.newPage()).evaluate(() => navigator.userAgent);
await dummyContext.close();
// console.log('originalUserAgent:', originalUserAgent); // Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/96.0.4664.110 Safari/537.36
contextOptions = {
...contextOptions,
userAgent: originalUserAgent.replace("Headless", ""), // HeadlessChrome -> Chrome, TODO needed?
};
}
};