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

HCaptcha solver support #17

Closed
jairoxyz opened this issue Aug 5, 2020 · 1 comment
Closed

HCaptcha solver support #17

jairoxyz opened this issue Aug 5, 2020 · 1 comment

Comments

@jairoxyz
Copy link
Contributor

jairoxyz commented Aug 5, 2020

Hey mate, this is related to #12 - I followed your advice and wanted to add https://github.com/JimmyLaurent/hcaptcha-solver as a captcha solver. The node lib actually works with the site I tried and returns a token but I have difficulties adding it as a solver under ./captcha.

First problem, routes.ts tries to pass hostname and sitekey to the solver, but hcaptcha-solver needs just a url:

 const token = await captchaSolver({
            hostname: (new URL(url)).hostname,
            sitekey,
            type: captchaType
          })

Second problem, page waits for this element and code fails with timeout if not found:
await page.waitForSelector('#challenge-form [type=submit]')

So I commented these out just for testing and the returned token works and I get a successful response from the site 👍

But I am really not good at typescript, so would not even know where to grab the url from in the function I export from my solver. Also no idea how to import the module correctly. But here is what I have as ./captcha/hcaptcha.ts

const solveHCaptcha = require('hcaptcha-solver');

export default async function solve(): Promise<string> {
    try {
        const response = await solveHCaptcha(url);
        return response
        // F0_eyJ0eXAiOiJKV1Q...
      } catch (error) {
        console.log(error);
      }
    
}

Maybe you can help adding this one like the harvester? Or maybe it would make more sense to integrate it in the main code and try to solve hcaptchas with it before calling the solver services.

Thanks!
@NoahCardoza
Copy link
Owner

Second problem, page waits for this element and code fails with timeout if not found:
await page.waitForSelector('#challenge-form [type=submit]')

Which site does this line fail on?

I pass all those arguments because they might be needed, but it might be a good idea to pass the whole URL since you can take a hostname from a full URL but not vice versa. Regardless, since the hCaptcha solver takes only the hostname from the url you should be able to pass the domain.

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

2 participants