solvecaptcha-client 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2026 api-kit contributors
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,93 @@
1
- # Temporary Holding Version
1
+ # solvecaptcha-client
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ TypeScript and Node.js client for the [SolveCaptcha API](https://solvecaptcha.com/captcha-solver-api).
4
+
5
+ ## Features
6
+
7
+ - Solves normal image captchas, text questions, Google reCAPTCHA (v2/v3), Cloudflare Turnstile, FunCaptcha, and GeeTest
8
+ - Built-in polling mechanism with configurable timeout and intervals
9
+ - Support for feedback reporting (`reportGood`, `reportBad`) for accuracy tracking
10
+ - Written in TypeScript with complete type declarations and TSDoc
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install solvecaptcha-client
16
+ ```
17
+
18
+ ## Quick Start
19
+
20
+ ```typescript
21
+ import { SolveCaptchaClient } from 'solvecaptcha-client';
22
+
23
+ const client = new SolveCaptchaClient({
24
+ apiKey: process.env.SOLVECAPTCHA_API_KEY!,
25
+ });
26
+
27
+ async function main() {
28
+ // Check account balance
29
+ const balance = await client.getBalance();
30
+ console.log(`Current balance: $${balance.toFixed(4)}`);
31
+ }
32
+
33
+ main().catch(console.error);
34
+ ```
35
+
36
+ ## Solving Captchas
37
+
38
+ ### Image Captcha
39
+
40
+ ```typescript
41
+ import { SolveCaptchaClient } from 'solvecaptcha-client';
42
+
43
+ const client = new SolveCaptchaClient({ apiKey: 'YOUR_API_KEY' });
44
+
45
+ const solution = await client.solveImage({
46
+ body: 'iVBORw0KGgoAAAANSUhEUgAA...', // Base64-encoded image
47
+ numeric: 4, // Both numbers and letters
48
+ });
49
+
50
+ console.log(`Solved text: ${solution}`);
51
+ ```
52
+
53
+ ### Google reCAPTCHA V2
54
+
55
+ ```typescript
56
+ const token = await client.solveRecaptchaV2({
57
+ googlekey: '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-',
58
+ pageurl: 'https://example.com/login',
59
+ });
60
+
61
+ console.log(`reCAPTCHA token: ${token}`);
62
+ ```
63
+
64
+ ### Cloudflare Turnstile
65
+
66
+ ```typescript
67
+ const token = await client.solveTurnstile({
68
+ sitekey: '0x4AAAAAAABnEBq1w7gYv_m-',
69
+ pageurl: 'https://example.com/protected',
70
+ });
71
+
72
+ console.log(`Turnstile token: ${token}`);
73
+ ```
74
+
75
+ ## API Methods
76
+
77
+ - `getBalance(): Promise<number>` — Returns the current balance in USD.
78
+ - `solveImage(options: ImageCaptchaOptions | string): Promise<string>` — Solves an image captcha.
79
+ - `solveText(text: string, options?: TextCaptchaOptions): Promise<string>` — Solves a text question captcha.
80
+ - `solveRecaptchaV2(options: RecaptchaV2Options): Promise<string>` — Solves Google reCAPTCHA V2.
81
+ - `solveRecaptchaV3(options: RecaptchaV3Options): Promise<string>` — Solves Google reCAPTCHA V3.
82
+ - `solveTurnstile(options: TurnstileOptions): Promise<string>` — Solves Cloudflare Turnstile.
83
+ - `solveFunCaptcha(options: FunCaptchaOptions): Promise<string>` — Solves Arkose Labs FunCaptcha.
84
+ - `solveGeeTest(options: GeeTestOptions): Promise<GeeTestResult>` — Solves GeeTest.
85
+ - `createTask(params): Promise<string>` — Submits a task to `/in.php` and returns task ID.
86
+ - `getTaskResult(taskId): Promise<string | null>` — Checks task resolution status.
87
+ - `waitForResult(taskId, timeoutMs?, intervalMs?): Promise<string>` — Polls until task is solved.
88
+ - `reportGood(taskId): Promise<boolean>` — Submits positive accuracy feedback.
89
+ - `reportBad(taskId): Promise<boolean>` — Submits incorrect solution report.
90
+
91
+ ## License
92
+
93
+ ISC
@@ -0,0 +1,403 @@
1
+ /**
2
+ * Default software/affiliate identifier (empty if none assigned).
3
+ */
4
+ export declare const DEFAULT_SOFT_ID = "";
5
+ /**
6
+ * Configuration options for the SolveCaptchaClient.
7
+ */
8
+ export interface SolveCaptchaClientOptions {
9
+ /**
10
+ * API key obtained from SolveCaptcha dashboard.
11
+ */
12
+ apiKey: string;
13
+ /**
14
+ * Base URL for the SolveCaptcha API. Defaults to https://api.solvecaptcha.com.
15
+ */
16
+ baseURL?: string;
17
+ /**
18
+ * Request timeout in milliseconds. Defaults to 30000 ms.
19
+ */
20
+ timeout?: number;
21
+ /**
22
+ * Optional partner/software ID.
23
+ */
24
+ softId?: string | number;
25
+ /**
26
+ * Default polling timeout in milliseconds for captcha resolution. Defaults to 120000 ms.
27
+ */
28
+ defaultPollingTimeoutMs?: number;
29
+ /**
30
+ * Default polling interval in milliseconds. Defaults to 5000 ms.
31
+ */
32
+ defaultPollingIntervalMs?: number;
33
+ }
34
+ /**
35
+ * Options for solving a normal image captcha.
36
+ */
37
+ export interface ImageCaptchaOptions {
38
+ /**
39
+ * Base64 encoded image string.
40
+ */
41
+ body: string;
42
+ /**
43
+ * 0 = single word, 1 = two or more words.
44
+ */
45
+ phrase?: 0 | 1;
46
+ /**
47
+ * 0 = case insensitive, 1 = case sensitive.
48
+ */
49
+ regsense?: 0 | 1;
50
+ /**
51
+ * 0 = not specified, 1 = only numbers, 2 = only letters, 3 = only numbers OR only letters, 4 = both numbers and letters.
52
+ */
53
+ numeric?: 0 | 1 | 2 | 3 | 4;
54
+ /**
55
+ * 0 = no math, 1 = requires calculation.
56
+ */
57
+ calc?: 0 | 1;
58
+ /**
59
+ * Minimum number of characters.
60
+ */
61
+ minLen?: number;
62
+ /**
63
+ * Maximum number of characters.
64
+ */
65
+ maxLen?: number;
66
+ /**
67
+ * 0 = not specified, 1 = Cyrillic, 2 = Latin.
68
+ */
69
+ language?: 0 | 1 | 2;
70
+ /**
71
+ * Optional text instructions for the worker.
72
+ */
73
+ textinstructions?: string;
74
+ }
75
+ /**
76
+ * Options for solving a text question captcha.
77
+ */
78
+ export interface TextCaptchaOptions {
79
+ /**
80
+ * 0 = not specified, 1 = Cyrillic, 2 = Latin.
81
+ */
82
+ language?: 0 | 1 | 2;
83
+ }
84
+ /**
85
+ * Options for solving Google reCAPTCHA V2.
86
+ */
87
+ export interface RecaptchaV2Options {
88
+ /**
89
+ * Sitekey found in target page HTML.
90
+ */
91
+ googlekey: string;
92
+ /**
93
+ * Full URL of the page containing the reCAPTCHA.
94
+ */
95
+ pageurl: string;
96
+ /**
97
+ * Whether the reCAPTCHA is invisible.
98
+ */
99
+ invisible?: boolean;
100
+ /**
101
+ * Optional 'data-s' parameter value for protected endpoints.
102
+ */
103
+ dataS?: string;
104
+ }
105
+ /**
106
+ * Options for solving Google reCAPTCHA V3.
107
+ */
108
+ export interface RecaptchaV3Options {
109
+ /**
110
+ * Sitekey found in target page HTML.
111
+ */
112
+ googlekey: string;
113
+ /**
114
+ * Full URL of the page containing the reCAPTCHA.
115
+ */
116
+ pageurl: string;
117
+ /**
118
+ * Action parameter value.
119
+ */
120
+ action?: string;
121
+ /**
122
+ * Minimum required score (e.g. 0.3, 0.7, 0.9).
123
+ */
124
+ minScore?: number;
125
+ }
126
+ /**
127
+ * Options for solving Cloudflare Turnstile.
128
+ */
129
+ export interface TurnstileOptions {
130
+ /**
131
+ * Turnstile sitekey.
132
+ */
133
+ sitekey: string;
134
+ /**
135
+ * Full URL of the page with the Turnstile widget.
136
+ */
137
+ pageurl: string;
138
+ /**
139
+ * Optional action parameter.
140
+ */
141
+ action?: string;
142
+ /**
143
+ * Optional cData parameter.
144
+ */
145
+ data?: string;
146
+ /**
147
+ * Optional pagedata parameter.
148
+ */
149
+ pagedata?: string;
150
+ }
151
+ /**
152
+ * Options for solving Arkose Labs FunCaptcha.
153
+ */
154
+ export interface FunCaptchaOptions {
155
+ /**
156
+ * FunCaptcha public key.
157
+ */
158
+ publickey: string;
159
+ /**
160
+ * Full URL of the page containing FunCaptcha.
161
+ */
162
+ pageurl: string;
163
+ /**
164
+ * Custom service URL (surl).
165
+ */
166
+ surl?: string;
167
+ /**
168
+ * Custom data payload.
169
+ */
170
+ data?: Record<string, unknown> | string;
171
+ }
172
+ /**
173
+ * Options for solving GeeTest captcha.
174
+ */
175
+ export interface GeeTestOptions {
176
+ /**
177
+ * GeeTest 'gt' key.
178
+ */
179
+ gt: string;
180
+ /**
181
+ * GeeTest 'challenge' token.
182
+ */
183
+ challenge: string;
184
+ /**
185
+ * Full URL of the page containing GeeTest.
186
+ */
187
+ pageurl: string;
188
+ /**
189
+ * Optional custom api_server domain.
190
+ */
191
+ apiServer?: string;
192
+ }
193
+ /**
194
+ * Result returned for GeeTest captcha solutions.
195
+ */
196
+ export interface GeeTestResult {
197
+ challenge: string;
198
+ validate: string;
199
+ seccode: string;
200
+ }
201
+ /**
202
+ * Known error descriptions for SolveCaptcha.
203
+ */
204
+ export declare const SOLVE_CAPTCHA_ERRORS: Record<string, string>;
205
+ /**
206
+ * Error thrown by the SolveCaptcha client when API requests or solving tasks fail.
207
+ */
208
+ export declare class SolveCaptchaError extends Error {
209
+ /**
210
+ * Error code returned by SolveCaptcha.
211
+ */
212
+ readonly code?: string;
213
+ /**
214
+ * Raw server response payload.
215
+ */
216
+ readonly responseBody?: unknown;
217
+ constructor(message: string, code?: string, responseBody?: unknown);
218
+ }
219
+ /**
220
+ * Client for the SolveCaptcha human and AI captcha solving service.
221
+ */
222
+ export declare class SolveCaptchaClient {
223
+ private readonly apiKey;
224
+ private readonly softId;
225
+ private readonly pollingTimeoutMs;
226
+ private readonly pollingIntervalMs;
227
+ private readonly http;
228
+ /**
229
+ * Creates a new SolveCaptchaClient.
230
+ *
231
+ * @param options - API key string or configuration object.
232
+ *
233
+ * @example
234
+ * ```typescript
235
+ * import { SolveCaptchaClient } from 'solvecaptcha-client';
236
+ *
237
+ * const client = new SolveCaptchaClient({ apiKey: 'YOUR_API_KEY' });
238
+ * const balance = await client.getBalance();
239
+ * console.log(`Balance: $${balance}`);
240
+ * ```
241
+ */
242
+ constructor(options: SolveCaptchaClientOptions | string);
243
+ /**
244
+ * Retrieves the current account balance.
245
+ *
246
+ * @returns Current balance in USD.
247
+ *
248
+ * @example
249
+ * ```typescript
250
+ * const balance = await client.getBalance();
251
+ * console.log(`Current balance: $${balance}`);
252
+ * ```
253
+ */
254
+ getBalance(): Promise<number>;
255
+ /**
256
+ * Solves an image-based captcha from base64 data.
257
+ *
258
+ * @param options - Image parameters or base64 string.
259
+ * @returns Solved captcha text solution.
260
+ *
261
+ * @example
262
+ * ```typescript
263
+ * const text = await client.solveImage({
264
+ * body: 'iVBORw0KGgoAAAANSUhEUgAA...',
265
+ * });
266
+ * console.log(`Solved text: ${text}`);
267
+ * ```
268
+ */
269
+ solveImage(options: ImageCaptchaOptions | string): Promise<string>;
270
+ /**
271
+ * Solves a text question captcha.
272
+ *
273
+ * @param text - The question text to answer.
274
+ * @param options - Additional options.
275
+ * @returns Answer to the question.
276
+ *
277
+ * @example
278
+ * ```typescript
279
+ * const answer = await client.solveText('If tomorrow is Saturday, what day is today?');
280
+ * console.log(`Answer: ${answer}`);
281
+ * ```
282
+ */
283
+ solveText(text: string, options?: TextCaptchaOptions): Promise<string>;
284
+ /**
285
+ * Solves Google reCAPTCHA V2.
286
+ *
287
+ * @param options - reCAPTCHA V2 options.
288
+ * @returns Solution token.
289
+ *
290
+ * @example
291
+ * ```typescript
292
+ * const token = await client.solveRecaptchaV2({
293
+ * googlekey: '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-',
294
+ * pageurl: 'https://example.com/login',
295
+ * });
296
+ * console.log('Token:', token);
297
+ * ```
298
+ */
299
+ solveRecaptchaV2(options: RecaptchaV2Options): Promise<string>;
300
+ /**
301
+ * Solves Google reCAPTCHA V3.
302
+ *
303
+ * @param options - reCAPTCHA V3 options.
304
+ * @returns Solution token.
305
+ *
306
+ * @example
307
+ * ```typescript
308
+ * const token = await client.solveRecaptchaV3({
309
+ * googlekey: '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-',
310
+ * pageurl: 'https://example.com/login',
311
+ * action: 'verify',
312
+ * minScore: 0.7,
313
+ * });
314
+ * ```
315
+ */
316
+ solveRecaptchaV3(options: RecaptchaV3Options): Promise<string>;
317
+ /**
318
+ * Solves Cloudflare Turnstile.
319
+ *
320
+ * @param options - Turnstile options.
321
+ * @returns Turnstile token.
322
+ *
323
+ * @example
324
+ * ```typescript
325
+ * const token = await client.solveTurnstile({
326
+ * sitekey: '0x4AAAAAAABnEBq1w7gYv_m-',
327
+ * pageurl: 'https://example.com/page',
328
+ * });
329
+ * ```
330
+ */
331
+ solveTurnstile(options: TurnstileOptions): Promise<string>;
332
+ /**
333
+ * Solves Arkose Labs FunCaptcha.
334
+ *
335
+ * @param options - FunCaptcha options.
336
+ * @returns Solution token.
337
+ *
338
+ * @example
339
+ * ```typescript
340
+ * const token = await client.solveFunCaptcha({
341
+ * publickey: '69A21A01-CC43-44CC-A7DC-3E088835E78D',
342
+ * pageurl: 'https://example.com/signup',
343
+ * });
344
+ * ```
345
+ */
346
+ solveFunCaptcha(options: FunCaptchaOptions): Promise<string>;
347
+ /**
348
+ * Solves GeeTest captcha.
349
+ *
350
+ * @param options - GeeTest options.
351
+ * @returns GeeTestResult object with challenge, validate, and seccode.
352
+ *
353
+ * @example
354
+ * ```typescript
355
+ * const res = await client.solveGeeTest({
356
+ * gt: '022397c99c9d64352069eab73bc373d7',
357
+ * challenge: '3049170ffb08bb6b907572ca35489f07',
358
+ * pageurl: 'https://example.com/geetest',
359
+ * });
360
+ * console.log(res.validate);
361
+ * ```
362
+ */
363
+ solveGeeTest(options: GeeTestOptions): Promise<GeeTestResult>;
364
+ /**
365
+ * Submits a captcha task to /in.php and returns the assigned task ID.
366
+ *
367
+ * @param params - Task parameters.
368
+ * @returns Assigned numeric task ID string.
369
+ */
370
+ createTask(params: Record<string, unknown>): Promise<string>;
371
+ /**
372
+ * Checks the status and gets the result of a submitted task.
373
+ *
374
+ * @param taskId - Task ID returned by createTask.
375
+ * @returns Solution string, or null if captcha is still being solved.
376
+ */
377
+ getTaskResult(taskId: string): Promise<string | null>;
378
+ /**
379
+ * Polls until a captcha task is solved or timeout occurs.
380
+ *
381
+ * @param taskId - Task ID.
382
+ * @param timeoutMs - Maximum milliseconds to wait.
383
+ * @param intervalMs - Polling interval in milliseconds.
384
+ * @returns Solved captcha string.
385
+ */
386
+ waitForResult(taskId: string, timeoutMs?: number, intervalMs?: number): Promise<string>;
387
+ /**
388
+ * Reports that a captcha was solved correctly.
389
+ *
390
+ * @param taskId - Task ID.
391
+ * @returns True if report recorded.
392
+ */
393
+ reportGood(taskId: string): Promise<boolean>;
394
+ /**
395
+ * Reports that a captcha was solved incorrectly to request a refund.
396
+ *
397
+ * @param taskId - Task ID.
398
+ * @returns True if report recorded.
399
+ */
400
+ reportBad(taskId: string): Promise<boolean>;
401
+ private queryResult;
402
+ }
403
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;GAEG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GAAG,OAAO,CAAC,MAAM,CAAC;IAelE;;;;;;;;;;;;;;;OAeG;IACG,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAuBnE;;;;;OAKG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IA4ClE;;;;;OAKG;IACG,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAc3D;;;;;;;OAOG;IACG,aAAa,CACjB,MAAM,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC;IAmBlB;;;;;OAKG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAYlD;;;;;OAKG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;YAYnC,WAAW;CAqC1B"}
package/dist/index.js ADDED
@@ -0,0 +1,477 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SolveCaptchaClient = exports.SolveCaptchaError = exports.SOLVE_CAPTCHA_ERRORS = exports.DEFAULT_SOFT_ID = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ /**
9
+ * Default software/affiliate identifier (empty if none assigned).
10
+ */
11
+ exports.DEFAULT_SOFT_ID = '';
12
+ /**
13
+ * Known error descriptions for SolveCaptcha.
14
+ */
15
+ exports.SOLVE_CAPTCHA_ERRORS = {
16
+ ERROR_WRONG_USER_KEY: 'API key is invalid or formatted incorrectly',
17
+ ERROR_KEY_DOES_NOT_EXIST: 'API key not found in SolveCaptcha system',
18
+ ERROR_ZERO_BALANCE: 'Account balance is zero or depleted',
19
+ ERROR_NO_SLOT_AVAILABLE: 'No idle workers available at the moment',
20
+ ERROR_ZERO_CAPTCHA_FILESIZE: 'Uploaded image file size is 0 bytes',
21
+ ERROR_TOO_BIG_CAPTCHA_FILESIZE: 'Uploaded image exceeds maximum size limit (100 KB)',
22
+ ERROR_WRONG_FILE_EXTENSION: 'File extension is not supported',
23
+ ERROR_IMAGE_TYPE_NOT_SUPPORTED: 'Image format cannot be loaded or is corrupted',
24
+ ERROR_IP_NOT_ALLOWED: 'Your IP address is not whitelisted or is blocked',
25
+ IP_BANNED: 'Your IP address has been temporarily banned due to excessive failed attempts',
26
+ ERROR_CAPTCHA_UNSOLVABLE: 'Worker could not solve the submitted captcha',
27
+ ERROR_BAD_DUPLICATES: 'Maximum duplicate requests limit reached',
28
+ REPORT_NOT_RECORDED: 'Feedback report could not be recorded',
29
+ };
30
+ /**
31
+ * Error thrown by the SolveCaptcha client when API requests or solving tasks fail.
32
+ */
33
+ class SolveCaptchaError extends Error {
34
+ /**
35
+ * Error code returned by SolveCaptcha.
36
+ */
37
+ code;
38
+ /**
39
+ * Raw server response payload.
40
+ */
41
+ responseBody;
42
+ constructor(message, code, responseBody) {
43
+ super(message);
44
+ this.name = 'SolveCaptchaError';
45
+ this.code = code;
46
+ this.responseBody = responseBody;
47
+ Object.setPrototypeOf(this, SolveCaptchaError.prototype);
48
+ }
49
+ }
50
+ exports.SolveCaptchaError = SolveCaptchaError;
51
+ /**
52
+ * Client for the SolveCaptcha human and AI captcha solving service.
53
+ */
54
+ class SolveCaptchaClient {
55
+ apiKey;
56
+ softId;
57
+ pollingTimeoutMs;
58
+ pollingIntervalMs;
59
+ http;
60
+ /**
61
+ * Creates a new SolveCaptchaClient.
62
+ *
63
+ * @param options - API key string or configuration object.
64
+ *
65
+ * @example
66
+ * ```typescript
67
+ * import { SolveCaptchaClient } from 'solvecaptcha-client';
68
+ *
69
+ * const client = new SolveCaptchaClient({ apiKey: 'YOUR_API_KEY' });
70
+ * const balance = await client.getBalance();
71
+ * console.log(`Balance: $${balance}`);
72
+ * ```
73
+ */
74
+ constructor(options) {
75
+ if (typeof options === 'string') {
76
+ this.apiKey = options.trim();
77
+ this.softId = exports.DEFAULT_SOFT_ID;
78
+ this.pollingTimeoutMs = 120000;
79
+ this.pollingIntervalMs = 5000;
80
+ this.http = axios_1.default.create({
81
+ baseURL: 'https://api.solvecaptcha.com',
82
+ timeout: 30000,
83
+ });
84
+ }
85
+ else {
86
+ if (!options || !options.apiKey || !options.apiKey.trim()) {
87
+ throw new SolveCaptchaError('API key is required to initialize SolveCaptchaClient', 'ERROR_KEY_DOES_NOT_EXIST');
88
+ }
89
+ this.apiKey = options.apiKey.trim();
90
+ this.softId = options.softId ?? exports.DEFAULT_SOFT_ID;
91
+ this.pollingTimeoutMs = options.defaultPollingTimeoutMs ?? 120000;
92
+ this.pollingIntervalMs = options.defaultPollingIntervalMs ?? 5000;
93
+ this.http = axios_1.default.create({
94
+ baseURL: options.baseURL || 'https://api.solvecaptcha.com',
95
+ timeout: options.timeout || 30000,
96
+ });
97
+ }
98
+ }
99
+ /**
100
+ * Retrieves the current account balance.
101
+ *
102
+ * @returns Current balance in USD.
103
+ *
104
+ * @example
105
+ * ```typescript
106
+ * const balance = await client.getBalance();
107
+ * console.log(`Current balance: $${balance}`);
108
+ * ```
109
+ */
110
+ async getBalance() {
111
+ const data = await this.queryResult({
112
+ action: 'getbalance',
113
+ });
114
+ const balance = parseFloat(data);
115
+ if (Number.isNaN(balance)) {
116
+ throw new SolveCaptchaError(`Failed to parse balance: ${data}`, 'PARSE_ERROR', data);
117
+ }
118
+ return balance;
119
+ }
120
+ /**
121
+ * Solves an image-based captcha from base64 data.
122
+ *
123
+ * @param options - Image parameters or base64 string.
124
+ * @returns Solved captcha text solution.
125
+ *
126
+ * @example
127
+ * ```typescript
128
+ * const text = await client.solveImage({
129
+ * body: 'iVBORw0KGgoAAAANSUhEUgAA...',
130
+ * });
131
+ * console.log(`Solved text: ${text}`);
132
+ * ```
133
+ */
134
+ async solveImage(options) {
135
+ const opt = typeof options === 'string' ? { body: options } : options;
136
+ const params = {
137
+ method: 'base64',
138
+ body: opt.body,
139
+ };
140
+ if (opt.phrase !== undefined)
141
+ params.phrase = opt.phrase;
142
+ if (opt.regsense !== undefined)
143
+ params.regsense = opt.regsense;
144
+ if (opt.numeric !== undefined)
145
+ params.numeric = opt.numeric;
146
+ if (opt.calc !== undefined)
147
+ params.calc = opt.calc;
148
+ if (opt.minLen !== undefined)
149
+ params.min_len = opt.minLen;
150
+ if (opt.maxLen !== undefined)
151
+ params.max_len = opt.maxLen;
152
+ if (opt.language !== undefined)
153
+ params.language = opt.language;
154
+ if (opt.textinstructions !== undefined)
155
+ params.textinstructions = opt.textinstructions;
156
+ const taskId = await this.createTask(params);
157
+ return this.waitForResult(taskId);
158
+ }
159
+ /**
160
+ * Solves a text question captcha.
161
+ *
162
+ * @param text - The question text to answer.
163
+ * @param options - Additional options.
164
+ * @returns Answer to the question.
165
+ *
166
+ * @example
167
+ * ```typescript
168
+ * const answer = await client.solveText('If tomorrow is Saturday, what day is today?');
169
+ * console.log(`Answer: ${answer}`);
170
+ * ```
171
+ */
172
+ async solveText(text, options) {
173
+ const params = {
174
+ textcaptcha: text,
175
+ };
176
+ if (options?.language !== undefined)
177
+ params.language = options.language;
178
+ const taskId = await this.createTask(params);
179
+ return this.waitForResult(taskId);
180
+ }
181
+ /**
182
+ * Solves Google reCAPTCHA V2.
183
+ *
184
+ * @param options - reCAPTCHA V2 options.
185
+ * @returns Solution token.
186
+ *
187
+ * @example
188
+ * ```typescript
189
+ * const token = await client.solveRecaptchaV2({
190
+ * googlekey: '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-',
191
+ * pageurl: 'https://example.com/login',
192
+ * });
193
+ * console.log('Token:', token);
194
+ * ```
195
+ */
196
+ async solveRecaptchaV2(options) {
197
+ const params = {
198
+ method: 'userrecaptcha',
199
+ googlekey: options.googlekey,
200
+ pageurl: options.pageurl,
201
+ };
202
+ if (options.invisible)
203
+ params.invisible = 1;
204
+ if (options.dataS)
205
+ params['data-s'] = options.dataS;
206
+ const taskId = await this.createTask(params);
207
+ return this.waitForResult(taskId);
208
+ }
209
+ /**
210
+ * Solves Google reCAPTCHA V3.
211
+ *
212
+ * @param options - reCAPTCHA V3 options.
213
+ * @returns Solution token.
214
+ *
215
+ * @example
216
+ * ```typescript
217
+ * const token = await client.solveRecaptchaV3({
218
+ * googlekey: '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-',
219
+ * pageurl: 'https://example.com/login',
220
+ * action: 'verify',
221
+ * minScore: 0.7,
222
+ * });
223
+ * ```
224
+ */
225
+ async solveRecaptchaV3(options) {
226
+ const params = {
227
+ method: 'userrecaptcha',
228
+ version: 'v3',
229
+ googlekey: options.googlekey,
230
+ pageurl: options.pageurl,
231
+ };
232
+ if (options.action)
233
+ params.action = options.action;
234
+ if (options.minScore !== undefined)
235
+ params.min_score = options.minScore;
236
+ const taskId = await this.createTask(params);
237
+ return this.waitForResult(taskId);
238
+ }
239
+ /**
240
+ * Solves Cloudflare Turnstile.
241
+ *
242
+ * @param options - Turnstile options.
243
+ * @returns Turnstile token.
244
+ *
245
+ * @example
246
+ * ```typescript
247
+ * const token = await client.solveTurnstile({
248
+ * sitekey: '0x4AAAAAAABnEBq1w7gYv_m-',
249
+ * pageurl: 'https://example.com/page',
250
+ * });
251
+ * ```
252
+ */
253
+ async solveTurnstile(options) {
254
+ const params = {
255
+ method: 'turnstile',
256
+ sitekey: options.sitekey,
257
+ pageurl: options.pageurl,
258
+ };
259
+ if (options.action)
260
+ params.action = options.action;
261
+ if (options.data)
262
+ params.data = options.data;
263
+ if (options.pagedata)
264
+ params.pagedata = options.pagedata;
265
+ const taskId = await this.createTask(params);
266
+ return this.waitForResult(taskId);
267
+ }
268
+ /**
269
+ * Solves Arkose Labs FunCaptcha.
270
+ *
271
+ * @param options - FunCaptcha options.
272
+ * @returns Solution token.
273
+ *
274
+ * @example
275
+ * ```typescript
276
+ * const token = await client.solveFunCaptcha({
277
+ * publickey: '69A21A01-CC43-44CC-A7DC-3E088835E78D',
278
+ * pageurl: 'https://example.com/signup',
279
+ * });
280
+ * ```
281
+ */
282
+ async solveFunCaptcha(options) {
283
+ const params = {
284
+ method: 'funcaptcha',
285
+ publickey: options.publickey,
286
+ pageurl: options.pageurl,
287
+ };
288
+ if (options.surl)
289
+ params.surl = options.surl;
290
+ if (options.data) {
291
+ params.data = typeof options.data === 'string' ? options.data : JSON.stringify(options.data);
292
+ }
293
+ const taskId = await this.createTask(params);
294
+ return this.waitForResult(taskId);
295
+ }
296
+ /**
297
+ * Solves GeeTest captcha.
298
+ *
299
+ * @param options - GeeTest options.
300
+ * @returns GeeTestResult object with challenge, validate, and seccode.
301
+ *
302
+ * @example
303
+ * ```typescript
304
+ * const res = await client.solveGeeTest({
305
+ * gt: '022397c99c9d64352069eab73bc373d7',
306
+ * challenge: '3049170ffb08bb6b907572ca35489f07',
307
+ * pageurl: 'https://example.com/geetest',
308
+ * });
309
+ * console.log(res.validate);
310
+ * ```
311
+ */
312
+ async solveGeeTest(options) {
313
+ const params = {
314
+ method: 'geetest',
315
+ gt: options.gt,
316
+ challenge: options.challenge,
317
+ pageurl: options.pageurl,
318
+ };
319
+ if (options.apiServer)
320
+ params.api_server = options.apiServer;
321
+ const taskId = await this.createTask(params);
322
+ const rawResult = await this.waitForResult(taskId);
323
+ try {
324
+ return JSON.parse(rawResult);
325
+ }
326
+ catch {
327
+ throw new SolveCaptchaError(`Failed to parse GeeTest solution: ${rawResult}`, 'PARSE_ERROR', rawResult);
328
+ }
329
+ }
330
+ /**
331
+ * Submits a captcha task to /in.php and returns the assigned task ID.
332
+ *
333
+ * @param params - Task parameters.
334
+ * @returns Assigned numeric task ID string.
335
+ */
336
+ async createTask(params) {
337
+ const payload = {
338
+ key: this.apiKey,
339
+ json: 1,
340
+ ...params,
341
+ };
342
+ if (this.softId && payload.soft_id === undefined) {
343
+ payload.soft_id = this.softId;
344
+ }
345
+ try {
346
+ const response = await this.http.post('/in.php', null, {
347
+ params: payload,
348
+ });
349
+ const data = response.data;
350
+ if (data && typeof data === 'object') {
351
+ if (data.status === 1 && data.request) {
352
+ return String(data.request);
353
+ }
354
+ if (data.status === 0 && data.request) {
355
+ const code = String(data.request);
356
+ const desc = exports.SOLVE_CAPTCHA_ERRORS[code] || `SolveCaptcha error: ${code}`;
357
+ throw new SolveCaptchaError(desc, code, data);
358
+ }
359
+ }
360
+ throw new SolveCaptchaError(`Unexpected /in.php response: ${JSON.stringify(data)}`, 'INVALID_RESPONSE', data);
361
+ }
362
+ catch (err) {
363
+ if (err instanceof SolveCaptchaError) {
364
+ throw err;
365
+ }
366
+ throw new SolveCaptchaError(`createTask request failed: ${err instanceof Error ? err.message : String(err)}`, 'NETWORK_ERROR');
367
+ }
368
+ }
369
+ /**
370
+ * Checks the status and gets the result of a submitted task.
371
+ *
372
+ * @param taskId - Task ID returned by createTask.
373
+ * @returns Solution string, or null if captcha is still being solved.
374
+ */
375
+ async getTaskResult(taskId) {
376
+ try {
377
+ return await this.queryResult({
378
+ action: 'get',
379
+ id: taskId,
380
+ });
381
+ }
382
+ catch (err) {
383
+ if (err instanceof SolveCaptchaError && err.code === 'CAPCHA_NOT_READY') {
384
+ return null;
385
+ }
386
+ throw err;
387
+ }
388
+ }
389
+ /**
390
+ * Polls until a captcha task is solved or timeout occurs.
391
+ *
392
+ * @param taskId - Task ID.
393
+ * @param timeoutMs - Maximum milliseconds to wait.
394
+ * @param intervalMs - Polling interval in milliseconds.
395
+ * @returns Solved captcha string.
396
+ */
397
+ async waitForResult(taskId, timeoutMs, intervalMs) {
398
+ const timeout = timeoutMs ?? this.pollingTimeoutMs;
399
+ const interval = intervalMs ?? this.pollingIntervalMs;
400
+ const start = Date.now();
401
+ while (Date.now() - start < timeout) {
402
+ await new Promise((resolve) => setTimeout(resolve, interval));
403
+ const res = await this.getTaskResult(taskId);
404
+ if (res !== null) {
405
+ return res;
406
+ }
407
+ }
408
+ throw new SolveCaptchaError(`Captcha solving timed out after ${timeout}ms`, 'TIMEOUT');
409
+ }
410
+ /**
411
+ * Reports that a captcha was solved correctly.
412
+ *
413
+ * @param taskId - Task ID.
414
+ * @returns True if report recorded.
415
+ */
416
+ async reportGood(taskId) {
417
+ try {
418
+ const res = await this.queryResult({
419
+ action: 'reportgood',
420
+ id: taskId,
421
+ });
422
+ return res === 'OK_REPORT_RECORDED';
423
+ }
424
+ catch {
425
+ return false;
426
+ }
427
+ }
428
+ /**
429
+ * Reports that a captcha was solved incorrectly to request a refund.
430
+ *
431
+ * @param taskId - Task ID.
432
+ * @returns True if report recorded.
433
+ */
434
+ async reportBad(taskId) {
435
+ try {
436
+ const res = await this.queryResult({
437
+ action: 'reportbad',
438
+ id: taskId,
439
+ });
440
+ return res === 'OK_REPORT_RECORDED';
441
+ }
442
+ catch {
443
+ return false;
444
+ }
445
+ }
446
+ async queryResult(params) {
447
+ try {
448
+ const response = await this.http.get('/res.php', {
449
+ params: {
450
+ key: this.apiKey,
451
+ json: 1,
452
+ ...params,
453
+ },
454
+ });
455
+ const data = response.data;
456
+ if (data && typeof data === 'object') {
457
+ if (data.status === 1 && data.request !== undefined) {
458
+ return String(data.request);
459
+ }
460
+ if (data.status === 0 && data.request) {
461
+ const code = String(data.request);
462
+ const desc = exports.SOLVE_CAPTCHA_ERRORS[code] || `SolveCaptcha error: ${code}`;
463
+ throw new SolveCaptchaError(desc, code, data);
464
+ }
465
+ }
466
+ throw new SolveCaptchaError(`Unexpected /res.php response: ${JSON.stringify(data)}`, 'INVALID_RESPONSE', data);
467
+ }
468
+ catch (err) {
469
+ if (err instanceof SolveCaptchaError) {
470
+ throw err;
471
+ }
472
+ throw new SolveCaptchaError(`queryResult failed: ${err instanceof Error ? err.message : String(err)}`, 'NETWORK_ERROR');
473
+ }
474
+ }
475
+ }
476
+ exports.SolveCaptchaClient = SolveCaptchaClient;
477
+ //# sourceMapping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CAAC,IAAI,uBAAuB,IAAI,EAAE,CAAC;oBACzE,MAAM,IAAI,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;gBAChD,CAAC;YACH,CAAC;YAED,MAAM,IAAI,iBAAiB,CACzB,iCAAiC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EACvD,kBAAkB,EAClB,IAAI,CACL,CAAC;QACJ,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,IAAI,GAAG,YAAY,iBAAiB,EAAE,CAAC;gBACrC,MAAM,GAAG,CAAC;YACZ,CAAC;YACD,MAAM,IAAI,iBAAiB,CACzB,uBAAuB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EACzE,eAAe,CAChB,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAxcD,gDAwcC"}
package/package.json CHANGED
@@ -1,6 +1,52 @@
1
1
  {
2
2
  "name": "solvecaptcha-client",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "TypeScript client for the SolveCaptcha human and AI captcha solving API",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/index.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "scripts": {
17
+ "build": "tsc -p tsconfig.json",
18
+ "test": "jest",
19
+ "test:live": "jest --testPathPattern=test/live --testPathIgnorePatterns=/node_modules/",
20
+ "docs": "typedoc --options typedoc.json"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/TysikGG/api-kit.git",
25
+ "directory": "solvecaptcha/js"
26
+ },
27
+ "keywords": [
28
+ "solvecaptcha",
29
+ "captcha-solver",
30
+ "recaptcha",
31
+ "hcaptcha",
32
+ "turnstile",
33
+ "funcaptcha"
34
+ ],
35
+ "license": "ISC",
36
+ "engines": {
37
+ "node": ">=18"
38
+ },
39
+ "dependencies": {
40
+ "axios": "^1.20.0"
41
+ },
42
+ "devDependencies": {
43
+ "@types/jest": "^29.5.14",
44
+ "@types/node": "^22.10.2",
45
+ "axios-mock-adapter": "^2.1.0",
46
+ "jest": "^29.7.0",
47
+ "ts-jest": "^29.2.5",
48
+ "typedoc": "^0.28.1",
49
+ "typedoc-plugin-markdown": "^4.6.0",
50
+ "typescript": "^5.7.2"
51
+ }
52
+ }