berstend / puppeteer-extra

💯 Teach puppeteer new tricks through plugins.
https://extra.community
MIT License
6.41k stars 739 forks source link

[Bug] stealth plugin malfunctioning with playwright #793

Open ramsestom opened 1 year ago

ramsestom commented 1 year ago

Describe the bug

When trying to access a page protected by a cloudflare chalenge, the chalenge always fails when using playwright with the stealth plugin but succeed when using puppeteer with the stealth plugin (tested it multiple times with different IPs and the result is always the same playwright+stealth -> chalenge fails, puppeteer+stealth -> chalenge succeed ).

So it looks like playwright is exposing something that puppeteer doesn't. I checked both fingerprints with https://antoinevastel.com/bots/ but they looks identical so I could not determine why playwright is flaged as a bot by cloudflare while puppeteer isn't. But it looks like the stealth plugin would need additional evasion procedure(s) to work with playwright as intended.

Code Snippet

puppeteer:

const puppeteer = require('puppeteer-extra') 
const StealthPlugin = require('puppeteer-extra-plugin-stealth') 
puppeteer.use(StealthPlugin()) 
puppeteer.launch({ headless: false }).then(async browser => { 
    const page = await browser.newPage() 
    await page.goto('https://dl-protect.link/b47f907a?fn=U3BpbiBNZSBSb3VuZCBbV0VCLURMIDEwODBwXSAtIE1VTFRJIChGUkVOQ0gp&rl=a2') 
    await page.waitForTimeout(60000) 
    await browser.close() 
})

playwright:

const { chromium } = require('playwright-extra')
const StealthPlugin = require('puppeteer-extra-plugin-stealth') 
chromium.use(StealthPlugin())
chromium.launch({ headless: false }).then(async browser => { 
    const page = await browser.newPage() 
    await page.goto('https://dl-protect.link/b47f907a?fn=U3BpbiBNZSBSb3VuZCBbV0VCLURMIDEwODBwXSAtIE1VTFRJIChGUkVOQ0gp&rl=a2') 
    await page.waitForTimeout(60000) 
    await browser.close() 
})

NOTE: I use headless=false mode in both snippets so it is easy to visualy detect if the cloudflare chalenge has passed or not

Versions

puppeteer: ^19.8.3 => 19.8.3 puppeteer-extra: ^3.3.6 => 3.3.6 puppeteer-extra-plugin-stealth: ^2.11.2 => 2.11.2 playwright: ^1.32.1 => 1.32.1 playwright-extra: ^4.3.6 => 4.3.6 chromium version used by puppeteer: Version 112.0.5614.0 (Build de développement) (64 bits) chromium version used by playwright: Version 112.0.5615.29 (Build de développement) (64 bits)

skromez commented 1 month ago

having the same problem