berstend / puppeteer-extra

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

[Bug] puppeteer-extra-plugin-recaptcha is not finding and solving any cloudflare turnstile recaptcha #905

Closed tbhaxor closed 1 month ago

tbhaxor commented 1 month ago

Describe the bug

I am fairly new to recaptcha solution using 2captcha service, and trying to solve the cloudflare turnstile recaptcha using 2captcha. After a lot of debugging I found that the plugin is not even detecting any captcha on the page.

The browser page is still on this screen

image

Code Snippet

import pptr from 'puppeteer-extra';
import StealthPlugin from 'puppeteer-extra-plugin-stealth';
import { PuppeteerExtraPluginAdblocker } from 'puppeteer-extra-plugin-adblocker';
import { PuppeteerExtraPluginRecaptcha } from 'puppeteer-extra-plugin-recaptcha';

pptr
  .use(StealthPlugin())
  .use(new PuppeteerExtraPluginAdblocker({ blockTrackers: true, blockTrackersAndAnnoyances: true }))
  .use(
    new PuppeteerExtraPluginRecaptcha({
      throwOnError: true,
      visualFeedback: true,
      provider: { id: '2captcha', token: '<REDACTED>' },
    }),
  )
  .launch({ headless: false })
  .then((browser) => browser.newPage())
  .then(async (page) => {
    await page.goto('https://tbhaxor.com');
    const captcha = await page.findRecaptchas();
    console.log(captcha);
    const { solutions } = await page.solveRecaptchas();
    await page.enterRecaptchaSolutions(solutions);
  });

Versions

System:
    OS: Linux 6.10 Manjaro Linux
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 23.81 GB / 31.20 GB
    Container: Yes
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.15.1 - /usr/bin/node
    Yarn: 1.22.22 - /usr/bin/yarn
    npm: 10.8.2 - /usr/bin/npm
    pnpm: 9.5.0 - /usr/bin/pnpm
  npmPackages:
    puppeteer: ^22.13.1 => 22.13.1 
    puppeteer-extra: ^3.3.6 => 3.3.6 
    puppeteer-extra-plugin-adblocker: ^2.13.6 => 2.13.6 
    puppeteer-extra-plugin-recaptcha: ^3.6.8 => 3.6.8 
    puppeteer-extra-plugin-stealth: ^2.11.2 => 2.11.2 
    puppeteer-page-proxy: ^1.3.0 => 1.3.0 
HackerinoS2 commented 1 month ago

Hey there. I think the plugin does not support Cloudflare Turnstile yet.

vladtreny commented 1 month ago

Cloudflare updated the captcha a week ago, based on our talks here but in another thread. They probably read these issues.

Now, it is much harder to solve the captcha. 2captha will need to rewrite their scripts...

tbhaxor commented 1 month ago

Ohk I will keep this issue open until we find a way to bypass it.

tbhaxor commented 1 month ago

I used my website url and api key here and this repository is working.

https://github.com/2captcha/cloudflare-demo

zfcsoftware commented 1 month ago

https://github.com/zfcsoftware/puppeteer-real-browser/blob/main/src/module/turnstile.js

tbhaxor commented 1 month ago

Oh shit, this is for recaptcha, not turnstile 🤦🏻 My bad guys!. I will check your project @zfcsoftware if it works along with puppeteer-extra would be awesome.