Node.js SDK
Official Node.js library for MyDisct Solver - Enterprise AI-Powered Captcha Solving Service with 21+ token types and 25+ image types. Full TypeScript support included.
The MyDisct Solver Node.js SDK provides a simple and intuitive interface for solving all types of captchas. It handles task creation, polling, and result retrieval automatically. Perfect for automation projects, web scraping, testing, and any Node.js application that needs captcha solving capabilities.
Installation
npm install mydisct-solver
Or using Yarn:
yarn add mydisct-solver
Quick Start
const { MyDisctSolver } = require('mydisct-solver');
const solver = new MyDisctSolver('YOUR_API_KEY');
const token = await solver.recaptchaV2Token({
siteUrl: 'https://example.com',
siteKey: '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-'
});
console.log('Token:', token);
TypeScript Usage
import { MyDisctSolver, RecaptchaV2Options } from 'mydisct-solver';
const solver = new MyDisctSolver('YOUR_API_KEY');
const options: RecaptchaV2Options = {
siteUrl: 'https://example.com',
siteKey: '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-',
invisible: false
};
const token: string = await solver.recaptchaV2Token(options);
Initialization
Constructor
const solver = new MyDisctSolver(apiKey, baseURL?);
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKey |
string | required | Your MyDisct Solver API key |
baseURL |
string | optional | Custom API base URL (default: https://solver-api.mydisct.com) |
Example with Custom Base URL
const solver = new MyDisctSolver(
'YOUR_API_KEY',
'https://custom-api.mydisct.com'
);
Token-Based Captchas (21 Types)
Token-based captchas return a verification token that you submit with your form or API request. These methods handle the entire solving process automatically and return the token string.
Complete Token Methods Reference
| Method | Captcha Type | Required Parameters |
|---|---|---|
recaptchaV2Token() |
Google reCAPTCHA v2 | siteUrl, siteKey |
recaptchaV3Token() |
Google reCAPTCHA v3 | siteUrl, siteKey |
recaptchaV2EnterpriseToken() |
reCAPTCHA v2 Enterprise | siteUrl, siteKey |
recaptchaV3EnterpriseToken() |
reCAPTCHA v3 Enterprise | siteUrl, siteKey |
hCaptchaToken() |
hCaptcha | siteUrl, siteKey |
hCaptchaEnterpriseToken() |
hCaptcha Enterprise | siteUrl, siteKey |
cloudflareTurnstileToken() |
Cloudflare Turnstile | siteUrl, siteKey |
cloudflareTurnstileManagedToken() |
Cloudflare Turnstile Managed | siteUrl, siteKey, data, chlPageData |
cloudflareChallengeToken() |
Cloudflare Challenge | siteUrl, proxy |
funCaptchaToken() |
FunCaptcha (Arkose Labs) | siteUrl, siteKey |
geeTestV4Token() |
GeeTest v4 | siteUrl, siteKey, proxy |
mtCaptchaToken() |
MTCaptcha | siteUrl, siteKey |
leminCaptchaToken() |
Lemin CAPTCHA | siteUrl, siteKey |
friendlyCaptchaToken() |
Friendly Captcha | siteUrl, siteKey |
dataDomeToken() |
DataDome | siteUrl, siteKey, proxy |
altchaCaptchaToken() |
Altcha | siteUrl, challenge, iterations, salt, signature |
tencentCaptchaToken() |
Tencent Captcha | siteUrl, siteKey |
netEaseCaptchaToken() |
NetEase Captcha | siteUrl, siteKey |
faucetPayCaptchaToken() |
FaucetPay Captcha | siteUrl, siteKey |
captchaFoxToken() |
CaptchaFox | siteUrl, siteKey |
awsCaptchaToken() |
AWS WAF Captcha | siteUrl, siteKey |
recaptchaV2Token()
Solve Google reCAPTCHA v2 checkbox and invisible captchas.
const token = await solver.recaptchaV2Token({
siteUrl: 'https://example.com',
siteKey: '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-',
invisible: false, // optional
userAgent: 'Mozilla/5.0...', // optional
cookies: [{name: 'session', value: 'abc', domain: '.example.com'}], // optional
domain: 'google.com', // optional
proxy: {protocol: 'http', host: '1.2.3.4', port: 8080} // optional
});
recaptchaV3Token()
Solve Google reCAPTCHA v3 score-based captchas.
const token = await solver.recaptchaV3Token({
siteUrl: 'https://example.com',
siteKey: '6LdO5_IbAAAAAAeVBL9TClS19NUTt5wswEb3Q7m5',
recaptchaAction: 'submit', // optional, default: 'verify'
userAgent: 'Mozilla/5.0...', // optional
cookies: [], // optional
domain: 'google.com', // optional
proxy: {} // optional
});
recaptchaV2EnterpriseToken()
Solve Google reCAPTCHA v2 Enterprise.
const token = await solver.recaptchaV2EnterpriseToken({
siteUrl: 'https://example.com',
siteKey: '6LcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxAA',
sValue: 'optional_s_value', // optional
userAgent: 'Mozilla/5.0...', // optional
cookies: [], // optional
proxy: {} // optional
});
recaptchaV3EnterpriseToken()
Solve Google reCAPTCHA v3 Enterprise.
const token = await solver.recaptchaV3EnterpriseToken({
siteUrl: 'https://example.com',
siteKey: '6LcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxAA',
recaptchaAction: 'login', // optional
sValue: 'optional_s_value', // optional
userAgent: 'Mozilla/5.0...', // optional
cookies: [], // optional
proxy: {} // optional
});
hCaptchaToken()
Solve standard hCaptcha challenges.
const token = await solver.hCaptchaToken({
siteUrl: 'https://example.com',
siteKey: 'a5f74b19-9e45-40e0-b45d-47ff91b7a6c2',
invisible: false, // optional
rqdata: 'custom_rqdata', // optional
userAgent: 'Mozilla/5.0...', // optional
proxy: {} // optional
});
hCaptchaEnterpriseToken()
Solve hCaptcha Enterprise (e.g., Discord, Epic Games).
const token = await solver.hCaptchaEnterpriseToken({
siteUrl: 'https://discord.com/register',
siteKey: 'f5561ba9-8f1e-40ca-9b5b-a0b3f719ef34',
domain: 'discord.com', // optional
rqdata: 'custom_rqdata', // optional
userAgent: 'Mozilla/5.0...', // optional
cookies: [{name: '__dcfduid', value: '...', domain: '.discord.com'}], // optional
proxy: {} // optional
});
cloudflareTurnstileToken()
Solve Cloudflare Turnstile challenges.
const token = await solver.cloudflareTurnstileToken({
siteUrl: 'https://example.com',
siteKey: '0x4AAAAAAAC3DHQFLr1GavRN',
proxy: {} // optional
});
cloudflareTurnstileManagedToken()
Solve Cloudflare Turnstile Managed challenges.
const token = await solver.cloudflareTurnstileManagedToken({
siteUrl: 'https://example.com',
siteKey: '0x4AAAAAAAC3DHQFLr1GavRN',
data: 'challenge_data',
chlPageData: 'page_data',
userAgent: 'Mozilla/5.0...', // optional
proxy: {} // optional
});
cloudflareChallengeToken()
Solve Cloudflare browser challenges (5-second wait page).
const token = await solver.cloudflareChallengeToken({
siteUrl: 'https://example.com',
userAgent: 'Mozilla/5.0...', // optional
proxy: {protocol: 'http', host: '1.2.3.4', port: 8080} // required
});
funCaptchaToken()
Solve Arkose Labs FunCaptcha.
const token = await solver.funCaptchaToken({
siteUrl: 'https://example.com',
siteKey: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
subdomain: 'custom-subdomain', // optional
data: 'additional_data', // optional
userAgent: 'Mozilla/5.0...', // optional
proxy: {} // optional
});
geeTestV4Token()
Solve GeeTest v4 challenges.
const token = await solver.geeTestV4Token({
siteUrl: 'https://example.com',
siteKey: 'captcha_id_here',
apiServerSubdomain: 'api-subdomain', // optional
proxy: {protocol: 'http', host: '1.2.3.4', port: 8080} // required
});
mtCaptchaToken()
Solve MTCaptcha challenges.
const token = await solver.mtCaptchaToken({
siteUrl: 'https://example.com',
siteKey: 'MTPublic-KzqLY1cKH'
});
leminCaptchaToken()
Solve Lemin CAPTCHA challenges.
const token = await solver.leminCaptchaToken({
siteUrl: 'https://example.com',
siteKey: 'CROPPED_2dfdd3c_d1232b323b232d23ba2b323eb23a232b',
proxy: {} // optional
});
friendlyCaptchaToken()
Solve Friendly Captcha challenges.
const token = await solver.friendlyCaptchaToken({
siteUrl: 'https://example.com',
siteKey: 'FCMGEMUD2KTDSQ5H',
proxy: {} // optional
});
dataDomeToken()
Solve DataDome challenges.
const token = await solver.dataDomeToken({
siteUrl: 'https://example.com',
siteKey: 'datadome_key',
userAgent: 'Mozilla/5.0...', // optional
proxy: {protocol: 'http', host: '1.2.3.4', port: 8080} // required
});
altchaCaptchaToken()
Solve Altcha proof-of-work challenges.
const token = await solver.altchaCaptchaToken({
siteUrl: 'https://example.com',
challenge: 'challenge_string',
iterations: 100000,
salt: 'salt_string',
signature: 'signature_string',
userAgent: 'Mozilla/5.0...', // optional
proxy: {} // optional
});
tencentCaptchaToken()
Solve Tencent Captcha challenges.
const token = await solver.tencentCaptchaToken({
siteUrl: 'https://example.com',
siteKey: '190014885',
proxy: {} // optional
});
netEaseCaptchaToken()
Solve NetEase Captcha challenges (China).
const token = await solver.netEaseCaptchaToken({
siteUrl: 'https://example.com',
siteKey: '6cw0f0485d5d46auacf9b735d20218a5',
jsLibUrl: 'https://...', // optional
apiServerSubdomain: 'subdomain', // optional
userAgent: 'Mozilla/5.0...', // optional
captchaId: 'id', // optional
captchaHash: 'hash', // optional
captchaTimestamp: 1234567890, // optional
proxy: {} // optional
});
faucetPayCaptchaToken()
Solve FaucetPay Captcha challenges.
const token = await solver.faucetPayCaptchaToken({
siteUrl: 'https://example.com',
siteKey: 'b7890hre5cf2544b2759c19fb2600897',
userAgent: 'Mozilla/5.0...', // optional
proxy: {} // optional
});
captchaFoxToken()
Solve CaptchaFox challenges.
const token = await solver.captchaFoxToken({
siteUrl: 'https://example.com',
siteKey: 'cfox_...',
userAgent: 'Mozilla/5.0...', // optional
proxy: {} // optional
});
awsCaptchaToken()
Solve AWS WAF Captcha challenges.
const token = await solver.awsCaptchaToken({
siteUrl: 'https://example.com',
siteKey: 'aws_waf_key',
context: 'context_data', // optional
proxy: {} // optional
});
Image-Based Captchas (25 Types)
Image-based captchas require you to provide the captcha image(s) as base64-encoded strings. The SDK will analyze the images and return the solution (text, coordinates, angle, etc.).
Complete Image Methods Reference
| Method | Captcha Type | Required Parameters |
|---|---|---|
textCaptchaImage() |
Text Recognition (OCR) | siteUrl, images |
recaptchaImage() |
reCAPTCHA Image Grid | siteUrl, images, question, questionType |
hCaptchaImage() |
hCaptcha Image | siteUrl, images, question |
funCaptchaImage() |
FunCaptcha Image | siteUrl, images, question |
geeTestV3Image() |
GeeTest v3 Image | siteUrl, images, question |
geeTestV4Image() |
GeeTest v4 Image | siteUrl, images, question |
tikTokImage() |
TikTok Captcha | siteUrl, images, question |
rotateImage() |
Rotate Image | siteUrl, images |
slideCaptchaImage() |
Slide Puzzle | siteUrl, images |
clickCaptchaImage() |
Click Captcha | siteUrl, images, question |
gridCaptchaImage() |
Grid Selection | siteUrl, images, question |
multiSelectImage() |
Multi-Select | siteUrl, images, question |
dragCaptchaImage() |
Drag Captcha | siteUrl, images, question |
mtCaptchaImage() |
MTCaptcha Image | siteUrl, images |
leminCaptchaImage() |
Lemin Image | siteUrl, images, question |
dataDomeCaptchaImage() |
DataDome Image | siteUrl, images |
captchaFoxImage() |
CaptchaFox Image | siteUrl, images, question |
binanceImage() |
Binance Puzzle | siteUrl, images, question, questionType |
blsImage() |
BLS Captcha | siteUrl, images, question |
shopeeImage() |
Shopee Puzzle | siteUrl, images, question |
temuCaptchaImage() |
Temu Captcha | siteUrl, images |
tencentImage() |
Tencent Image | siteUrl, images, question |
awsWAFImage() |
AWS WAF Image | siteUrl, images, question |
prosopoImage() |
Prosopo Image | siteUrl, images, question |
faucetPayImage() |
FaucetPay Image | siteUrl, images, question |
textCaptchaImage()
Solve text-based image captchas (OCR).
const solution = await solver.textCaptchaImage({
siteUrl: 'https://example.com',
images: ['data:image/png;base64,iVBORw0KGgoAAAANS...'],
questionType: 'text', // optional
caseSensitive: false, // optional
numeric: false, // optional
minLength: 4, // optional
maxLength: 6, // optional
referenceImages: [] // optional
});
console.log('Captcha text:', solution);
recaptchaImage()
Solve reCAPTCHA image grid challenges.
const solution = await solver.recaptchaImage({
siteUrl: 'https://example.com',
images: [
'data:image/png;base64,iVBORw0KGgoAAAANS...',
'data:image/png;base64,iVBORw0KGgoAAAANS...',
],
question: 'Select all images with traffic lights',
questionType: 'grid_3x3'
});
console.log('Selected indices:', solution);
hCaptchaImage()
Solve hCaptcha image classification challenges.
const solution = await solver.hCaptchaImage({
siteUrl: 'https://example.com',
images: ['data:image/png;base64,...', 'data:image/png;base64,...'],
question: 'Please click each image containing a cat'
});
console.log('Solution:', solution);
rotateImage()
Solve rotate image captchas (find correct angle).
const angle = await solver.rotateImage({
siteUrl: 'https://example.com',
images: ['data:image/png;base64,iVBORw0KGgoAAAANS...'],
question: 'Rotate the image to the correct orientation', // optional
angle: 90, // optional, rotation increment
referenceImages: [] // optional
});
console.log('Rotation angle:', angle);
slideCaptchaImage()
Solve slide puzzle captchas.
const position = await solver.slideCaptchaImage({
siteUrl: 'https://example.com',
images: [
'data:image/png;base64,...', // Background image
'data:image/png;base64,...' // Slider piece
],
question: 'Slide to complete the puzzle' // optional
});
console.log('Slide position:', position);
clickCaptchaImage()
Solve click-based captchas (click specific points).
const coordinates = await solver.clickCaptchaImage({
siteUrl: 'https://example.com',
images: ['data:image/png;base64,iVBORw0KGgoAAAANS...'],
question: 'Click on all traffic lights',
questionType: 'click', // optional
referenceImages: [] // optional
});
console.log('Click coordinates:', coordinates);
funCaptchaImage()
Solve FunCaptcha image puzzles.
const solution = await solver.funCaptchaImage({
siteUrl: 'https://example.com',
images: ['data:image/png;base64,...'],
question: 'Use the arrows to rotate the animal to face in the direction of the hand'
});
console.log('Solution:', solution);
geeTestV3Image()
Solve GeeTest v3 image slide puzzles.
const solution = await solver.geeTestV3Image({
siteUrl: 'https://example.com',
images: ['data:image/png;base64,...', 'data:image/png;base64,...'],
question: 'Slide to complete the puzzle'
});
console.log('Slide distance:', solution);
geeTestV4Image()
Solve GeeTest v4 image challenges.
const solution = await solver.geeTestV4Image({
siteUrl: 'https://example.com',
images: ['data:image/png;base64,...'],
question: 'Click on the object'
});
console.log('Solution:', solution);
tikTokImage()
Solve TikTok image puzzles.
const solution = await solver.tikTokImage({
siteUrl: 'https://example.com',
images: ['data:image/png;base64,...'],
question: 'Rotate the object to match'
});
console.log('Solution:', solution);
gridCaptchaImage()
Solve grid-based image selection captchas.
const solution = await solver.gridCaptchaImage({
siteUrl: 'https://example.com',
images: ['data:image/png;base64,...'],
question: 'Select all squares with traffic lights',
rows: 3, // optional
columns: 3 // optional
});
console.log('Selected cells:', solution);
multiSelectImage()
Solve multiple image selection captchas.
const solution = await solver.multiSelectImage({
siteUrl: 'https://example.com',
images: ['data:image/png;base64,...', 'data:image/png;base64,...'],
question: 'Select all images containing a cat',
referenceImages: [] // optional
});
console.log('Selected indices:', solution);
dragCaptchaImage()
Solve drag-based captchas.
const solution = await solver.dragCaptchaImage({
siteUrl: 'https://example.com',
images: ['data:image/png;base64,...'],
question: 'Drag the slider to complete',
questionType: 'drag', // optional
referenceImages: [] // optional
});
console.log('Drag position:', solution);
mtCaptchaImage()
Solve MTCaptcha image challenges.
const solution = await solver.mtCaptchaImage({
siteUrl: 'https://example.com',
images: ['data:image/png;base64,...'],
module: 'mtcaptcha', // optional
maxLength: 5 // optional
});
console.log('Captcha text:', solution);
leminCaptchaImage()
Solve Lemin CAPTCHA image challenges.
const solution = await solver.leminCaptchaImage({
siteUrl: 'https://example.com',
images: ['data:image/png;base64,...'],
question: 'Select the correct image'
});
console.log('Solution:', solution);
dataDomeCaptchaImage()
Solve DataDome image challenges.
const solution = await solver.dataDomeCaptchaImage({
siteUrl: 'https://example.com',
images: ['data:image/png;base64,...'],
question: 'Slide to verify' // optional
});
console.log('Solution:', solution);
captchaFoxImage()
Solve CaptchaFox image puzzles.
const solution = await solver.captchaFoxImage({
siteUrl: 'https://example.com',
images: ['data:image/png;base64,...'],
question: 'Select matching images',
questionType: 'select', // optional
referenceImages: [] // optional
});
console.log('Solution:', solution);
binanceImage()
Solve Binance puzzle captchas.
const solution = await solver.binanceImage({
siteUrl: 'https://example.com',
images: ['data:image/png;base64,...'],
question: 'Slide to complete the puzzle',
questionType: 'slide',
referenceImages: [] // optional
});
console.log('Slide position:', solution);
blsImage()
Solve BLS image captchas.
const solution = await solver.blsImage({
siteUrl: 'https://example.com',
images: ['data:image/png;base64,...'],
question: 'Select the correct image'
});
console.log('Solution:', solution);
shopeeImage()
Solve Shopee image puzzles.
const solution = await solver.shopeeImage({
siteUrl: 'https://example.com',
images: ['data:image/png;base64,...'],
question: 'Slide to complete'
});
console.log('Slide position:', solution);
temuCaptchaImage()
Solve Temu puzzle captchas.
const solution = await solver.temuCaptchaImage({
siteUrl: 'https://example.com',
images: ['data:image/png;base64,...']
});
console.log('Solution:', solution);
tencentImage()
Solve Tencent image challenges.
const solution = await solver.tencentImage({
siteUrl: 'https://example.com',
images: ['data:image/png;base64,...'],
question: 'Slide to verify'
});
console.log('Solution:', solution);
awsWAFImage()
Solve AWS WAF image challenges.
const solution = await solver.awsWAFImage({
siteUrl: 'https://example.com',
images: ['data:image/png;base64,...'],
question: 'Select all matching images'
});
console.log('Solution:', solution);
prosopoImage()
Solve Prosopo image challenges.
const solution = await solver.prosopoImage({
siteUrl: 'https://example.com',
images: ['data:image/png;base64,...'],
question: 'Select the correct image'
});
console.log('Solution:', solution);
faucetPayImage()
Solve FaucetPay image puzzles.
const solution = await solver.faucetPayImage({
siteUrl: 'https://example.com',
images: ['data:image/png;base64,...'],
question: 'Select matching images'
});
console.log('Solution:', solution);
Account Methods
getBalance()
Get your current account balance.
const balance = await solver.getBalance();
console.log('Current balance: $' + balance + ' USD');
getAccountInfo()
Get detailed account information.
const account = await solver.getAccountInfo();
console.log('Email:', account.email);
console.log('Username:', account.username);
console.log('Balance:', account.balance, account.currency);
Advanced Features
Proxy Support
Use proxies for captcha solving to match your target website's requirements.
const token = await solver.recaptchaV2Token({
siteUrl: 'https://example.com',
siteKey: '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-',
proxy: {
protocol: 'http', // 'http', 'https', 'socks4', 'socks5'
host: '1.2.3.4',
port: 8080,
username: 'proxyuser', // optional
password: 'proxypass' // optional
}
});
UserAgent & Cookies
Provide browser fingerprint data for better success rates.
const token = await solver.hCaptchaEnterpriseToken({
siteUrl: 'https://discord.com/register',
siteKey: 'f5561ba9-8f1e-40ca-9b5b-a0b3f719ef34',
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
cookies: [
{
name: '__dcfduid',
value: '7a2b3c4d5e6f7a8b',
domain: '.discord.com',
path: '/'
},
{
name: '__sdcfduid',
value: '9b1c2d3e4f5a6b7c',
domain: '.discord.com',
path: '/'
}
]
});
Error Handling
Properly handle errors and failed tasks.
try {
const token = await solver.recaptchaV2Token({
siteUrl: 'https://example.com',
siteKey: '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-'
});
console.log('Success! Token:', token);
} catch (error) {
console.error('Captcha solving failed:', error.message);
if (error.message.includes('insufficient balance')) {
console.log('Please add funds to your account');
} else if (error.message.includes('timeout')) {
console.log('Task took too long, try again');
} else if (error.message.includes('invalid site key')) {
console.log('Check your site key');
}
}
Complete Examples
Login Automation with reCAPTCHA
const { MyDisctSolver } = require('mydisct-solver');
const axios = require('axios');
const solver = new MyDisctSolver('YOUR_API_KEY');
async function loginWithCaptcha() {
try {
console.log('Solving reCAPTCHA...');
const captchaToken = await solver.recaptchaV2Token({
siteUrl: 'https://example.com/login',
siteKey: '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-',
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
});
console.log('Captcha solved!');
const response = await axios.post('https://example.com/api/login', {
username: 'myusername',
password: 'mypassword',
'g-recaptcha-response': captchaToken
});
console.log('Login successful!');
console.log('Auth token:', response.data.token);
return response.data;
} catch (error) {
console.error('Login failed:', error.message);
throw error;
}
}
loginWithCaptcha();
Batch Processing Multiple Captchas
const { MyDisctSolver } = require('mydisct-solver');
const solver = new MyDisctSolver('YOUR_API_KEY');
async function solveBatchCaptchas() {
const tasks = [
{
name: 'Login Page',
solve: () => solver.recaptchaV2Token({
siteUrl: 'https://example.com/login',
siteKey: '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-'
})
},
{
name: 'Registration',
solve: () => solver.recaptchaV3Token({
siteUrl: 'https://example.com/register',
siteKey: '6LdyC2cUAAAAACGuDKpXeDorzUDWXmdqeg-xy696',
recaptchaAction: 'register'
})
},
{
name: 'Contact Form',
solve: () => solver.hCaptchaToken({
siteUrl: 'https://example.com/contact',
siteKey: 'a5f74b19-9e45-40e0-b45d-47ff91b7a6c2'
})
}
];
const results = await Promise.allSettled(
tasks.map(task => task.solve())
);
results.forEach((result, index) => {
if (result.status === 'fulfilled') {
console.log('✓ ' + tasks[index].name + ': ' + result.value.substring(0, 40) + '...');
} else {
console.log('✗ ' + tasks[index].name + ': ' + result.reason.message);
}
});
return results;
}
solveBatchCaptchas();
Puppeteer Integration
const { MyDisctSolver } = require('mydisct-solver');
const puppeteer = require('puppeteer');
const solver = new MyDisctSolver('YOUR_API_KEY');
async function automateWithPuppeteer() {
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage();
try {
await page.goto('https://example.com/login');
const siteKey = await page.evaluate(() => {
const element = document.querySelector('[data-sitekey]');
return element ? element.getAttribute('data-sitekey') : null;
});
if (!siteKey) {
throw new Error('Site key not found');
}
console.log('Site key:', siteKey);
console.log('Solving captcha...');
const token = await solver.recaptchaV2Token({
siteUrl: page.url(),
siteKey: siteKey,
userAgent: await page.evaluate(() => navigator.userAgent)
});
console.log('Captcha solved!');
await page.evaluate((token) => {
document.querySelector('[name="g-recaptcha-response"]').value = token;
document.querySelector('textarea[name="g-recaptcha-response"]').style.display = 'block';
}, token);
await page.type('#username', 'myusername');
await page.type('#password', 'mypassword');
await page.click('button[type="submit"]');
await page.waitForNavigation();
console.log('Login successful!');
console.log('Current URL:', page.url());
} catch (error) {
console.error('Error:', error.message);
} finally {
await browser.close();
}
}
automateWithPuppeteer();
TypeScript Support
The SDK includes full TypeScript definitions for type safety and IntelliSense support.
Type Definitions
import {
MyDisctSolver,
RecaptchaV2Options,
RecaptchaV3Options,
HCaptchaOptions,
ProxyConfig,
Cookie
} from 'mydisct-solver';
const solver = new MyDisctSolver('YOUR_API_KEY');
const options: RecaptchaV2Options = {
siteUrl: 'https://example.com',
siteKey: '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-',
invisible: false,
userAgent: 'Mozilla/5.0...',
cookies: [
{
name: 'session',
value: 'abc123',
domain: '.example.com',
path: '/'
}
],
proxy: {
protocol: 'http',
host: '1.2.3.4',
port: 8080,
username: 'user',
password: 'pass'
}
};
const token: string = await solver.recaptchaV2Token(options);
Available Types
// Core types
import {
ProxyConfig,
Cookie,
TaskResponse,
RecaptchaV2Options,
RecaptchaV3Options,
RecaptchaV2EnterpriseOptions,
RecaptchaV3EnterpriseOptions,
HCaptchaOptions,
HCaptchaEnterpriseOptions,
CloudflareTurnstileOptions,
CloudflareTurnstileManagedOptions,
CloudflareChallengeOptions,
FunCaptchaOptions,
GeeTestV4Options,
MTCaptchaOptions,
LeminCaptchaOptions,
FriendlyCaptchaOptions,
DataDomeOptions,
AltchaOptions,
TencentCaptchaOptions,
NetEaseCaptchaOptions,
FaucetPayCaptchaOptions,
CaptchaFoxOptions,
AWSCaptchaOptions,
TextCaptchaImageOptions,
RecaptchaImageOptions,
HCaptchaImageOptions,
FunCaptchaImageOptions,
GeeTestV3ImageOptions,
GeeTestV4ImageOptions,
RotateImageOptions,
SlideCaptchaImageOptions,
ClickCaptchaImageOptions,
GridCaptchaImageOptions,
MultiSelectImageOptions,
DragCaptchaImageOptions,
} from 'mydisct-solver';
Best Practices
- Always check balance before starting batch operations
- Use try-catch blocks to handle errors gracefully
- Provide userAgent for better success rates on token captchas
- Use proxies when the target site requires specific geolocation
- Cache tokens briefly if making multiple requests (tokens expire after ~2 minutes)
- Implement retry logic for failed tasks with exponential backoff
- Monitor your usage with getBalance() and getAccountInfo()
- Use TypeScript for better development experience and type safety
Troubleshooting
Common Issues
Solution: Ensure you're passing your API key to the constructor.
Solution: Verify the siteKey and siteUrl are correct. The URL must match exactly where the captcha appears.
Solution: Some captchas take longer. The SDK waits up to 2 minutes by default. This is normal for complex captchas.
Solution: Add funds to your account at solver.mydisct.com