berstend / puppeteer-extra

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

[Bug] puppeteer-extra-plugin-stealth can't passby cloudflare verify #908

Open spencer17x opened 2 months ago

spencer17x commented 2 months ago

Describe the bug

Code Snippet

Code

import puppeteer from 'puppeteer-extra';
import stealthPlugin from 'puppeteer-extra-plugin-stealth';

const tokenAddress = '0x812ba41e071c7b7fa4ebcfb62df5f45f6fa853ee';
const fullUrl = `https://dexscreener.com/ethereum/${tokenAddress}`;
puppeteer.use(stealthPlugin());

const browser = await puppeteer.launch({
  headless: false,
  devtools: true,
});
const page = await browser.newPage();

await page.goto(fullUrl);

error: image

Versions

System: OS: macOS 14.6.1 CPU: (8) arm64 Apple M1 Memory: 394.52 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 16.17.0 - ~/.nvm/versions/node/v16.17.0/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 8.15.0 - ~/.nvm/versions/node/v16.17.0/bin/npm pnpm: 7.14.0 - ~/.nvm/versions/node/v16.17.0/bin/pnpm

package.json

{
    "puppeteer": "^23.1.0",
    "puppeteer-extra": "^3.3.6",
    "puppeteer-extra-plugin-stealth": "^2.11.2",
}
nachat-ayoub commented 2 months ago

still no solution ?

vladtreny commented 2 months ago

I tried your example and bypassed it this way. Depends on your OS, set correct Chrome binary

            const tokenAddress = '0x812ba41e071c7b7fa4ebcfb62df5f45f6fa853ee'
            const fullUrl = `https://dexscreener.com/ethereum/${tokenAddress}`
            const stealth = StealthPlugin()

            stealth.enabledEvasions.delete('iframe.contentWindow')
            stealth.enabledEvasions.delete('media.codecs')
            stealth.enabledEvasions.delete('user-agent-override')
            puppeteer.use(stealth)

            const browser = await puppeteer.launch({
                headless: false,
                executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', // On Mac
                // If you use Windows, set here
                //   executablePath: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe',
                // For linux
                //   executablePath: '/usr/bin/google-chrome',
                // @ts-ignore
                targetFilter: (target) => !!target.url()
            })
            const page = await browser.newPage()

            await page.goto(fullUrl)
xyunsh commented 1 week ago

any solution?

spencer17x commented 1 week ago

any solution?

use puppeteer-real-browser