stealth was not working due to removed new before require?
HEAD was showing hcaptcha while commit 64d0ba8ce7 claimed successfully without one.
Only relevant diff seems to be the removed `new` about which ts-check complained and which is also missing in
the example in https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth/evasions.
This commit is contained in:
parent
81b04f6f2f
commit
96432884b3
1 changed files with 2 additions and 1 deletions
|
|
@ -42,7 +42,7 @@ const newStealthContext = async (browser, contextOptions = {}) => {
|
||||||
'webgl.vendor',
|
'webgl.vendor',
|
||||||
'window.outerdimensions'
|
'window.outerdimensions'
|
||||||
];
|
];
|
||||||
const evasions = enabledEvasions.map(e => require(`puppeteer-extra-plugin-stealth/evasions/${e}`));
|
const evasions = enabledEvasions.map(e => new require(`puppeteer-extra-plugin-stealth/evasions/${e}`));
|
||||||
const stealth = {
|
const stealth = {
|
||||||
callbacks: [],
|
callbacks: [],
|
||||||
async evaluateOnNewDocument(...args) {
|
async evaluateOnNewDocument(...args) {
|
||||||
|
|
@ -60,6 +60,7 @@ const newStealthContext = async (browser, contextOptions = {}) => {
|
||||||
(async () => {
|
(async () => {
|
||||||
const browser = await chromium.launch({
|
const browser = await chromium.launch({
|
||||||
channel: 'chrome', // https://playwright.dev/docs/browsers#google-chrome--microsoft-edge
|
channel: 'chrome', // https://playwright.dev/docs/browsers#google-chrome--microsoft-edge
|
||||||
|
headless: false,
|
||||||
});
|
});
|
||||||
/** @type {import('playwright').BrowserContext} */
|
/** @type {import('playwright').BrowserContext} */
|
||||||
const context = await newStealthContext(browser, {
|
const context = await newStealthContext(browser, {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue