agentic icon indicating copy to clipboard operation
agentic copied to clipboard

Thoughts on using Google to bypass reCAPTCHA/hCAPTCHA?

Open saltcute opened this issue 3 years ago • 11 comments

By login using Google, the only thing that requires user operations appears to be the 2-step verification from Google, and this can be done away using your smart phone.

Or is it going to be detected by Google after a few tries?

Like this:

...
await page.goto('https://chat.openai.com/auth/login')
await page.waitForSelector('#__next .btn-primary', { timeout })
await delay(1000)
try {
    if (email && password) {
        await Promise.all([
            page.click('#__next .btn-primary'),
            page.waitForNavigation({
                waitUntil: 'networkidle0'
            })
        ])
        await page.waitForSelector('button[data-provider="google"]', { timeout });
        await page.click('button[data-provider="google"]');
        await page.waitForNavigation({
            waitUntil: 'networkidle0'
        })
        await page.type('input[type="email"]', email, { delay: 50 })
        await page.keyboard.press("Enter");
        await delay(3000);
        await page.keyboard.type(password, { delay: 50 });
        await page.keyboard.press("Enter");
    }
} catch (err) {
    await browser.close();
    throw err;
}
await page.waitForSelector("items-center");
...

saltcute avatar Dec 12 '22 23:12 saltcute

I definitely like the idea; probably needs more testing since I'm pretty sure that captchas will show up unexpectedly depending on a very opaque "riskiness score" that Cloudflare associates with a combination of your IP / browser / access patterns / etc.

Even if you don't get a captcha when testing locally, it can still show up at some point if you get flagged.

transitive-bullshit avatar Dec 12 '22 23:12 transitive-bullshit

So just found that Microsoft doesn't even need a 2-step verification, so the login process is automated if CloudFlare does not kick in and requires captcha. Still, not sure about how this will work after a few logins.

saltcute avatar Dec 13 '22 02:12 saltcute

Does using this 'puppeteer-extra-plugin-recaptcha' module even though it is paid for make sense because it is too difficult to bypass this problem in other ways, or is it better to think of a free solution?

marcorizza avatar Dec 13 '22 11:12 marcorizza

The captcha plugin may be the way to go; I've been traveling so haven't had a chance to really investigate properly.

transitive-bullshit avatar Dec 13 '22 20:12 transitive-bullshit

Captcha and/or "ChatGPT is at capacity" screen can appear before you even get to the login screen, and I've also seen them both afterwards.

transitive-bullshit avatar Dec 13 '22 20:12 transitive-bullshit

I saw reCaptcha before logging in while running through the example, probably Google or Microsoft authentication can be the way to go?

747745124 avatar Dec 14 '22 23:12 747745124

Does using this 'puppeteer-extra-plugin-recaptcha' module even though it is paid for make sense because it is too difficult to bypass this problem in other ways, or is it better to think of a free solution?

I've tried it and it's not detecting the recaptchas properly. The plugin doesn't seem to be maintained very well.

transitive-bullshit avatar Dec 15 '22 01:12 transitive-bullshit

I still don't understand why, but if anyone has any ideas, please tell me. I've tried making two projects one javascript and one typescript, they both work fine, the only problem I've noticed and I can't figure out why is that in this part of the code:

await page.waitForSelector("#username");
await page.type("#username", email, { delay: 20 });
await delay(100);
if (hasRecaptchaPlugin) {
    const res = await page.solveRecaptchas();
}
await page.click('button[type="submit"]');
await page.waitForSelector("#password", { timeout: timeoutMs });
await page.type("#password", password, { delay: 10 });
submitP = () => page.click('button[type="submit"]');

the line where const res = await page.solveRecaptchas(); is present is not waited for and the process goes on and it always fails because it takes a few seconds before it finishes and so it doesn't solve the captcha. This problem only happens if I run the project in typescript

marcorizza avatar Dec 16 '22 11:12 marcorizza

@marcorizza is it working for you in JS?

This may be due to https://github.com/berstend/puppeteer-extra/pull/758 in the TS version or some other related bug with puppeteer-extra-plugin-recaptcha

transitive-bullshit avatar Dec 17 '22 00:12 transitive-bullshit

The latest release added support for CAPTCHA automation which may help some folks in this thread. Note that this is a major version bump as it contains breaking changes to the core APIs, so check the docs carefully before upgrading: https://github.com/transitive-bullshit/chatgpt-api/releases/tag/v3.0.0

transitive-bullshit avatar Dec 17 '22 10:12 transitive-bullshit

@marcorizza is it working for you in JS?

This may be due to berstend/puppeteer-extra#758 in the TS version or some other related bug with puppeteer-extra-plugin-recaptcha

only in js, in a ts project it does not work for me.

marcorizza avatar Dec 17 '22 13:12 marcorizza

Confirming that Google is the way to go to fully bypass CAPTCHAs.

So if you don't want to use a CAPTCHA service, you can use Google logins which will receive much less frequent CAPTCHAs and afaik no Recaptchas, which are the really painful ones.

transitive-bullshit avatar Dec 18 '22 00:12 transitive-bullshit

TODO: I still need to add something to the readme explaining all of the CAPTCHA considerations.

transitive-bullshit avatar Dec 18 '22 00:12 transitive-bullshit