Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thoughts on using Google to bypass reCAPTCHA/hCAPTCHA? #115

Closed
saltcute opened this issue Dec 12, 2022 · 13 comments
Closed

Thoughts on using Google to bypass reCAPTCHA/hCAPTCHA? #115

saltcute opened this issue Dec 12, 2022 · 13 comments

Comments

@saltcute
Copy link

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");
...
@transitive-bullshit
Copy link
Owner

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.

@saltcute
Copy link
Author

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.

@marcorizza
Copy link

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?

@transitive-bullshit
Copy link
Owner

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
Copy link
Owner

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.

@747745124
Copy link

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

@transitive-bullshit
Copy link
Owner

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.

@marcorizza
Copy link

marcorizza commented Dec 16, 2022

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

@transitive-bullshit
Copy link
Owner

@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

@transitive-bullshit
Copy link
Owner

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

@marcorizza
Copy link

@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.

@transitive-bullshit
Copy link
Owner

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
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants