Code Monkey home page Code Monkey logo

aw1875 / puppeteer-hcaptcha Goto Github PK

View Code? Open in Web Editor NEW
138.0 6.0 38.0 10.03 MB

A library to solve hcaptcha challenges that are automated within puppeteer. You can automatically set response values where they should be so the only thing left for you is submitting the page or you can get the response token.

Home Page: https://www.npmjs.com/package/puppeteer-hcaptcha

JavaScript 100.00%
solve-hcaptcha-challenges puppeteer hcaptcha hcaptcha-solver

puppeteer-hcaptcha's Introduction

hCaptcha solver for puppeteer

⚠️ Important ⚠️

I'm currently searching for a better TFJS model as it seems the coco-ssd model thats currently being used is struggling with hCaptchas images more frequently as they are now blurred a little. If you have any suggestions please create a new issue with the TFJS recommendation template so I can take a look. Thanks!


Most recent updates to the code can be found on the typescript branch.


A library to solve hcaptcha challenges that are automated within puppeteer. You can automatically set response values where they should be so the only thing left for you is submitting the page or you can get the response token. Average response time is rougly 13 - 20 seconds with TensorFlow's Image Recognition.

If you like this project feel free to donate!

Donate with PayPal

Install

npm i puppeteer-hcaptcha

Usage

await hcaptcha(page);
  • page <Page> - Puppeteer Page Instance
await hcaptchaToken(url);
  • url <string> - URL of page with captcha on it

Automatically set respone value (see demo)

// Require puppeteer extra and puppeteer stealth
const puppeteer = require("puppeteer-extra");
const pluginStealth = require("puppeteer-extra-plugin-stealth");

// Require our hcaptcha method
const { hcaptcha } = require("puppeteer-hcaptcha");

// Tell puppeteer to use puppeteer stealth
puppeteer.use(pluginStealth());

(async () => {
    // Instantiate a new browser object
    // Ignore errors associated to https
    // Can be headless but for example sake we want to show the browser
    // Set your desired arguments for your puppeteer browser
    const browser = await puppeteer.launch({
        ignoreHTTPSErrors: true,
        headless: false,
        args: [
            `--window-size=600,1000`,
            "--window-position=000,000",
            "--disable-dev-shm-usage",
            "--no-sandbox",
            '--user-data-dir="/tmp/chromium"',
            "--disable-web-security",
            "--disable-features=site-per-process",
        ],
    });

    // Get browser pages
    const [page] = await browser.pages();

    // Send page to your url
    await page.goto("URL OF PAGE WITH CAPTCHA ON IT");

    // Remove the page's default timeout function
    await page.setDefaultNavigationTimeout(0);

    // Call hcaptcha method passing in our page
    await hcaptcha(page);

    // Your page is ready to submit.
    // Captcha solving should be the last function on your page so we
    // don't have to worry about the response token expiring.
    /**
     * Example:
     * await page.click("loginDiv > loginBtn");
     */
})();

Return response token only (see demo)

// Require our hcaptchaToken method
const { hcaptchaToken } = require("puppeteer-hcaptcha");

(async () => {
    // Create Start Time
    const startTime = Date.now();

    // Call hcaptchaToken method passing in your url
    let token = await hcaptchaToken("URL OF PAGE WITH CAPTCHA ON IT");

    // Get End Time
    const endTime = Date.now();

    // Log timed result to console
    console.log(`Completed in ${(endTime - startTime) / 1000} seconds`);

    // P0_eyJ0eXAiOiJ...
    console.log(token);
})();

Credits

Changelog

4.1.6 (July 27, 2022)

  • Small modifications to the code to handle websites that are switching away from the newassets subdomain. Thanks to mikedidomizio for making the changes (#65)

4.1.5 (Febuary 15, 2021)

  • Modified package to work with forked version of ghost-cursor (@aw1875/ghost-cursor)
  • Exposed solveCaptcha function from merged PR

4.1.4 (December 27, 2021)

  • Made small change to request as potential fix for #27 and #30
  • Cleaned up documentation within code

4.1.3 (December 22, 2021)

  • Temporary inclusion of my forked version of ghost-cursor until PR is accepted.
  • Should fix issue requests as timestamps are required to be associated with mouse movements send with requests.

4.1.2 (December 16, 2021)

  • Fixed asset url to reflect new hCaptcha asset url

4.1.1 (December 14, 2021)

  • Fixed code inconsistency

4.1.0 (December 14, 2021)

  • Setup TensorFlow tasks to run in parallel using Promise.All which seems to have drastically improved speeds solving #23
  • Test results seem to mostly be between the 13 - 16 second range (with a few outliers between 19 - 20)
  • Will continue looking into ways to get back to the old speeds from using Google Cloud Vision
    • Looking into the potential of using C++ or C# as a backend for true threading with the help of edge-js or something similar

4.0.1 (December 8, 2021)

  • Fixed issue where useragents.json file couldn't be found

4.0.0 (December 8, 2021)

  • Removed Google Cloud Vision from dependencies
  • Integrated TensorFlow Image Recognition instead
  • Created fix for checking answer requests failing
  • Cleaned up functions
  • Documented all functions within code

3.0.6 (December 7, 2021)

  • Removed setting the g-recaptcha-response as hCaptcha no longer requires this

3.0.5 (December 7, 2021)

  • Added functions to dynamically get HSW/HSL version for getting tasklist
  • Updated headers to properly request for tokens

3.0.4 (April 30, 2021)

  • Added fix for cloudflare sites with regards to HSJ request checks

3.0.3 (April 29, 2021)

  • Fixed issue finding useragents file

3.0.2 (April 23, 2021)

  • Reverted changes made in v3.0.1
  • Created temporary fix for HSJ requests while I look into a proper solution

3.0.1 (April 22, 2021)

  • Pushed a fix for when the response token is received from the initial request

3.0.0 (April 4, 2021)

  • Big changes to solving logic to follow changes that hCaptcha has made to their requests.

2.0.2 - 2.0.3 (April 2, 2021)

  • Made changes to requests based on changes hCaptcha made. Added list of User Agents so that they are randomized on request (seems to speed up response time generally)

  • Fixed issue finding useragents file

2.0.1 (March 28, 2021)

  • Fixed issues with cloudflare sites not returning solved token (see #2).

2.0.0 (March 23, 2021)

  • Added Google Vision for image recognition to speed up the process
  • Added ability to solve captcha on a page or just return the response token
  • Massive shoutout goes to Tal for all the help implementing Google Vision
    • The idea to do this came from him. He has a super quick solver for GoLang if you are looking for that. He also added a REST API Version of his solver that can definitely be useful if you don't know anything about GoLang

1.0.1 - 1.0.2 (March 16, 2021)

  • Small updates to README documentation

1.0.0 (March 16, 2021)

  • Initial release
  • Huge shoutout to these people for the release of this package
    • Futei - Initial project
    • JimmyLaurent - Initial Node Module
    • Nayde - The idea of porting functionality to be usable through puppeteer
    • DinoHorvat - Help with response token issue (workaround was found out before release)

Known Issues

I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.

Stems from TensorFlow. Not entirely sure how to fix this but it doesn't impact the solver.

puppeteer-hcaptcha's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

puppeteer-hcaptcha's Issues

How to use with Cloudflare HCaptcha

Hi,
Great Work!
But it seems not to work with Cloudflare HCatpcha Tokens like on this site.
Can you have a look to it?
I tried to generate the CaptchaAnswer with your Code, with which you can pass the Captcha , and set a fetch request from the page, but i receive always following response:
{"c":{"type":"hsw","req":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzIjoyLCJ0IjoidyIsImQiOiJVMG1qK2l6cDF6WW9reCtOcUNJbXd0VjgxNHFLWWhXdER3V0xFS1pFUmgwdVdpQzhTQ3RyNkpWaTAvWStyQ1pEK3MxWTNmM0dBTlIrNWpFRWhVRDRMbDN3U05EenNEQ2R1L3Uya1hDalhyU0NURGczZllQOWIxUzhsWGpUdWp5ZUNxS2tOc2FNUXR2NllCdzRONFAwc095YlFrVlR3RFlHcWNsOGorN21YUWhnK0lDaDZxK1kxdjJmQWc9PVdadzZYWnNKL0NjS0dxMVoiLCJsIjoiaHR0cHM6Ly9uZXdhc3NldHMuaGNhcHRjaGEuY29tL2MvMjFiMTc1YjQiLCJlIjoxNjQxMzI4MDY2fQ.AwcKpsL8GscspfSv2NuoB18t8hIfT0GEqQ0r6IjMSv0"},"success":false,"error-codes":[]}

Maybe you have an idea how to bypass.

[Question]: Could you use yolov5

I heared yolov5 is faster and you could easily train your own models and stuff I saw captcha solver they average a time around 6 seconds per page or even lower I got times to 4secs for 4 images

[Question]: Doing wrong?

Okey... So it installed correctly now, but it it not really working. When it is solving, there is nothin in the console, only the Tensorflow warning... I will submit the code I am executing here
What am I doing wrong?

solve.txt

Using without a "submit" button

My issue is explained here, the old repo.
#3

I can't submit the form after getting the answer of hcaptcha verification on discord website.

I tried your suggestions "await page.keyboard.press('Enter') or await page.type(String.fromCharCode(13)) to submit the page." but the callback isn't submitted at all.

Do you have another suggestion to solve this issue ?

how to use it

I have tried to do it but I don't know how to configure the google-cloud / vision, some example of how to use it, please?

Not able to install

Hi,

`npm WARN deprecated [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see request/request#3142
npm ERR! code 1
npm ERR! git dep preparation failed
npm ERR! command C:\Program Files\nodejs\node.exe C:\Users\VISHAL ANAND\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js install --force --cache=C:\Users\VISHAL ANAND\AppData\Local\npm-cache --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! > [email protected] prepare
npm ERR! > husky install && yarn lint && yarn build
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! .git can't be found (see https://git.io/Jc3F9)
npm ERR! npm ERR! code 1
npm ERR! npm ERR! path C:\Users\VISHAL ANAND\AppData\Local\npm-cache_cacache\tmp\git-cloneKtL5qP
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c husky install && yarn lint && yarn build
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR! C:\Users\VISHAL ANAND\AppData\Local\npm-cache_logs\2022-02-03T08_52_25_351Z-debug-0.log

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\VISHAL ANAND\AppData\Local\npm-cache_logs\2022-02-03T08_51_55_111Z-debug-0.log`

Getting deprecated error but it is also not installing the package. I am getting this error every time.

hCaptcha solver do not work

During my development it did not work, so I tested like the demo (same code and same site) and it does not work! So I can't use the package, here is the error:

UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON
--> starting at object with constructor 'BrowserContext'
| property '_browser' -> object with constructor 'Browser'
--- property '_defaultContext' closes the circle
at JSON.stringify ()

answer this issue for more information.

[Bug]: TypeError: Cannot read properties of undefined

Hi
I'm trying demo code

const puppeteer = require("puppeteer-extra");
const pluginStealth = require("puppeteer-extra-plugin-stealth");

// Require our hcaptcha method
const { hcaptcha } = require("puppeteer-hcaptcha");

// Tell puppeteer to use puppeteer stealth
puppeteer.use(pluginStealth());

(async () => {
    // Instantiate a new browser object
    // Ignore errors associated to https
    // Can be headless but for example sake we want to show the browser
    // Set your desired arguments for your puppeteer browser
    const browser = await puppeteer.launch({
        ignoreHTTPSErrors: true,
        headless: false,
        args: [
            `--window-size=600,1000`,
            "--window-position=000,000",
            "--disable-dev-shm-usage",
            "--no-sandbox",
            '--user-data-dir="/tmp/chromium"',
            "--disable-web-security",
            "--disable-features=site-per-process",
        ],
    });

    // Get browser pages
    const [page] = await browser.pages();

    // Send page to your url
    await page.goto("https://2captcha.com/demo/hcaptcha");

    // Remove the page's default timeout function
    await page.setDefaultNavigationTimeout(0);

    // Call hcaptcha method passing in our page
    await hcaptcha(page);

    // Your page is ready to submit.
    // Captcha solving should be the last function on your page so we
    // don't have to worry about the response token expiring.
    /**
     * Example:
     * await page.click("loginDiv > loginBtn");
     */
})();

and I got this error

C:\Users\Dev\Desktop\project\CaptchaTest\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:221
            throw new Error('Evaluation failed: ' + helper_js_1.helper.getExceptionMessage(exceptionDetails));
                  ^

Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'objectLocalization')
    at getAnswers (C:\Users\Dev\Desktop\project\CaptchaTest\node_modules\puppeteer-hcaptcha\hcaptcha.js:80:18)
    at tryToSolve (C:\Users\Dev\Desktop\project\CaptchaTest\node_modules\puppeteer-hcaptcha\hcaptcha.js:178:25)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async solveCaptcha (C:\Users\Dev\Desktop\project\CaptchaTest\node_modules\puppeteer-hcaptcha\hcaptcha.js:255:22)W
    at async Page._onBindingCalled (C:\Users\Dev\Desktop\project\CaptchaTest\node_modules\puppeteer\lib\cjs\puppeteer\common\Page.js:998:28)
    at ExecutionContext._evaluateInternal (C:\Users\Dev\Desktop\project\CaptchaTest\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:221:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async ExecutionContext.evaluate (C:\Users\Dev\Desktop\project\CaptchaTest\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:110:16)
    at async hcaptcha (C:\Users\Dev\Desktop\project\CaptchaTest\node_modules\puppeteer-hcaptcha\hcaptcha.js:281:17)
    at async gen2 (C:\Users\Dev\Desktop\project\CaptchaTest\index - 10minemail - autosolver.js:39:3)

I don't know what's wrong on this code
Sorry for my english

Some questions about hcaptcha/cloudflare

Hello sir @aw1875 , this post will probably not be considered, as we are dealing with this libraye.
I tested your library, but on some sites it doesn't work the way I would like, and the solve time is quite long.

So I decided to make some changes (tricks) to the old library, cloudscraper.
Everything seemed to work perfectly, for a few days until cloudflare made a new update and the library stopped working.
I don't know what it updated, and what's wrong with my changes, the library gets sitekey, rayid, and sends data to 2captcha, but h-captcha-response seems invalid.
Here is the lib with my changes i just need some help to undestend what is wrong if is posible. thanks.

// solved, error has from my server

Some help

Hello sir @aw1875 , im testing your repo, but some wrong

(node:24149) UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read property 'src' of null
    at <anonymous>:5:6
    at ExecutionContext._evaluateInternal (/root/solver/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:218:19)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async ExecutionContext.evaluate (/root/solver/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:107:16)
    at async hcaptcha (/root/solver/node_modules/puppeteer-hcaptcha/hcaptcha.js:130:3)
    at async /root/solver/test.js:26:5
(node:24149) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:24149) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
What is wrong?

[Bug]: Hcaptcha is meeming with us

Describe the bug
After 4 hours me and my friend Norbyy looking why car is not equal to car and why train is not equal to train ... then after we run out of logic, he said imagine if that a is not like the other a, we start laughing on it, but it's true. hCaptcha is using Greek letters to replace some letters like e,a,o,c ....

To Reproduce
Steps to reproduce the behavior:

  1. You need to add a greek_to_latin function
  2. call it when you extract the word to detect

Token received but invalid

When I try to solve a captcha the token generated is not working. The only thing that I've seen different is that the page that I'm trying to bypass is using ¿HSW? I don't really know if I'm correct or not, but I think that is the only difference.

Error

Could you help me? when I start .js I get this error:

D: \ Downloads \ puppeteer-hcaptcha-master \ puppeteer-hcaptcha-master> node t.js
(node: 8328) UnhandledPromiseRejectionWarning: Error: Evaluation failed: Error: ENOENT: no such file or directory, open 'C: \ UsersAdministradorDownloadsMy First Project-f2a901bcd6f9.json'
at ExecutionContext._evaluateInternal (D: \ Downloads \ puppeteer-hcaptcha-master \ puppeteer-hcaptcha-master \ node_modules \ puppeteer \ lib \ cjs \ puppeteer \ common \ ExecutionContext.js: 218: 19)
at processTicksAndRejections (internal / process / task_queues.js: 93: 5)
at async ExecutionContext.evaluate (D: \ Downloads \ puppeteer-hcaptcha-master \ puppeteer-hcaptcha-master \ node_modules \ puppeteer \ lib \ cjs \ puppeteer \ common \ ExecutionContext.js: 107: 16)
at async hcaptcha (D: \ Downloads \ puppeteer-hcaptcha-master \ puppeteer-hcaptcha-master \ node_modules \ puppeteer-hcaptcha \ hcaptcha.js: 241: 17)
at async D: \ Downloads \ puppeteer-hcaptcha-master \ puppeteer-hcaptcha-master \ t.js: 48: 5
(Use node --trace-warnings ... to show where the warning was created)
(node: 8328) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch (). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections = strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node: 8328) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

-------------------------------------------------- My code is this ---------------------------------------

const pluginStealth = require('puppeteer-extra-plugin-stealth')
const vision = require("@google-cloud/vision");

// Require our hcaptcha method
const { hcaptcha } = require('puppeteer-hcaptcha');

// Instantiate a new Google Vision Client
// This is important so make sure keyFilename points to your credentials
// Our solver method will be using this to speed up the process
const client = new vision.ImageAnnotatorClient({
keyFilename: "C:\Users\Administrador\Downloads\My First Project-f2a901bcd6f9.json",
});

// Tell puppeteer to use puppeteer stealth
puppeteer.use(pluginStealth());

(async () => {
// Instantiate a new browser object
// Ignore errors associated to https
// Can be headless but for example sake we want to show the browser
// Set your desired arguments for your puppeteer browser
const browser = await puppeteer.launch({
ignoreHTTPSErrors: true,
headless: false,
args: [
--window-size=600,1000,
"--window-position=000,000",
"--disable-dev-shm-usage",
"--no-sandbox",
'--user-data-dir="/tmp/chromium"',
"--disable-web-security",
"--disable-features=site-per-process"
],
});

// Get browser pages
const [page] = await browser.pages();

// Send page to your url
await page.goto('http://captcha.cryptowin.io:3000/')

// Remove the page's default timeout function
await page.setDefaultNavigationTimeout(0);

// Call hcaptcha method passing in our page and google vision client
await hcaptcha(page, client);

// Your page is ready to submit. Captcha solving should be the last function on your page so we don't have to worry about the response token expiring.

})();

Error during hCaptcha post-solve token set call - selector g-recaptcha-response not found

I'm seeing the following error being thrown from within the hCaptcha code during an attempt to solve a CloudFlare hCaptcha:

Error: Evaluation failed: TypeError: Cannot set property 'value' of null
    at <anonymous>:3:67
    at ExecutionContext._evaluateInternal (/.../node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js:218:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async ExecutionContext.evaluate (/.../node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js:107:16)
    at async hcaptcha (/.../node_modules/puppeteer-hcaptcha/hcaptcha.js:254:3)
    at async [calling code]

Looking at hcaptcha.js, I see that this is the function which appears to be failing:

  await page.evaluate((token) => {
    document.querySelector('[name="h-captcha-response"]').value = token;
    document.querySelector('[name="g-recaptcha-response"]').value = token;
  }, token)

This implies that it completed the captcha solving process but then blew up afterwards because one of these fields was not present - when I debugged this, I found that g-recaptcha-response was not guaranteed to be present in the page and once I removed that set, everything worked as expected.

[Bug]: not able to install the library

npm v 6.9.0
node v12.0.0
yarn v 1.22.17

`npm WARN deprecated [email protected]: request has been deprecated, see request/request#3142
npm WARN deprecated [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see request/request#3142
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/

@tensorflow/[email protected] install C:\projects\Repos\project\node_modules@tensorflow\tfjs-node
node scripts/install.js

CPU-windows-3.13.0.zip

  • Downloading libtensorflow
    https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.7.0.zip
    [==============================] 631779/bps 100% 0.0s
  • Building TensorFlow Node.js bindings
    node-pre-gyp install failed with error: Error: Command failed: node-pre-gyp install --fallback-to-build
    node-pre-gyp ERR! install response status 404 Not Found on https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v4/3.13.0/CPU-windows-3.13.0.zip
    node-pre-gyp WARN Pre-built binaries not installable for @tensorflow/[email protected] and [email protected] (node-v72 ABI, unknown) (falling back to source compile with node-gyp)
    node-pre-gyp WARN Hit error response status 404 Not Found on https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v4/3.13.0/CPU-windows-3.13.0.zip
    gyp ERR! build error
    gyp ERR! stack Error: C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe failed with exit code: 1
    gyp ERR! stack at ChildProcess.onExit (C:\ProgramData\nvm\v12.0.0\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
    gyp ERR! stack at ChildProcess.emit (events.js:196:13)
    gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:256:12)
    gyp ERR! System Windows_NT 10.0.22000
    gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\ProgramData\nvm\v12.0.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "build" "--fallback-to-build" "--module=C:\projects\Repos\project\node_modules\@tensorflow\tfjs-node\lib\napi-v4\tfjs_binding.node" "--module_name=tfjs_binding" "--module_path=C:\projects\Repos\project\node_modules\@tensorflow\tfjs-node\lib\napi-v4" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=4" "--node_napi_label=napi-v4"
    gyp ERR! cwd C:\projects\Repos\project\node_modules@tensorflow\tfjs-node
    gyp ERR! node -v v12.0.0
    gyp ERR! node-gyp -v v3.8.0
    gyp ERR! not ok
    node-pre-gyp ERR! build error
    node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\ProgramData\nvm\v12.0.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\projects\Repos\project\node_modules@tensorflow\tfjs-node\lib\napi-v4\tfjs_binding.node --module_name=tfjs_binding --module_path=C:\projects\Repos\project\node_modules@tensorflow\tfjs-node\lib\napi-v4 --napi_version=4 --node_abi_napi=napi --napi_build_version=4 --node_napi_label=napi-v4' (1)
    node-pre-gyp ERR! stack at ChildProcess. (C:\projects\Repos\project\node_modules@mapbox\node-pre-gyp\lib\util\compile.js:89:23)
    node-pre-gyp ERR! stack at ChildProcess.emit (events.js:196:13)
    node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1000:16)
    node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:267:5)
    node-pre-gyp ERR! System Windows_NT 10.0.22000
    node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\projects\Repos\project\node_modules\@mapbox\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build"
    node-pre-gyp ERR! cwd C:\projects\Repos\project\node_modules@tensorflow\tfjs-node
    node-pre-gyp ERR! node -v v12.0.0
    node-pre-gyp ERR! node-pre-gyp -v v1.0.4
    node-pre-gyp ERR! not ok

npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @tensorflow/[email protected] install: node scripts/install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @tensorflow/[email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Roaming\npm-cache_logs\2022-02-08T21_53_29_638Z-debug.log`

Deprecated packages on installing

Getting this error while installing

npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see `https://github.com/request/request/issues/3142`

What to do since this is not working or is there any alternate way to resolve this? Please let me know.
Thanks

Still same token not working issue

On the mentioned webpage with this new changes It's still not working. I've been testing to try to understand a little more about this.

I've seen that the "hsl", "hsw", "hsj", changes when the userAgent is changing.
So, when I load the page on my chrome normally, this first call (https://hcaptcha.com/checksiteconfig) It's always "hsw" but with this package, the response is "hsl" almost every time.
If you put the user agent for example to something like Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_0) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/90 Safari/537.4 on the userAgent header you will get "hsw"

Another thing that I've seen it's that in this page the origin header in this first call is https://newassets.hcaptcha.com instead of 'https://assets.hcaptcha.com'
And the hsw that it's using is : https://newassets.hcaptcha.com/c/36c79c31/hsw.js (Yesterday I remember that it was different)
Even if you force the value in chrome to use this userAgent that it's getting the "hsl" value the hsl.js url it's different (https://newassets.hcaptcha.com/c/36c79c31/hsl.js)

I think that this change made that you get this first pass value on the first checksiteconfig it's not returning a valid token to use it, it's a JSON Web Token that I don't really know what it's used for. Atleast with the other changes it returned something that looked like a token F0_eyJ0eXAiOiJ... but that didn't worked either

Moving model loader out of tensor function

Hey,

I've found that the model is loaded each time the tensor/1 function receives the function, this takes a lot of time. This will be more productive if load it somewhere only one time.

I'm currently fastly have moved it to the getAnswersTF/2 and called the tensor/1 with a second parameter like this tensor(imgUrl, preloadedModel). But I think there have a better place for it, any ideas?

[Question]: Error when requiring @tensorflow/tfjs-node on Mac

I am getting error : zsh: illegal hardware instruction node test.js for even the demo code shared in the documentation.

Its seem like an issue for M1 chip Macs but any idea how to solve it ? Seems like tensorflow is not building properly on the machine.

[Bug]: error when requiring the module

Describe the bug
hcaptcha is installed but an error fired when i try to require it

To Reproduce
Steps to reproduce the behavior:

const { hcaptcha } = require("puppeteer-hcaptcha");
  • Any other steps needed to reproduce issue.
    i'm trying to use this module on glitch (glitch.com)
    node version 12.0.1 and pnpm

Errors Received

internal/modules/cjs/loader.js:235
      throw err;
      ^
Error: Cannot find module '/rbd/pnpm-volume/8685de08-4417-4a2a-9b34-4cbed7f15400/node_modules/.registry.npmjs.org/puppeteer-hcaptcha/4.1.4/node_modules/ghost-cursor/lib/spoof.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (internal/modules/cjs/loader.js:227:19)
    at Function.Module._findPath (internal/modules/cjs/loader.js:364:18)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:597:27)
    at Function.Module._load (internal/modules/cjs/loader.js:526:27)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/rbd/pnpm-volume/8685de08-4417-4a2a-9b34-4cbed7f15400/node_modules/.registry.npmjs.org/puppeteer-hcaptcha/4.1.4/node_modules/puppeteer-hcaptcha/src/utils.js:1:18)
    at Module._compile (internal/modules/cjs/loader.js:759:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)

Errors Installing

Hi, i would love to rest your module, but i can't get it work.
I am using node 10, and receive following error after installing it with npm i:

Error: The Node.js native addon module (tfjs_binding.node) can not be found at path: /home/dbellstaedt/node_modules/@tensorflow/tfjs-node/lib/napi-v7/tfjs_binding.node.

I use Linux on Chromebook. .
Any Ideas?

Best Regards

Wrong Challenge Type. Retrying.

Hello,

I'm trying to use with initial page (demo codes) but I'm receiving below code

Wrong Challenge Type. Retrying. Wrong Challenge Type. Retrying.

[Bug]: Captcha Solving doesent work

Describe the bug
I wrote a script that do the same like yours and tries to solve the 2captcha demo captcha.
But it dosent work i just get an error with hCaptcha solved incorrectly, please try again. the h-captcha-response value is also undefined. The script timeouts after 100-120 seconds without an result.....
To Reproduce
Steps to reproduce the behavior:

  1. Code block(s) with your code.
const puppeteer = require("puppeteer-extra");
const pluginStealth = require("puppeteer-extra-plugin-stealth");

// Require our hcaptcha method
const { hcaptcha } = require("puppeteer-hcaptcha");

// Tell puppeteer to use puppeteer stealth
puppeteer.use(pluginStealth());

(async () => {
    // Instantiate a new browser object
    // Ignore errors associated to https
    // Can be headless but for example sake we want to show the browser
    // Set your desired arguments for your puppeteer browser
    const browser = await puppeteer.launch({
        ignoreHTTPSErrors: true,
        headless: false,
        args: [
            `--window-size=600,1000`,
            "--window-position=000,000",
            "--disable-dev-shm-usage",
            "--no-sandbox",
            '--user-data-dir="/tmp/chromium"',
            "--disable-web-security",
            "--disable-features=site-per-process",
        ],
    });

    // Get browser pages
    const [page] = await browser.pages();

    // Send page to your url
    await page.goto("https://2captcha.com/demo/hcaptcha?difficulty=easy");

    // Remove the page's default timeout function
    await page.setDefaultNavigationTimeout(0);
    const startTime = Date.now();
    
    // Call hcaptcha method passing in our page
    await hcaptcha(page);

    // Your page is ready to submit.
    // Captcha solving should be the last function on your page so we
    // don't have to worry about the response token expiring.
    /**
     * Example:
     * await page.click("loginDiv > loginBtn");
     */
    console.log("Fertig");
    const [btn] = await page.$x('//*[@id="root"]/div/main/div/section/form/button[1]');
    const [token] = await page.$x('//*[@name="h-captcha-response"]');
    console.log(await page.evaluate(token => token.value, token))
    await btn.click();
    const endTime = Date.now();
    console.log(`Completed in ${(endTime - startTime) / 1000} seconds`);
    
})();

Screenshots
image
image

Errors Received
hCaptcha solved incorrectly, please try again.

Error: Evaluation failed: TypeError: Cannot read property 'src' of null

const puppeteer = require('puppeteer-extra')
const pluginStealth = require('puppeteer-extra-plugin-stealth')
const vision = require("@google-cloud/vision");

const { hcaptchaToken } = require('puppeteer-hcaptcha');

const client = new vision.ImageAnnotatorClient({
keyFilename: "YOUR GOOGLE CREDENTIALS",
});

puppeteer.use(pluginStealth());

(async () => {

let token = await hcaptchaToken('https://nooooder.xyz', client);

// W0_eyJ0eXAiOiJ...
console.log(token);

})();

Help me converting to .NET

Hi everyone, I'm trying to send a post request to "https://hcaptcha.com/checkcaptcha/${key}?s=${sitekey}". I got 403 status every time. I wrote my code on .NET. So, I hope someone can help me figure this problem out ?. Thank you very much.

This is my code:

var timestamp = ((DateTimeOffset)DateTime.Now).ToUnixTimeMilliseconds() + new Random().Next(30, 120);
var jsonResponse = new JObject();
httpRequest = WebRequest.Create($"https://hcaptcha.com/checksiteconfig?host={host}&sitekey={siteKey}&sc=1&swa=1");
httpRequest.Method = "GET";
httpRequest.Headers = headerHttp;
httpResponse = httpRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
    jsonResponse = JObject.Parse(streamReader.ReadToEnd());
}
String test = String.Empty;
if(jsonResponse["c"] == null)
{
    body["job_mode"] = jobMode;
    body["answer"] = answer;
    body["serverdomain"] = host;
    body["sitekey"] = siteKey;
    body["motionData"] = tempMotionData.ToString().Replace("\r", "").Replace("\n", "").Replace(" ", "");
    body["n"] = null;
    body["c"] = "null";
}
else
{
    body["job_mode"] = jobMode;
    body["answer"] = answer;
    body["serverdomain"] = host;
    body["sitekey"] = siteKey;
    body["motionData"] = tempMotionData.ToString().Replace("\r", "").Replace("\n", "").Replace(" ", "");
    body["n"] = jsonResponse["c"]["type"].ToString().CompareTo("hsl") == 0 ? GetHSLHCaptcha(jsonResponse["c"]["req"].ToString()) : GetHSWHCaptcha(jsonResponse["c"]["req"].ToString());
    body["c"] = jsonResponse["c"].ToString().Replace("\r", "").Replace("\n", "").Replace(" ", "");
    body["v"] = DecodeBase64ToJOject(jsonResponse["c"]["req"].ToString().Split(".")[1])["l"].ToString().Substring(dec.Length);
}
httpRequest = WebRequest.Create($"https://hcaptcha.com/checkcaptcha/${key}?s=${siteKey}");
httpRequest.Method = "POST";
headerHttp = new WebHeaderCollection();
headerHttp.Add("Authority", "hcaptcha.com");
headerHttp.Add("Accept", "application/json");
headerHttp.Add("Accept-Language", "en-US,en;q=0.9");
headerHttp.Add("Content-Type", "application/json;charset=UTF-8");
headerHttp.Add("Origin", "https://newassets.hcaptcha.com");
headerHttp.Add("Sec-Fetch-Site", "same-site");
headerHttp.Add("Sec-Fetch-Mode", "cors");
headerHttp.Add("Sec-Fetch-Dest", "empty");
headerHttp.Add("User-Agent", userAgent);
httpRequest.Headers = headerHttp;
using (var streamWriter = new StreamWriter(httpRequest.GetRequestStream()))
{
    streamWriter.Write(body.ToString().Replace("\r","").Replace("\n","").Replace(" ",""));
    streamWriter.Flush();
    streamWriter.Close();
}
var checkAnswers = httpRequest.GetResponse(); //<--- 403 status

And this is body I got after replacing

"{\"job_mode\":\"image_label_binary\",\"answer\":{\"320e6315-bffc-4a07-b555-a8fafc5efa79\":\"false\",\"74a196cc-0870-46da-84a9-15e4f5e73579\":\"true\",\"b38da4b3-e8f7-455b-b265-53483b9b1981\":\"false\",\"4d4b3d72-761b-4b4b-8325-de360b6fa586\":\"false\",\"99709e3c-0b08-4661-9a43-9a2d7c76cf39\":\"false\",\"abb63531-ee0a-4652-9de1-efb4d5368c87\":\"false\",\"58f89fc2-4a13-440b-aad9-47f3d3edebd1\":\"false\",\"ac0cd534-1561-4551-b939-c5df04d5093f\":\"true\",\"b4756a40-89f9-4768-b1c4-5af87ba6777c\":\"false\"},\"serverdomain\":\"democaptcha.com\",\"sitekey\":\"51829642-2cda-4b09-896c-594f89d700cc\",\"motionData\":\"{\\\"st\\\":1642606282592,\\\"mm\\\":[[100,100,1642606282718],[116.78154984466093,104.95299192914867,1642606282755],[133.29929865105032,110.46276194617363,1642606282708],[149.5520374295446,116.51001691242537,1642606282726],[165.53855719052046,123.07546368925456,1642606282737],[181.25764894435426,130.13980913801174,1642606282709],[196.7081037014226,137.68376012004754,1642606282719],[211.888712472102,145.6880234967125,1642606282745],[226.79826626676902,154.13330612935724,1642606282744],[241.43555609580008,163.0003148793323,1642606282772],[255.7993729695717,172.26975660798828,1642606282737],[269.8885078984605,181.92233817667585,1642606282705],[283.70175189284294,191.93876644674546,1642606282777],[297.2378959630956,202.2997482795478,1642606282698],[310.495731119595,212.98599053643346,1642606282747],[323.4740483727176,223.97820007875296,1642606282726],[336.17163873283994,235.2570837678569,1642606282731],[348.5872932103385,246.80334846509587,1642606282715],[360.71980281559,258.5977010318206,1642606282771],[372.5679585589706,270.6208483293814,1642606282753],[384.13055145085707,282.85349721912894,1642606282710],[395.40637250162604,295.276354562414,1642606282768],[406.39421272165384,307.870127220587,1642606282691],[417.092863121317,320.6155220549985,1642606282742],[427.50111471099206,333.4932459269992,1642606282702],[437.61775850105573,346.4840056979397,1642606282756],[447.4415855018842,359.56850822917045,1642606282751],[456.97138672385415,372.72746038204207,1642606282690],[466.2059531773423,385.9415690179053,1642606282725],[475.1440758727248,399.1915409981105,1642606282728],[483.7845458203784,412.4580831840084,1642606282719],[492.1261540306797,425.72190243694956,1642606282715],[500.16769151400496,438.9637056182845,1642606282717],[507.90794928073086,452.16419958936393,1642606282744],[515.3457183412339,465.3040912115383,1642606282702],[522.4797897058907,478.3640873461584,1642606282771],[529.3089543850776,491.32489485457467,1642606282767],[535.8320033891712,504.16722059813753,1642606282736],[542.0477277285481,516.8717714381978,1642606282745],[547.9549184135847,529.4192542361061,1642606282710],[553.5523664546577,541.7903758532129,1642606282753],[558.8388628621433,553.9658431508687,1642606282760],[563.8131986464184,565.9263629904244,1642606282753],[568.4741648178592,577.6526422332304,1642606282767],[572.8205523868423,589.125387740637,1642606282739],[576.8511523637446,600.3253063739953,1642606282715],[580.564755758942,611.2331049946555,1642606282751],[583.9601535828116,621.8294904639686,1642606282711],[587.0361368457295,632.0951696432846,1642606282734],[589.7914965580725,642.0108493939546,1642606282748],[592.2250237302169,651.5572365773289,1642606282700],[594.3355093725393,660.7150380547582,1642606282711],[596.1217444954162,669.464960687593,1642606282705],[597.5825201092243,677.7877113371841,1642606282696],[598.71662722434,685.6639968648819,1642606282774],[599.5228568511397,693.074524132037,1642606282703],[600,700,1642606282761]],\\\"dct\\\":1642606282592}\",\"n\":\"97988c83d345ce86bbbcb5a1ebbb751fe0da33315f573defda19c69d9a80aa686ff2f3575d700b72a9315c7ba29c316396c78f25cb461b50498999cec8e54efd9f12eaebceed4765105a671e3f0a93d1d54df70856838281694a1a14a40a240a85b5efa15e7dd8f349faa7e3b2f23e3ffaaf8fa76e7f31e214877783502c7ce63c00425ce5587dcef4b9b9c6a0ea9973b0583313ee9cfeea8e5cbe0c6d29ebd7ad854542345967a101790e75ff85c6c4bf5b885172f1aaebf263261a1118bf33facdf19a4c55859dcd44f4f8337fcc1a09321974e167d2e69efe7402a98e23822f0f46b5deb2d1c684ee8792cf0ad7cdb1e246e6be0cd19c43f25e848b9987c797bebccdf06de753babf1dba50426e8b562fc62df675a3ae9719afdd1cc0fdba670399fb262b4d5258b04524dfb7325111324a095ce8dd41c466b775dad084f681d2cc23876e6228e952604163a44aa4ca3cb064efb0797b14533bc4e87c7e7e3a8b6ec4a6da09a85dca42acd177823d818b9c1e5e06ba2c57866494388b5a59c8fc2c3827f71066462d1079f48124a3ceb4bb7abaeb33c981ffe8db21faada351dc6824a25a4de8eb164ae0a377d7b767e2b86ce18e4b770c3ef41548415050ea74bbdbad56bd4803b111b5974add179ba8963f3dcfbaa856a655f4914e3d5e2e4336701a320db7201de61021cdbfde7d072e408e255cfbe8f40df19035509df181ec47fe0123e25c31ae862f0082612e259b12445bf314ebe0ed0b973880ee418e580c5a0a937a3075d73e95d077160cdce6d27ffbea44e570af693d424a6dfad2a864a969a3d0519b0aabc93c21dcec8dc95c9b147ed928979070ffd2f1d667f653b93c45ea5ae74371906a4c1dc927601cbb13b77e349be5ccd5bb325f6a474815019e4a05a3522d2839aa3d0e9a36066eeb5b62184c868a3405ebdbae64920157cd7119d820abcaf6634b12d66045619e33cb10d2c1fcceb23687319deb1e98361ef3ab59d5bd6dfaf1caf0fe48187ce1aaefb869c8d416e6ddf2d0a04f173bd5b20c69787efa3a936f7fe7f230d9bbeae7e96d329b1553ba1e4cd906309076366057a1693d58c980d3dd141fb0c91ca071a611c51cdb7649be87cf1f7e7d1d8725afb18b6dc5891531964c5f53852dda8ac9aee48a49d4ffdc144f7475140077b78dffffa48cdc7ebfc93bfd6ec182cf07d9642f6593279edb428c71bcae026f88477c644c10e5a85667130e9db7afb571c6c265a90f4b5581d651e1badb13793d4b501b593dde3dad432485eb4e4d5ff5fee7fac58f23644531cdcf46e6721e601f90bf72bd979571066cc3b9c4ecf25675bc9cd57dc78e2c2f4ab8652da626df4db2aa14da8111b01f0ed30dea44f0f45003e3ef2eebf9f9f4a39f8b7d5a2e1517ae1d631919e3ecfdf45c79d2c7ed8c5822260a37048bfb5fe7d48e37bd5e71919d93859027a869fa1fe65742e0ee180f07d74ffdded2d079d0f0c48d8f40f9c065e4e3e5d4d8f9e21a7476fda3ce9a8427a334d691268ddc51f927055cbf7f5c5a0331e29715e3027fb28b56638b8c4fc09152abdac2143cacb45effe5373398d507ea5ccc3268d33263af432b4d36e616e5b12d570c5938de7259b20d1d9fd17320539fc91676680cf39d1b9c864ae91a3386e5a415612de6bf5925b365c1138e3422a0af2bca2d50a0221c63c025b534786c66b2ce14a7981a2160eb226366d399db9082283e0ff20ad5a4f8912ba20b7f9c27d5d347c0db6f4a4fab1f63e76bec6bf5189268125c5063a3df2da8c1658aa265df3224361d26c2c90e80523daaa8169eeb271697c18ebb4a6cf66e98958451dc82a413254c55b4449591ba5ddf85a45d11e2231a036c4babcaecb2b411d64513a6fa937d38240588d2d1d6a63b6028222b38cefc61fd0a71dcaec67beec763868c281a04d8213dc21a68ef80efdbadae6dcffdba5ebdaa27ee634c46e0f1e71afc362a4be8f17c3d1221a8f7327fdc98ca783b682bc7e00724bc5e9c0a6c299274f21b8388724e9696b857ca078a92ff84c295b81408a7b25b3cff78e9f6f41214e7b2a9eaa5ccca2b6354adc99c678c19a3c49fbf4aefc64f46209716f2f22f02ff4b8f414757826a09c3db86c3ac7b72addccc49a78883f064b1308499c87232d5780d72a423412b178a2ac9511d6adf16e3e11c74486662692b4700\",\"c\":\"{\\\"type\\\":\\\"hsw\\\",\\\"req\\\":\\\"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzIjoyLCJ0IjoidyIsImQiOiJkd2hnVFhQa2hXUklaL0hjdFo3Rk43YktsVnYvaW1HREYrcnliU1lKdXR4OXhUR3ZtOWQwRWtXMlFpeVh2cW5UNE1oQkpxM1Q1WVZXYWVpTzV1QmQ0VEkvQ3laUW02OWxDVXh5cHlDbDhQU0NJK2U1SXBMRlBKY3NSbUJ6ZnpXWURTU1NoejZDRDB4eUlham9Md1NBSU9jQWxKNXFROVpRUmk3UzYwa0V2NkNuc2xTeitiODcyeVk5N2c9PTgvckVhVU1DWGx4aHFYUFkiLCJsIjoiaHR0cHM6Ly9uZXdhc3NldHMuaGNhcHRjaGEuY29tL2MvYzg0Mjg2NDAiLCJlIjoxNjQyNjA2NTQzfQ.I1BRtJvVI77Ph-RZoMXrhXtnaqaGPaDU2AOOushE9pA\\\"}\",\"v\":\"c8428640\"}"

It can be parsed by JSON.parse() on javascript.
Thank you.

Cloud Vision Api?

Hello, after walking your package I realized that Cloud Vision pi had to see a way to pay, it's a paid service? Then if possible, you have a method to do all this for free that would be nice.

Submit Token For Cloudflare Pages

hi, i can get token after new update. But not passing cloudflare page after add token, dou you have any idea?

Example:
document.querySelector('[name="h-captcha-response"]').value = token;
document.querySelector('.challenge-form').submit()

How to use it

Could someone send me an example of how to use it?

[Bug]: tensorflow/tfjs-node dependency issue

When installing puppeteer-hcaptcha, it fails to install due to the tfjs-node depency.

To Reproduce
Steps to reproduce the behavior:

  1. npm i puppeteer-hcaptcha

Error:

npm ERR! path C:\Users\redacted\node_modules\@tensorflow\tfjs-node
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/install.js
npm ERR! CPU-windows-3.12.0.zip
npm ERR! https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.7.0.zip
npm ERR! node-pre-gyp install failed with error: Error: Command failed: node-pre-gyp install --fallback-to-build
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using [email protected]
npm ERR! node-pre-gyp info using [email protected] | win32 | x64
npm ERR! node-pre-gyp info check checked for "C:\Users\redacted\node_modules\@tensorflow\tfjs-node\lib\napi-v8\tfjs_binding.node" (not found)
npm ERR! node-pre-gyp http GET https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/3.12.0/CPU-windows-3.12.0.zip
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/3.12.0/CPU-windows-3.12.0.zip
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for @tensorflow/[email protected] and [email protected] (node-v93 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/3.12.0/CPU-windows-3.12.0.zip
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.1 found at "C:\Python310\python.exe"
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version was set from command line or npm config
npm ERR! gyp ERR! find VS - looking for Visual Studio version 2015
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS checking VS2019 (16.4.29806.167) found at:
npm ERR! gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
npm ERR! gyp ERR! find VS - found "Visual Studio C++ core features"
npm ERR! gyp ERR! find VS - found VC++ toolset: v142
npm ERR! gyp ERR! find VS - found Windows SDK: 10.0.18362.0
npm ERR! gyp ERR! find VS - msvs_version does not match this version
npm ERR! gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS valid versions for msvs_version:
npm ERR! gyp ERR! find VS - "2019"
npm ERR! gyp ERR! find VS - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack     at VisualStudioFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
npm ERR! gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:404:5)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
npm ERR! gyp ERR! System Windows_NT 10.0.19043
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Users\\redacted\\node_modules\\@tensorflow\\tfjs-node\\lib\\napi-v8\\tfjs_binding.node" "--module_name=tfjs_binding" "--module_path=C:\\Users\\redacted\\node_modules\\@tensorflow\\tfjs-node\\lib\\napi-v8" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=8" "--node_napi_label=napi-v8" "--python=C:\\Users\\redacted\\.windows-build-tools\\python27\\python.exe" "--msvs_version=2015"
npm ERR! gyp ERR! cwd C:\Users\redacted\node_modules\@tensorflow\tfjs-node
npm ERR! gyp ERR! node -v v16.13.1
npm ERR! gyp ERR! node-gyp -v v8.3.0
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\redacted\node_modules\@tensorflow\tfjs-node\lib\napi-v8\tfjs_binding.node --module_name=tfjs_binding --module_path=C:\Users\redacted\node_modules\@tensorflow\tfjs-node\lib\napi-v8 --napi_version=8 --node_abi_napi=napi --napi_build_version=8 --node_napi_label=napi-v8 --python=C:\Users\redacted\.windows-build-tools\python27\python.exe --msvs_version=2015' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\redacted\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.19043
npm ERR! node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\redacted\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd C:\Users\redacted\node_modules\@tensorflow\tfjs-node
npm ERR! node-pre-gyp ERR! node -v v16.13.1
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.4
npm ERR! node-pre-gyp ERR! not ok
npm ERR! * Downloading libtensorflow
npm ERR!
npm ERR! * Building TensorFlow Node.js bindings

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\redacted\AppData\Local\npm-cache\_logs\2021-12-15T02_26_21_080Z-debug.log

Any idea on how to get around this? I've tried updating Node.

[Bug]:

Describe the bug
error when try to do on discord.com/register

Error: Evaluation failed: StatusCodeError: 400 - {"c":{"type":"hsw","req":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzIjoxNiwidCI6InciLCJkIjoiUVhYanVwWmVhR2pTSkFkNSt5RmhQbXZ3NG4xUGIyY0xuUEJJbXZMNnA5VTgvTUJ3VGxUUmtEb2JxdWlIZlZ4VjF3T2NxOFdZSVBlWWcrUldyQzBWaUJvckxNa1U3dExKdjU0UWpMQ3huKzJMSmgrUEM2QlNHcCtrNG5uTzlna2dxZmFJbFFoc1NMaFhFWEl2bk1xV0sybDdlNkh1eGIrQ1VYbWc1cGtodzJNR3l5bjVLb1V3ZXhQeFRRRT12dlhneGswTVdEOHBKNmtjIiwibCI6Imh0dHBzOi8vbmV3YXNzZXRzLmhjYXB0Y2hhLmNvbS9jLzNkZTUzMTlkIiwiZSI6MTY0MDYxNTk1Nn0.Oi-tHxN2EyO2l9OU3oPMB1i0UhCxAxb6oSMRb5xjEmE"},"pass":false,"error":"invalid"}

Demo not working

I have downloaded the latest version v4.0.1, however I am unable to run successfully the solve.js from the demo:

PS \...\puppeteer-hcaptcha-4.0.1\demos> node.exe .\solve.js
\...\puppeteer-hcaptcha-4.0.1\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:221
            throw new Error('Evaluation failed: ' + helper_js_1.helper.getExceptionMessage(exceptionDetails));
                  ^

Error: Evaluation failed: StatusCodeError: 413 - "Bad Request"
    at new StatusCodeError (\...node_modules\request-promise-core\lib\errors.js:32:15)
    at Request.plumbing.callback (\...node_modules\request-promise-core\lib\plumbing.js:104:33)
    at Request.RP$callback [as _callback] (\...node_modules\request-promise-core\lib\plumbing.js:46:31)
    at Request.self.callback (\...node_modules\request\request.js:185:22)
    at Request.emit (node:events:390:28)
    at Request.<anonymous> (\...node_modules\request\request.js:1154:10)
    at Request.emit (node:events:390:28)
    at IncomingMessage.<anonymous> (\...node_modules\request\request.js:1076:12)
    at Object.onceWrapper (node:events:509:28)
    at IncomingMessage.emit (node:events:402:35)
    at ExecutionContext._evaluateInternal (\...\puppeteer-hcaptcha-4.0.1\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:221:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async ExecutionContext.evaluate (\...\puppeteer-hcaptcha-4.0.1\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:110:16)
    at async hcaptcha (\...node_modules\puppeteer-hcaptcha\hcaptcha.js:241:17)
    at async \...\puppeteer-hcaptcha-4.0.1\demos\solve.js:40:3

I added the URL https://2captcha.com/demo/hcaptcha/ on line 34 of solve.js
I am not particularly familiar with JavaScript, maybe I am missing something.

Node js version

Hi, how are you?
What is the best version of node.js to run this project?
I am using this Latest LTS Version: 16.13.1 (includes npm 8.1.2) but it is not going well.
Thanks.

About new update

Hi, im here again. Your project is going well, good lucks. But im again getting similar error like before new update about for Cloudflare Hcaptcha pages.
TypeError: Cannot read property 'type' of undefined error here. Thanks.

Make Google Vision optional

If google vision just speeds up the solving process, is it possible to make it guess random values and make the vision client completely optional?

[Question]:

image
hello, when using hcaptcha bypass via puppeteer, unfortunately it does not work, but it can work as hcaptcha token. My question is can I use this hcaptcha token over puppeteer?

Using without an "submit" button

Hey,

on some HCaptcha protected sites there aren't any "submit" buttons like in your example.

If you try to register an account on Discord for example.

Are there any ways to solve this? I know on Recaptcha there was an callback function. But I don't know too much about HCaptcha.

Thanks:)

[Bug]: Incompatible with Heroku

Describe the bug
"Bug" may be inaccurate, but the closest fit.

Heroku limits the compressed slug size to 500MB (a year ago it was 300MB). With Puppeteer, this clocks in at 635 MB.

To Reproduce
Steps to reproduce the behavior:

  1. Deploy to Heroku
  2. Read error messages
  3. Cry

Example:

du -sh .[^.]* * | sort -hr

1.2G	node_modules
 69M	tmp
520K	.git
212K	package-lock.json
 84K	yarn.lock
 16K	index.js
 12K	.DS_Store
4.0K	preload.js
4.0K	package.json
4.0K	README.md
4.0K	Procfile
4.0K	.slugignore
4.0K	.gitignore
4.0K	.env

and

695M	@tensorflow
282M	puppeteer-hcaptcha
249M	puppeteer
9.5M	core-js
4.9M	lodash
2.3M	devtools-protocol
2.1M	@types
1.1M	ajv
1.0M	puppeteer-extra-plugin-stealth
804K	google-protobuf
640K	@mapbox
584K	uri-js
580K	puppeteer-extra-plugin-user-data-dir
440K	psl
436K	seedrandom
424K	request
420K	yargs
396K	iconv-lite
380K	es6-promise
364K	express
292K	sshpk
276K	are-we-there-yet
272K	tr46
260K	@tensorflow-models
256K	semver
248K	tar
232K	bezier-js
224K	fs-extra
216K	mime-db
212K	qs
200K	tweetnacl
196K	send
196K	body-parser
188K	puppeteer-extra-plugin
188K	long
184K	argparse
180K	readable-stream
176K	puppeteer-extra
172K	ws
164K	node-fetch
164K	gauge
148K	yargs-parser
148K	unbzip2-stream
148K	adm-zip
144K	finalhandler
132K	form-data
128K	.yarn-integrity
120K	verror
108K	make-dir
104K	tough-cookie
 96K	minimist
 96K	buffer
 92K	dashdash
 92K	bl
 88K	har-schema
 84K	uuid
 84K	asynckit
 80K	sprintf-js
 80K	minipass
 80K	http-signature
 76K	yauzl
 72K	whatwg-url
 72K	mime
 72K	fast-json-stable-stringify
 68K	performance-now
 68K	jsbn
 64K	glob
 64K	ghost-cursor
 64K	emoji-regex
 60K	safer-buffer
 60K	dotenv
 60K	debug
 60K	agent-base
 56K	tar-fs
 56K	shallow-clone
 56K	jwt-decode
 56K	ipaddr.js
 56K	https-proxy-agent
 52K	depd
 52K	deepmerge
 52K	chalk
 48K	tar-stream
 48K	punycode
 48K	proxy-from-env
 48K	jsprim
 48K	graceful-fs
 48K	fd-slicer
 48K	extsprintf
 48K	ecc-jsbn
 48K	cliui
 48K	asn1
 44K	y18n
 44K	through
 44K	safe-buffer
 44K	regenerator-runtime
 44K	negotiator
 44K	minimatch
 44K	json-schema-traverse
 44K	fast-deep-equal
 44K	extend
 44K	color-convert
 40K	request-promise-core
 40K	json-stringify-safe
 40K	escalade
 40K	bcrypt-pbkdf
 40K	aws4
 36K	serve-static
 36K	raw-body
 36K	nopt
 36K	jsonfile
 36K	json-schema
 36K	isstream
 36K	core-util-is
 32K	yallist
 32K	type-is
 32K	rimraf
 32K	require-directory
 32K	progress
 32K	npmlog
 32K	mixin-object
 32K	isarray
 32K	detect-libc
 32K	delegates
 32K	content-disposition
 32K	ansi-styles
 28K	tunnel-agent
 28K	pump
 28K	proxy-addr
 28K	minizlib
 28K	mime-types
 28K	http-errors
 28K	get-stream
 28K	fs.realpath
 28K	forever-agent
 28K	extract-zip
 28K	cookie
 28K	console-control-strings
 28K	concat-map
 28K	combined-stream
 28K	caseless
 28K	aws-sign2
 28K	assert-plus
 28K	accepts
 24K	webidl-conversions
 24K	util-deprecate
 24K	string_decoder
 24K	stealthy-require
 24K	statuses
 24K	signal-exit
 24K	setprototypeof
 24K	request-promise-native
 24K	on-finished
 24K	oauth-sign
 24K	mkdirp
 24K	media-typer
 24K	lru-cache
 24K	har-validator
 24K	getpass
 24K	get-caller-file
 24K	fs-minipass
 24K	etag
 24K	delayed-stream
 24K	content-type
 24K	bytes
 24K	base64-js
 20K	wrap-ansi
 20K	vary
 20K	utils-merge
 20K	unpipe
 20K	toidentifier
 20K	supports-color
 20K	strip-ansi
 20K	string-width
 20K	set-blocking
 20K	range-parser
 20K	puppeteer-extra-plugin-user-preferences
 20K	pkg-dir
 20K	pend
 20K	path-to-regexp
 20K	path-exists
 20K	parseurl
 20K	p-try
 20K	p-locate
 20K	p-limit
 20K	methods
 20K	merge-descriptors
 20K	merge-deep
 20K	locate-path
 20K	kind-of
 20K	isobject
 20K	is-typedarray
 20K	is-plain-object
 20K	is-fullwidth-code-point
 20K	is-buffer
 20K	inherits
 20K	ieee754
 20K	has-flag
 20K	fs-constants
 20K	fresh
 20K	forwarded
 20K	find-up
 20K	encodeurl
 20K	cookie-signature
 20K	color-name
 20K	clone-deep
 20K	chownr
 20K	buffer-crc32
 20K	brace-expansion
 20K	balanced-match
 20K	ansi-regex
 16K	wrappy
 16K	wide-align
 16K	universalify
 16K	process-nextick-args
 16K	path-is-absolute
 16K	once
 16K	object-assign
 16K	number-is-nan
 16K	ms
 16K	mkdirp-classic
 16K	lazy-cache
 16K	is-extendable
 16K	inflight
 16K	has-unicode
 16K	for-own
 16K	for-in
 16K	escape-html
 16K	es6-promisify
 16K	end-of-stream
 16K	ee-first
 16K	destroy
 16K	code-point-at
 16K	array-flatten
 16K	arr-union
 16K	aproba
 16K	abbrev
8.0K	.DS_Store
  0B	.bin

Ideal solution appears to be to adapt this to Tensorflow sub-2.0, which is a fraction of the size. Or, trim out unused modules, if any... but TF is clearly the behemoth.

taking too much time

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

(async () => {
    try {
      const response = await solveCaptcha('https://2captcha.com/');
      console.log(response);
      // F0_eyJ0eXAiOiJKV1Q...
    } catch (error) {
      console.log(error);
    }
})();

it takes lot of time ( 40 seconds )
Can I fix it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.