### Installation Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt Install the official Anti-Captcha Node.js SDK using npm. ```APIDOC ## Installation Install the package from npm to add captcha-solving capabilities to your Node.js application. ```bash npm install @antiadmin/anticaptchaofficial ``` ``` -------------------------------- ### Configuration and Setup Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt Configure the SDK with your API key and optionally set a soft ID. ```APIDOC ## Configuration and Setup ### setAPIKey Configure the API key required for authentication with the Anti-Captcha service. This must be called before any captcha-solving operations. ```javascript const ac = require('@antiadmin/anticaptchaofficial'); // Set your API key (required before making any requests) ac.setAPIKey('YOUR_API_KEY_HERE'); // Disable console output for production ac.shutUp(); // Optional: Set softId for 10% commission on captcha spending ac.setSoftId(123456); ``` ``` -------------------------------- ### Install Anti-Captcha npm Module Source: https://github.com/anti-captcha/anticaptcha-npm/blob/master/README.md Installs the official Anti-Captcha.com npm package using npm. This is the first step to integrating captcha solving capabilities into your Node.js application. ```bash npm install @antiadmin/anticaptchaofficial ``` -------------------------------- ### Initialize and Check Balance (Async/Await) Source: https://github.com/anti-captcha/anticaptcha-npm/blob/master/README.md Initializes the Anti-Captcha module, sets the API key, and checks the account balance using asynchronous operations. It logs the balance and throws an error if the balance is insufficient. Includes commented-out examples for solving different captcha types. ```javascript (async() => { const ac = require("@antiadmin/anticaptchaofficial"); ac.setAPIKey('YOUR_API_KEY'); try { const balance = await ac.getBalance(); console.log(`my balance is $${balance}`); if (balance <= 0) { throw "negative balance" } console.log("solving a captcha..") // const token = await ac.solveRecaptchaV2Proxyless('http://DOMAIN.COM', 'WEBSITE_KEY'); // const fs = require('fs'); // const text = await ac.solveImage(fs.readFileSync('captcha.png', { encoding: 'base64' }), true) } catch (e) { console.log("got error: ", e.toString()); } })(); ``` -------------------------------- ### Initialize and Check Balance (Promises) Source: https://github.com/anti-captcha/anticaptcha-npm/blob/master/README.md Initializes the Anti-Captcha module, sets the API key, and checks the account balance using Promises. It logs the balance and handles potential errors. Includes commented-out examples for solving Recaptcha V2. ```javascript const ac = require("@antiadmin/anticaptchaofficial"); ac.setAPIKey('YOUR_API_KEY'); ac.getBalance() .then(balance => { console.log('my balance is $' + balance) if (balance <= 0) { return false; } console.log("solving a captcha..") // ac.solveRecaptchaV2Proxyless('http://DOMAIN.COM', 'WEBSITE_KEY') // .then(token => { // console.log('Got g-response:', token) // // do something // }) // .catch(error => { // console.log('test received error ' + error) // return false; // }); }) .catch(error => console.log('received error '+error)) ``` -------------------------------- ### Complete Web Scraping Workflow with Captcha Solving (JavaScript) Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt An end-to-end example demonstrating a typical web scraping task that involves solving a reCAPTCHA. It includes checking account balance, solving the captcha using solveRecaptchaV2Proxyless, submitting the token via an HTTP POST request, and reporting the result to Anti-Captcha. Dependencies include 'axios' for HTTP requests. ```javascript const ac = require('@antiadmin/anticaptchaofficial'); const axios = require('axios'); ac.setAPIKey('YOUR_API_KEY'); ac.shutUp(); // Disable verbose output async function scrapeProtectedPage() { try { // Check balance first const balance = await ac.getBalance(); if (balance < 1) { throw new Error('Low balance, please top up'); } console.log(`Balance: $${balance}`); // Solve the captcha console.log('Solving reCAPTCHA...'); const gResponse = await ac.solveRecaptchaV2Proxyless( 'https://target-site.com/protected', '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-' ); console.log('Captcha solved!'); // Submit form with the token const response = await axios.post('https://target-site.com/api/submit', { 'g-recaptcha-response': gResponse, 'email': 'user@example.com', 'message': 'Hello world' }); if (response.data.success) { await ac.reportCorrectRecaptcha(); console.log('Form submitted successfully'); return response.data; } else { await ac.reportIncorrectRecaptcha(); throw new Error('Form submission failed'); } } catch (error) { console.error('Scraping failed:', error); throw error; } } scrapeProtectedPage() .then(result => console.log('Result:', result)) .catch(err => process.exit(1)); ``` -------------------------------- ### Get Subscription Credits Balance Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt Retrieve the remaining subscription credits balance for accounts with subscription plans. ```APIDOC ## Get Subscription Credits Balance ### getCreditsBalance Retrieve the remaining subscription credits balance for accounts with subscription plans. ```javascript const ac = require('@antiadmin/anticaptchaofficial'); ac.setAPIKey('YOUR_API_KEY'); (async () => { try { const credits = await ac.getCreditsBalance(); console.log(`Remaining credits: ${credits}`); } catch (error) { console.error('Failed to get credits balance:', error); } })(); ``` ``` -------------------------------- ### Get Anticaptcha Subscription Credits Balance Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt Retrieves the remaining subscription credits balance for accounts that utilize subscription plans. This is an alternative to checking the monetary balance for users on specific plans. It also uses async/await and includes error handling. ```javascript const ac = require('@antiadmin/anticaptchaofficial'); ac.setAPIKey('YOUR_API_KEY'); (async () => { try { const credits = await ac.getCreditsBalance(); console.log(`Remaining credits: ${credits}`); } catch (error) { console.error('Failed to get credits balance:', error); } })(); ``` -------------------------------- ### GET /getBalance Source: https://github.com/anti-captcha/anticaptcha-npm/blob/master/README.md Retrieves the current account balance for the authenticated user. ```APIDOC ## GET /getBalance ### Description Retrieves the current balance of the Anti-Captcha account associated with the provided API key. ### Method GET ### Endpoint getBalance() ### Response #### Success Response (200) - **balance** (number) - The current account balance in USD. #### Response Example { "balance": 1.25 } ``` -------------------------------- ### Get Subscription Credits Balance Source: https://github.com/anti-captcha/anticaptcha-npm/blob/master/README.md Retrieves the remaining balance of subscription credits available in the Anti-Captcha account. ```javascript const remainingCredits = await ac.getCreditsBalance(); ``` -------------------------------- ### Get Account Balance Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt Retrieve the current account balance in USD from the Anti-Captcha service. ```APIDOC ## Get Account Balance ### getBalance Retrieve the current account balance in USD from the Anti-Captcha service. ```javascript const ac = require('@antiadmin/anticaptchaofficial'); ac.setAPIKey('YOUR_API_KEY'); (async () => { try { const balance = await ac.getBalance(); console.log(`Account balance: $${balance}`); if (balance <= 0) { console.error('Insufficient balance, please top up'); return; } // Proceed with captcha solving } catch (error) { console.error('Failed to get balance:', error); } })(); ``` ``` -------------------------------- ### GET /waitForResult Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt Polls the API for the final solution of a specific task ID. ```APIDOC ## GET /waitForResult ### Description Manually polls the Anti-Captcha server for the result of a previously submitted task. Can be configured using settings like firstAttemptWaitingInterval. ### Method GET ### Endpoint /waitForResult ### Parameters #### Query Parameters - **taskId** (integer) - Required - The ID returned by the task submission. ### Response #### Success Response (200) - **solution** (object) - The result data returned by the solver. ``` -------------------------------- ### Get Anticaptcha Account Balance Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt Retrieves the current account balance in USD from the Anti-Captcha service. This function is crucial for checking if sufficient funds are available before attempting to solve captchas. It uses an async/await pattern and includes basic error handling. ```javascript const ac = require('@antiadmin/anticaptchaofficial'); ac.setAPIKey('YOUR_API_KEY'); (async () => { try { const balance = await ac.getBalance(); console.log(`Account balance: $${balance}`); if (balance <= 0) { console.error('Insufficient balance, please top up'); return; } // Proceed with captcha solving } catch (error) { console.error('Failed to get balance:', error); } })(); ``` -------------------------------- ### Configure Anticaptcha SDK with API Key and Settings Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt Sets up the Anticaptcha SDK by configuring the API key, disabling console output, and optionally setting a soft ID for commission tracking. The API key is mandatory before making any service requests. ```javascript const ac = require('@antiadmin/anticaptchaofficial'); // Set your API key (required before making any requests) ac.setAPIKey('YOUR_API_KEY_HERE'); // Disable console output for production ac.shutUp(); // Optional: Set softId for 10% commission on captcha spending ac.setSoftId(123456); ``` -------------------------------- ### Solve GeeTest v3 and v4 with Proxy Support Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt Demonstrates how to solve GeeTest challenges using proxy configurations. It requires the website URL, site keys, and proxy credentials to bypass bot detection. ```javascript const ac = require('@antiadmin/anticaptchaofficial'); ac.setAPIKey('YOUR_API_KEY'); (async () => { try { const solutionV3 = await ac.solveGeeTestProxyOn('https://example.com/verify', '81388ea1fc187e0c335c0a8907ff2625', 'e2a1c4c5e5c6a0b4d3c2b1a0f9e8d7c6', 'api.geetest.com', '', 'http', '123.45.67.89', '8080', 'proxy_user', 'proxy_pass', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)', 'session=xyz'); const solutionV4 = await ac.solveGeeTestV4ProxyOn('https://example.com/verify', 'e392e1d7fd421dc63325744d5a2b9c73', 'gcaptcha4.geetest.com', { 'riskType': 'slide' }, 'http', '123.45.67.89', '8080', 'proxy_user', 'proxy_pass', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)', 'session=xyz'); console.log('GeeTest solutions:', { v3: solutionV3, v4: solutionV4 }); } catch (error) { console.error('Failed to solve GeeTest with proxy:', error); } })(); ``` -------------------------------- ### AntiGate Tasks Source: https://github.com/anti-captcha/anticaptcha-npm/blob/master/README.md Handles custom AntiGate tasks, including solving tasks with provided parameters and proxy support. Also includes methods for sending tasks, delaying, and pushing variables. ```APIDOC ## AntiGate Tasks ### Description Handles custom AntiGate tasks, including solving tasks with provided parameters and proxy support. Also includes methods for sending tasks, delaying, and pushing variables. ### Methods - `solveAntiGateTask` - `sendAntiGateTask` - `delay` - `pushAntiGateVariable` - `waitForResult` ### Endpoint N/A (Client-side library methods) ### Parameters for `solveAntiGateTask` and `sendAntiGateTask` #### Path Parameters None #### Query Parameters - **url** (string) - Required - The URL of the AntiGate task endpoint. - **taskDescription** (string) - Required - A description of the task. - **taskParams** (object) - Required - Parameters specific to the task (e.g., CSS selectors, input values, control text). - **proxyType** (string) - Optional - The type of proxy (e.g., 'http', 'socks4', 'socks5'). - **proxyAddress** (string) - Optional - The IP address of the proxy server. - **proxyPort** (string) - Optional - The port of the proxy server. - **proxyLogin** (string) - Optional - The username for proxy authentication. - **proxyPassword** (string) - Optional - The password for proxy authentication. ### Request Example (solveAntiGateTask with proxy) ```javascript const solution = await ac.solveAntiGateTask( 'http://antigate.com/logintest.php', 'Sign-in and wait for control text', { "login_input_css": "#login", "login_input_value": "the login", "password_input_css": "#password", "password_input_value": "the password", "control_text": "You have been logged successfully" }, 'PROXY_IP', 'PROXY_PORT', 'PROXY_LOGIN', 'PROXY_PASSWORD'); console.log('cookies: ', solution.cookies); console.log('localStorage: ', solution.localStorage); console.log('url: ', solution.url); ``` ### Request Example (sendAntiGateTask with delay and push variable) ```javascript const taskId = await ac.sendAntiGateTask('http://antigate.com/logintest2fa.php', 'Sign-in with 2FA and wait for control text', { "login_input_css": "#login", "login_input_value": "the login", "password_input_css": "#password", "password_input_value": "the password", "2fa_input_css": "#2facode", "2fa_input_value": "_WAIT_FOR_IT_", "control_text": "You have been logged successfully" }); await ac.delay(5000); //simulate a delay in 2FA retrieval await ac.pushAntiGateVariable('2fa_input_value', '349001'); const solution = await ac.waitForResult(taskId); console.log('solution:'); console.log(solution); ``` ### Response #### Success Response (200) - **cookies** (object) - Cookies obtained during the task. - **localStorage** (object) - Local storage data. - **url** (string) - The final URL after task completion. - **taskId** (string) - The ID of the submitted task (for `sendAntiGateTask`). - **solution** (object) - The result of the task (for `waitForResult`). #### Response Example ```json { "cookies": { ... }, "localStorage": { ... }, "url": "http://example.com/completed", "taskId": "TASK_ID", "solution": { ... } } ``` ``` -------------------------------- ### Solve FunCaptcha with Proxy using anticaptcha-npm Source: https://github.com/anti-captcha/anticaptcha-npm/blob/master/README.md Solves a FunCaptcha (Arkoselabs) using a proxy. Requires website URL, site key, proxy type, IP, port, and optional proxy credentials. It also accepts an optional data blob and user agent. ```javascript ac.settings.funcaptchaDataBlob = 'blob value here is any, or leave it empty'; const token = await ac.solveFunCaptchaProxyOn( 'https://www.thewebsite.com/path', 'site-key', 'http', '1.2.3.4', 3128, 'proxy-login', 'proxy-password', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116', ''); ``` -------------------------------- ### GeeTest Proxy Solutions Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt Methods to solve GeeTest v3 and v4 challenges while routing requests through a specified proxy. ```APIDOC ## solveGeeTestProxyOn / solveGeeTestV4ProxyOn ### Description Solves GeeTest challenges by routing the request through a proxy server. ### Method Async Function ### Parameters - **websiteURL** (string) - Required - The URL of the page containing the captcha. - **gt** (string) - Required - The GeeTest public key. - **challenge** (string) - Required - The GeeTest challenge string (v3 only). - **apiServer** (string) - Required - The GeeTest API server domain. - **proxyType** (string) - Required - Type of proxy (http, socks4, socks5). - **proxyAddress** (string) - Required - Proxy IP address. - **proxyPort** (string) - Required - Proxy port. - **proxyLogin** (string) - Required - Proxy username. - **proxyPassword** (string) - Required - Proxy password. ### Response - **solution** (object) - The challenge solution object containing validate/seccode. ``` -------------------------------- ### Amazon WAF Solutions Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt Methods to solve Amazon WAF and Amazon Widget captchas, with both proxyless and proxy-supported options. ```APIDOC ## solveAmazonProxyless / solveAmazonProxyOn ### Description Solves Amazon WAF captcha challenges to obtain the required aws-waf-token cookie. ### Parameters - **websiteURL** (string) - Required - The URL of the protected page. - **websiteKey** (string) - Required - Key extracted from gokuProps. - **iv** (string) - Required - IV value from gokuProps. - **context** (string) - Required - Context value from gokuProps. - **proxyType** (string) - Optional - Type of proxy if using ProxyOn method. ### Response - **token** (string) - The resulting AWS WAF token. ``` -------------------------------- ### Solve Prosopo Captcha with and without Proxy using anticaptcha-npm Source: https://github.com/anti-captcha/anticaptcha-npm/blob/master/README.md Provides methods to solve Prosopo captchas. 'solveProsopoProxyless' is for solving without a proxy, requiring the website URL and website key. 'solveProsopoProxyOn' is for solving with a proxy, requiring additional proxy details. ```javascript const token = await ac.solveProsopoProxyless('http://DOMAIN.COM', 'WEBSITE_KEY'); ``` ```javascript const token = await ac.solveProsopoProxyOn('http://DOMAIN.COM', 'WEBSITE_KEY', 'http', //http, socks4, socks5 'PROXY_IP', 'PROXY_PORT', 'PROXY_LOGIN', 'PROXY_PASSWORD'); ``` -------------------------------- ### POST /solveImage Source: https://github.com/anti-captcha/anticaptcha-npm/blob/master/README.md Submits an image captcha for human solving. ```APIDOC ## POST /solveImage ### Description Submits a base64 encoded image to the Anti-Captcha service to be solved by human workers. ### Method POST ### Parameters #### Request Body - **captcha** (string) - Required - Base64 encoded image string. - **isPhrase** (boolean) - Optional - Set to true if the captcha contains multiple words. ### Request Example { "captcha": "iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==", "isPhrase": true } ### Response #### Success Response (200) - **text** (string) - The solved text from the image. #### Response Example { "text": "example" } ``` -------------------------------- ### Solve Amazon WAF and Widget with Proxy Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt Advanced implementation for solving Amazon WAF and Widget captchas using proxy servers. This is essential for bypassing IP-based restrictions during the solving process. ```javascript const ac = require('@antiadmin/anticaptchaofficial'); ac.setAPIKey('YOUR_API_KEY'); (async () => { try { const token = await ac.solveAmazonProxyOn('https://protected-site.com/page', 'key_from_gokuProps', 'http', '123.45.67.89', '8080', 'proxy_user', 'proxy_pass', 'iv_from_gokuProps', 'context_from_gokuProps'); const widgetToken = await ac.solveAmazonWidgetProxyOn('https://protected-site.com/action', 'widget_api_key', 'https://xxxxx.edge.captcha-sdk.awswaf.com/xxxxx/jsapi.js', 'http', '123.45.67.89', '8080', 'proxy_user', 'proxy_pass'); console.log('Tokens:', { waf: token, widget: widgetToken }); } catch (error) { console.error('Failed to solve Amazon with proxy:', error); } })(); ``` -------------------------------- ### Solve FunCaptcha (Arkose Labs) Challenges Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt Provides methods to solve Arkose Labs challenges, supporting optional data blobs and proxy configurations. ```javascript const ac = require('@antiadmin/anticaptchaofficial'); ac.setAPIKey('YOUR_API_KEY'); (async () => { try { ac.settings.funcaptchaDataBlob = 'blob_value_from_page'; ac.settings.funcaptchaApiJSSubdomain = 'client-api.arkoselabs.com'; const token = await ac.solveFunCaptchaProxyless('https://example.com/login', 'B7D8911C-5CC8-A9A3-35B0-554ACEE604DA'); console.log('FunCaptcha token:', token); } catch (error) { console.error('Failed to solve FunCaptcha:', error); } })(); ``` ```javascript const ac = require('@antiadmin/anticaptchaofficial'); ac.setAPIKey('YOUR_API_KEY'); (async () => { try { ac.settings.funcaptchaDataBlob = 'optional_blob_value'; const token = await ac.solveFunCaptchaProxyOn('https://example.com/login', 'B7D8911C-5CC8-A9A3-35B0-554ACEE604DA', 'http', '123.45.67.89', 3128, 'proxy_login', 'proxy_password', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36', 'session=abc123'); console.log('FunCaptcha token:', token); } catch (error) { console.error('Failed to solve FunCaptcha with proxy:', error); } })(); ``` -------------------------------- ### Handle Delayed Inputs with sendAntiGateTask (JavaScript) Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt Demonstrates how to send a task that requires a delayed input, such as a 2FA code. It uses placeholders for dynamic values and pushes the actual value later using pushAntiGateVariable. This is useful for login flows where a code is generated after the initial form submission. ```javascript const ac = require('@antiadmin/anticaptchaofficial'); ac.setAPIKey('YOUR_API_KEY'); (async () => { try { // Send task with placeholder for 2FA const taskId = await ac.sendAntiGateTask( 'https://example.com/login-2fa', 'Sign-in with 2FA and wait for control text', { 'login_input_css': '#email', 'login_input_value': 'user@example.com', 'password_input_css': '#password', 'password_input_value': 'secretpass', '2fa_input_css': '#totp-code', '2fa_input_value': '_WAIT_FOR_IT_', // Placeholder 'control_text': 'Dashboard' } ); // Wait for 2FA code to be generated/received await ac.delay(5000); const twoFactorCode = await get2FACode(); // Your 2FA retrieval function // Push the 2FA code to the running task await ac.pushAntiGateVariable('2fa_input_value', twoFactorCode); // Wait for final result const solution = await ac.waitForResult(taskId); console.log('Login solution:', solution); } catch (error) { console.error('Failed to complete 2FA login:', error); } })(); ``` -------------------------------- ### Solve Amazon WAF Captcha (Standalone Widget) with and without Proxy using anticaptcha-npm Source: https://github.com/anti-captcha/anticaptcha-npm/blob/master/README.md Addresses Amazon WAF captchas that appear as standalone widgets. 'solveAmazonWidgetProxyless' is for no-proxy usage, requiring the website URL, widget API key, and the integration script path. 'solveAmazonWidgetProxyOn' includes proxy settings. ```javascript const token = await ac.solveAmazonWidgetProxyless('http://DOMAIN.COM', 'widget_api_key', // get key from AwsWafCaptcha.renderCaptcha function 'https://164cb210e333.edge.captcha-sdk.awswaf.com/164cb210e333/jsapi.js' // full path to jsapi.js integration script ); ``` ```javascript const token = await ac.solveAmazonWidgetProxyOn('http://DOMAIN.COM', 'widget_api_key', 'https://164cb210e333.edge.captcha-sdk.awswaf.com/164cb210e333/jsapi.js', // full path to jsapi.js integration script 'http', //http, socks4, socks5 'PROXY_IP', 'PROXY_PORT', 'PROXY_LOGIN', 'PROXY_PASSWORD' ); ``` -------------------------------- ### Execute AntiGate Tasks Source: https://github.com/anti-captcha/anticaptcha-npm/blob/master/README.md Automate web interactions like logins or 2FA using AntiGate tasks, with support for proxies and delayed variable injection. ```javascript const solution = await ac.solveAntiGateTask( 'http://antigate.com/logintest.php', 'Sign-in and wait for control text', { "login_input_css": "#login", "login_input_value": "the login", "password_input_css": "#password", "password_input_value": "the password", "control_text": "You have been logged successfully" }); ``` ```javascript const taskId = await ac.sendAntiGateTask('http://antigate.com/logintest2fa.php', 'Sign-in with 2FA and wait for control text', { "login_input_css": "#login", "login_input_value": "the login", "password_input_css": "#password", "password_input_value": "the password", "2fa_input_css": "#2facode", "2fa_input_value": "_WAIT_FOR_IT_", "control_text": "You have been logged successfully" }); await ac.delay(5000); await ac.pushAntiGateVariable('2fa_input_value', '349001'); const solution = await ac.waitForResult(taskId); ``` -------------------------------- ### Solve Friendly Captcha with and without Proxy using anticaptcha-npm Source: https://github.com/anti-captcha/anticaptcha-npm/blob/master/README.md Offers solutions for Friendly Captcha. 'solveFriendlyCaptchaProxyless' works without a proxy, needing the website URL and website key. 'solveFriendlyCaptchaProxyOn' integrates with a proxy, requiring proxy connection details. ```javascript const token = await ac.solveFriendlyCaptchaProxyless('http://DOMAIN.COM', 'WEBSITE_KEY'); ``` ```javascript const token = await ac.solveFriendlyCaptchaProxyOn('http://DOMAIN.COM', 'WEBSITE_KEY', 'http', //http, socks4, socks5 'PROXY_IP', 'PROXY_PORT', 'PROXY_LOGIN', 'PROXY_PASSWORD'); ``` -------------------------------- ### Funcaptcha / Arkoselabs without proxy Source: https://github.com/anti-captcha/anticaptcha-npm/blob/master/README.md Solves FunCaptcha (Arkoselabs) using the proxyless method. Allows for an optional data blob setting. ```APIDOC ## Funcaptcha / Arkoselabs without proxy ### Description Solves FunCaptcha (Arkoselabs) using the proxyless method. Allows for an optional data blob setting. ### Method `solveFunCaptchaProxyless` ### Endpoint N/A (Client-side library method) ### Parameters #### Path Parameters None #### Query Parameters - **url** (string) - Required - The URL of the page with the FunCaptcha. - **siteKey** (string) - Required - The FunCaptcha site key. - **dataBlob** (string) - Optional - A data blob value to be used with the captcha. ### Request Example ```javascript // Optional data blob: ac.settings.funcaptchaDataBlob = 'blob value here is any, or leave it empty'; const token = await ac.solveFunCaptchaProxyless('https://www.thewebsite.com/path', 'site-key'); ``` ### Response #### Success Response (200) - **token** (string) - The FunCaptcha solution token. #### Response Example ```json { "token": "SOLUTION_TOKEN" } ``` ``` -------------------------------- ### Solve Amazon WAF Captcha (Bot Filtering Page) with and without Proxy using anticaptcha-npm Source: https://github.com/anti-captcha/anticaptcha-npm/blob/master/README.md Handles Amazon WAF captchas appearing on bot filtering pages. 'solveAmazonProxyless' is for no-proxy scenarios, requiring URL and specific values from the page's JavaScript objects. 'solveAmazonProxyOn' includes proxy configuration. ```javascript const token = await ac.solveAmazonProxyless('http://DOMAIN.COM', 'key_value_from_window.gokuProps_object', 'iv_value_from_window.gokuProps_object', 'context_value_from_window.gokuProps_object', 'https://e9b10f157f38.9a96e8b4.us-gov-west-1.captcha.awswaf.com/e9b10f157f38/76cbcde1c834/2a564e323e7b/captcha.js', //optional 'https://e9b10f157f38.9a96e8b4.us-gov-west-1.token.awswaf.com/e9b10f157f38/76cbcde1c834/2a564e323e7b/challenge.js' //optional ); ``` ```javascript const token = await ac.solveAmazonProxyOn('http://DOMAIN.COM', 'key_value_from_window.gokuProps_object', 'http', //http, socks4, socks5 'PROXY_IP', 'PROXY_PORT', 'PROXY_LOGIN', 'PROXY_PASSWORD', 'iv_value_from_window.gokuProps_object', 'context_value_from_window.gokuProps_object', 'https://e9b10f157f38.9a96e8b4.us-gov-west-1.captcha.awswaf.com/e9b10f157f38/76cbcde1c834/2a564e323e7b/captcha.js', //optional 'https://e9b10f157f38.9a96e8b4.us-gov-west-1.token.awswaf.com/e9b10f157f38/76cbcde1c834/2a564e323e7b/challenge.js' //optional ); ``` -------------------------------- ### Utility Functions Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt Helper functions for managing flow control and account status. ```APIDOC ## Utility Functions ### getBalance - **Description**: Retrieves the current account balance. - **Returns**: (float) Current balance in USD. ### delay - **Description**: Creates an asynchronous pause in execution. - **Parameters**: - **ms** (integer) - Time in milliseconds to wait. ### pushAntiGateVariable - **Description**: Updates a variable in a running AntiGate task. - **Parameters**: - **key** (string) - The variable name to update. - **value** (string) - The new value to inject. ``` -------------------------------- ### POST /sendAntiGateTask Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt Initiates a task that requires interaction with a web page, supporting delayed variables like 2FA codes. ```APIDOC ## POST /sendAntiGateTask ### Description Initiates a complex web interaction task. Supports placeholders like '_WAIT_FOR_IT_' for variables that are provided later via pushAntiGateVariable. ### Method POST ### Endpoint /sendAntiGateTask ### Parameters #### Request Body - **url** (string) - Required - The target website URL. - **templateName** (string) - Required - The name of the predefined task template. - **variables** (object) - Required - Key-value pairs for form inputs and control selectors. ### Request Example { "url": "https://example.com/login-2fa", "templateName": "Sign-in with 2FA", "variables": { "login_input_css": "#email", "2fa_input_value": "_WAIT_FOR_IT_" } } ### Response #### Success Response (200) - **taskId** (integer) - The unique identifier for the created task. ``` -------------------------------- ### Solve FunCaptcha Source: https://github.com/anti-captcha/anticaptcha-npm/blob/master/README.md Method for solving Arkoselabs/FunCaptcha challenges without a proxy. ```javascript ac.settings.funcaptchaDataBlob = 'blob value here is any, or leave it empty'; const token = await ac.solveFunCaptchaProxyless( 'https://www.thewebsite.com/path', 'site-key'); ``` -------------------------------- ### Solve Altcha Captcha Proxyless Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt Demonstrates solving Altcha captchas without a proxy using either a challenge URL or a raw challenge JSON object. This method requires the target website URL and the challenge data. ```javascript const ac = require('@antiadmin/anticaptchaofficial'); ac.setAPIKey('YOUR_API_KEY'); (async () => { try { const token1 = await ac.solveAltchaProxyless('https://example.com/form', '/api/altcha/challenge', ''); const token2 = await ac.solveAltchaProxyless('https://example.com/form', '', JSON.stringify({ algorithm: 'SHA-256', challenge: '2a40f7ba3393f9513011179de41c7221f14e563856de2f647233a00accf9c28b', salt: '08d7f273d79df143355b9e5n', signature: '1de2bbf282420aef6ca0a84c38c85e2b1e40023d28bef72278d735555a8f47fb' })); console.log('Altcha token:', token1 || token2); } catch (error) { console.error('Failed to solve Altcha:', error); } })(); ``` -------------------------------- ### Solve Altcha Captcha with Proxy using Anti-Captcha NPM Source: https://github.com/anti-captcha/anticaptcha-npm/blob/master/README.md This snippet shows how to solve Altcha captchas using a proxy. It allows specifying proxy type (http, socks4, socks5), IP, port, and authentication credentials. Similar to the proxyless method, it accepts either a challenge URL or challenge JSON. ```javascript const token = await ac.solveAltchaProxyOn('http://DOMAIN.COM', '/some/challenge/url', null, 'http', //http, socks4, socks5 'PROXY_IP', 'PROXY_PORT', 'PROXY_LOGIN', 'PROXY_PASSWORD'); ``` ```javascript const token = await ac.solveAltchaProxyOn('http://DOMAIN.COM', '', '{"algorithm":"SHA-256","challenge":"2a40f7ba3393f9513011179de41c7221f14e563856de2f647233a00accf9c28b","salt":"08d7f273d79df143355b9e5n","signature":"1de2bbf282420aef6ca0a84c38c85e2b1e40023d28bef72278d735555a8f47fb"}', 'http', //http, socks4, socks5 'PROXY_IP', 'PROXY_PORT', 'PROXY_LOGIN', 'PROXY_PASSWORD'); ``` -------------------------------- ### Execute AntiGate Browser Automation Task Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt Performs complex browser automation tasks using predefined templates. Returns session data like cookies, localStorage, and the final URL after task completion. ```javascript const ac = require('@antiadmin/anticaptchaofficial'); ac.setAPIKey('YOUR_API_KEY'); (async () => { try { const solution = await ac.solveAntiGateTask('https://example.com/login', 'Sign-in and wait for control text', { 'login_input_css': '#username', 'login_input_value': 'myuser@email.com', 'password_input_css': '#password', 'password_input_value': 'mypassword123', 'control_text': 'Welcome back' }); console.log('Cookies:', solution.cookies); console.log('LocalStorage:', solution.localStorage); console.log('Final URL:', solution.url); } catch (error) { console.error('Failed to complete AntiGate task:', error); } })(); ``` -------------------------------- ### Solve Altcha Captcha Proxyless with Anti-Captcha NPM Source: https://github.com/anti-captcha/anticaptcha-npm/blob/master/README.md This snippet demonstrates how to solve Altcha captchas without using a proxy. It supports providing either a challenge URL or the challenge JSON directly. The function returns a token upon successful solving. ```javascript const token = await ac.solveAltchaProxyless('http://DOMAIN.COM', '/some/challenge/url'); ``` ```javascript const token = await ac.solveAltchaProxyless('http://DOMAIN.COM', '', '{"algorithm":"SHA-256","challenge":"2a40f7ba3393f9513011179de41c7221f14e563856de2f647233a00accf9c28b","salt":"08d7f273d79df143355b9e5n","signature":"1de2bbf282420aef6ca0a84c38c85e2b1e40023d28bef72278d735555a8f47fb"}'); ``` -------------------------------- ### Solve GeeTest v3 without Proxy using anticaptcha-npm Source: https://github.com/anti-captcha/anticaptcha-npm/blob/master/README.md Solves a GeeTest version 3 captcha without using a proxy. Requires the website URL, the 'gt' key, and the 'challenge' value. An optional API domain can also be provided. ```javascript const token = await ac.solveGeeTestProxyless( 'https://www.thewebsite.com/path', 'gt key 32 bytes', 'challenge value 32 bytes', 'optional.api-domain.com'); ``` -------------------------------- ### Custom Task Result Polling with waitForResult (JavaScript) Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt Shows how to manually poll for task results using the waitForResult method. This allows for custom handling of task statuses and provides control over polling intervals. It's useful when you need more granular control than the default waiting mechanisms. ```javascript const ac = require('@antiadmin/anticaptchaofficial'); ac.setAPIKey('YOUR_API_KEY'); (async () => { try { // Configure polling intervals ac.settings.firstAttemptWaitingInterval = 10; // Wait 10s before first check ac.settings.normalWaitingInterval = 3; // Check every 3s thereafter // Solve a captcha and get the task ID const taskId = await ac.sendAntiGateTask( 'https://example.com', 'Template Name', { 'param': 'value' } ); // Custom result polling const solution = await ac.waitForResult(taskId); console.log('Solution:', solution); } catch (error) { console.error('Error:', error); } })(); ``` -------------------------------- ### Other Captcha Solving Methods with Anti-Captcha NPM Source: https://github.com/anti-captcha/anticaptcha-npm/blob/master/README.md This snippet lists various other captcha-solving methods available in the Anti-Captcha NPM package. These include solutions for reCAPTCHA Enterprise, hCaptcha, and GeeTest, with options for proxy usage. ```javascript await ac.solveRecaptchaV2EnterpriseProxyOn( ... ); //Recaptcha V2 Enterprise with proxy ``` ```javascript await ac.solveRecaptchaV3Enterprise( ... ); //Recaptcha V3 Enterprise ``` ```javascript await ac.solveHCaptchaProxyOn( ... ); //hCaptcha with proxy ``` ```javascript await ac.solveGeeTestProxyOn( ... ); //Solve Geetest with proxy ``` ```javascript await ac.solveGeeTestV4ProxyOn( ... ); //Bypass Geetest V4 with proxy ``` -------------------------------- ### Solve GeeTest Challenges Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt Handles GeeTest v3 and v4 verification challenges using the Anti-Captcha service. ```javascript const ac = require('@antiadmin/anticaptchaofficial'); ac.setAPIKey('YOUR_API_KEY'); (async () => { try { const solution = await ac.solveGeeTestProxyless('https://example.com/verify', '81388ea1fc187e0c335c0a8907ff2625', 'e2a1c4c5e5c6a0b4d3c2b1a0f9e8d7c6', 'api.geetest.com'); console.log('GeeTest solution:', solution); } catch (error) { console.error('Failed to solve GeeTest:', error); } })(); ``` ```javascript const ac = require('@antiadmin/anticaptchaofficial'); ac.setAPIKey('YOUR_API_KEY'); (async () => { try { const solution = await ac.solveGeeTestV4Proxyless('https://example.com/verify', 'e392e1d7fd421dc63325744d5a2b9c73', 'gcaptcha4.geetest.com', {'riskType': 'slide'}); console.log('GeeTest v4 solution:', solution); } catch (error) { console.error('Failed to solve GeeTest v4:', error); } })(); ``` -------------------------------- ### Solve Cloudflare Turnstile Captchas Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt Demonstrates how to solve Turnstile challenges using the Anti-Captcha API. Includes both proxyless and proxy-enabled implementations. ```javascript const ac = require('@antiadmin/anticaptchaofficial'); ac.setAPIKey('YOUR_API_KEY'); (async () => { try { const token = await ac.solveTurnstileProxyless('https://example.com/protected', '0x4AAAAAAADnPIDROrmt1Wwj', 'managed', 'cData_token_value'); console.log('Turnstile token:', token); } catch (error) { console.error('Failed to solve Turnstile:', error); } })(); ``` ```javascript const ac = require('@antiadmin/anticaptchaofficial'); ac.setAPIKey('YOUR_API_KEY'); (async () => { try { const token = await ac.solveTurnstileProxyOn('https://example.com/protected', '0x4AAAAAAADnPIDROrmt1Wwj', 'http', '123.45.67.89', '8080', 'proxy_user', 'proxy_pass', 'managed', 'cData_value', 'chlPageData_value'); console.log('Turnstile token:', token); } catch (error) { console.error('Failed to solve Turnstile with proxy:', error); } })(); ``` -------------------------------- ### Report Recaptcha V3 as correctly solved Source: https://github.com/anti-captcha/anticaptcha-npm/blob/master/README.md Reports the last solved reCAPTCHA V3 as correctly solved. This feedback helps improve the service. ```APIDOC ## Report Recaptcha V3 as correctly solved ### Description Reports the last solved reCAPTCHA V3 as correctly solved. This feedback helps improve the service. ### Method `reportCorrectRecaptcha` ### Endpoint N/A (Client-side library method) ### Parameters None ### Request Example ```javascript await ac.reportCorrectRecaptcha(); ``` ### Response #### Success Response (200) Indicates the report was successful. #### Response Example ```json { "status": "success" } ``` ``` -------------------------------- ### Solve Altcha Captcha with Proxy Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt Solves Altcha captchas by routing the request through a specified proxy server. Requires proxy credentials and connection details. ```javascript const ac = require('@antiadmin/anticaptchaofficial'); ac.setAPIKey('YOUR_API_KEY'); (async () => { try { const token = await ac.solveAltchaProxyOn('https://example.com/form', '/api/altcha/challenge', null, 'http', '123.45.67.89', '8080', 'proxy_user', 'proxy_pass'); console.log('Altcha token:', token); } catch (error) { console.error('Failed to solve Altcha with proxy:', error); } })(); ``` -------------------------------- ### Solve Image-to-Coordinates Captcha using anticaptcha-npm Source: https://github.com/anti-captcha/anticaptcha-npm/blob/master/README.md Solves an image-based captcha by providing the image data (base64 encoded) and a description of the objects to select. It returns coordinates. This snippet also includes how to report an incorrect image captcha. ```javascript const fs = require('fs'); const captcha = fs.readFileSync('captcha.png', { encoding: 'base64' }); const coordinates = await ac.solveImageToCoordinates(captcha, "Select all objects in specified order", "points"); ``` ```javascript await ac.reportIncorrectImageCaptcha(); ``` -------------------------------- ### Solve Image Captcha with Anticaptcha SDK Source: https://context7.com/anti-captcha/anticaptcha-npm/llms.txt Solves standard image-based captchas by sending a base64-encoded image to the Anti-Captcha service. It allows for detailed configuration of captcha parameters such as case sensitivity, character count, and language. The function returns the solved text. ```javascript const ac = require('@antiadmin/anticaptchaofficial'); const fs = require('fs'); ac.setAPIKey('YOUR_API_KEY'); (async () => { try { // Read captcha image and convert to base64 const captchaImage = fs.readFileSync('captcha.png', { encoding: 'base64' }); // Configure image captcha settings (optional) ac.settings.phrase = true; // Captcha contains 2 words ac.settings.case = true; // Case-sensitive ac.settings.numeric = 1; // 1 = only numbers, 2 = only letters ac.settings.math = false; // Set true for math operations (e.g., 50+2) ac.settings.minLength = 4; // Minimum character count ac.settings.maxLength = 8; // Maximum character count ac.settings.languagePool = 'en'; // Language: en, rn (Russian), etc. ac.settings.comment = 'Enter the characters shown'; // Instruction for workers const text = await ac.solveImage(captchaImage); console.log('Solved captcha text:', text); } catch (error) { console.error('Failed to solve image captcha:', error); } })(); ```