@2captcha/captcha-solver 1.0.2 → 1.0.3

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.
@@ -0,0 +1,819 @@
1
+ export interface paramsRecaptcha {
2
+ pageurl: string;
3
+ googlekey: string;
4
+ invisible?: boolean;
5
+ datas?: string;
6
+ domain?: string;
7
+ cookies?: string;
8
+ userAgent?: string;
9
+ header_acao?: boolean;
10
+ pingback?: string;
11
+ soft_id?: number;
12
+ proxy?: string;
13
+ proxytype?: string;
14
+ action?: string;
15
+ enterprise?: 0 | 1;
16
+ min_score?: number;
17
+ version?: string;
18
+ }
19
+ export interface paramsHCaptcha {
20
+ sitekey: string;
21
+ pageurl: string;
22
+ header_acao?: boolean;
23
+ pingback?: string;
24
+ proxy?: string;
25
+ proxytype?: string;
26
+ invisible?: 0 | 1;
27
+ data?: string;
28
+ userAgent?: string;
29
+ soft_id?: number;
30
+ domain?: string;
31
+ }
32
+ export interface paramsFunCaptcha {
33
+ publickey: string;
34
+ pageurl: string;
35
+ surl?: string;
36
+ header_acao?: boolean;
37
+ pingback?: string;
38
+ proxy?: string;
39
+ proxytype?: string;
40
+ userAgent?: string;
41
+ data?: string;
42
+ }
43
+ export interface paramsImageCaptcha {
44
+ body: string;
45
+ phrase?: 0 | 1;
46
+ regsense?: 0 | 1;
47
+ numeric?: 0 | 1 | 2 | 3 | 4;
48
+ calc?: 0 | 1;
49
+ min_len?: 0 | string | number;
50
+ max_len?: 0 | string | number;
51
+ language?: 0 | 1 | 2;
52
+ lang?: string;
53
+ pingback?: string;
54
+ textinstructions?: string;
55
+ }
56
+ export interface paramsGeetest {
57
+ gt: string;
58
+ challenge: string;
59
+ pageurl: string;
60
+ api_server?: string;
61
+ offline?: number | boolean;
62
+ new_captcha?: number | boolean;
63
+ pingback?: string;
64
+ soft_id?: number;
65
+ proxy?: string;
66
+ proxytype?: string;
67
+ userAgent?: string;
68
+ }
69
+ /**
70
+ * Interface for yandexSmart captcha
71
+ *
72
+ * @typedef {object} yandexSmart
73
+ * @property {string} pageurl URL of the page where the captcha is located
74
+ * @property {string} sitekey The `sitekey` value you found on the captcha page
75
+ * @property {string} pingback
76
+ * @property {string} proxy Format: `login:password@123.123.123.123:3128`. You can find more info about proxies [here](https://2captcha.com/2captcha-api#proxies).
77
+ * @property {string} proxytype Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
78
+ * @property {string} userAgent Your `userAgent` that will be passed to our worker and used to solve the captcha.
79
+ *
80
+ */
81
+ export interface yandexSmart {
82
+ pageurl: string;
83
+ sitekey: string;
84
+ pingback?: string;
85
+ proxy?: string;
86
+ proxytype?: string;
87
+ userAgent?: string;
88
+ }
89
+ /**
90
+ * Interface for GeeTest V4 captcha
91
+ *
92
+ * @typedef {object} paramsGeeTestV4
93
+ * @property {string} pageurl Required parameter. URL of the page where the captcha is located
94
+ * @property {string} captcha_id Required parameter. Value of `captcha_id` parameter you found on target website.
95
+ * @property {string} pingback An optional param. [More info here](https://2captcha.com/2captcha-api#pingback).
96
+ * @property {string} proxy An optional param. Format: `login:password@123.123.123.123:3128`
97
+ * @property {string} proxytype An optional param. Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
98
+ * @property {string} userAgent An optional param. Your `userAgent` that will be passed to our worker and used to solve the captcha.
99
+ *
100
+ */
101
+ export interface paramsGeeTestV4 {
102
+ pageurl: string;
103
+ captcha_id: string;
104
+ pingback?: string;
105
+ proxy?: string;
106
+ proxytype?: string;
107
+ userAgent?: string;
108
+ }
109
+ export interface paramsLemin {
110
+ pageurl: string;
111
+ captcha_id: string;
112
+ div_id: string;
113
+ api_server?: string;
114
+ pingback?: string;
115
+ proxy?: string;
116
+ proxytype?: string;
117
+ }
118
+ export interface paramsAmazonWAF {
119
+ pageurl: string;
120
+ sitekey: string;
121
+ iv: string;
122
+ context: string;
123
+ header_acao?: boolean;
124
+ pingback?: string;
125
+ soft_id?: number;
126
+ proxy?: string;
127
+ proxytype?: string;
128
+ }
129
+ export interface paramsTurnstile {
130
+ pageurl: string;
131
+ sitekey: string;
132
+ action?: string;
133
+ data?: string;
134
+ header_acao?: boolean;
135
+ pingback?: string;
136
+ soft_id?: number;
137
+ proxy?: string;
138
+ proxytype?: string;
139
+ }
140
+ export interface paramsCapyPuzzle {
141
+ pageurl: string;
142
+ captchakey: string;
143
+ api_server?: string;
144
+ version?: string;
145
+ pingback?: string;
146
+ proxy?: string;
147
+ proxytype?: string;
148
+ }
149
+ export interface paramsCoordinates {
150
+ body: string;
151
+ language?: 0 | 1 | 2;
152
+ lang?: string;
153
+ pingback?: string;
154
+ textinstructions?: string;
155
+ imginstructions?: string;
156
+ }
157
+ export interface paramsDataDome {
158
+ pageurl: string;
159
+ captcha_url: string;
160
+ userAgent: string;
161
+ pingback?: string;
162
+ proxy: string;
163
+ proxytype: string;
164
+ }
165
+ export interface paramsCyberSiARA {
166
+ pageurl: string;
167
+ master_url_id: string;
168
+ userAgent: string;
169
+ pingback?: string;
170
+ proxy?: string;
171
+ proxytype?: string;
172
+ }
173
+ export interface paramsMTCaptcha {
174
+ pageurl: string;
175
+ sitekey: string;
176
+ userAgent?: string;
177
+ pingback?: string;
178
+ proxy?: string;
179
+ proxytype?: string;
180
+ }
181
+ export interface friendlyCaptcha {
182
+ pageurl: string;
183
+ sitekey: string;
184
+ pingback?: string;
185
+ proxy?: string;
186
+ proxytype?: string;
187
+ }
188
+ export interface paramsBoundingBox {
189
+ image: string;
190
+ textinstructions?: string;
191
+ imginstructions?: string;
192
+ }
193
+ /**
194
+ * An object containing properties of the captcha solution.
195
+ * @typedef {Object} CaptchaAnswer
196
+ * @param {string} data The solution to the captcha
197
+ * @param {string} id The captcha ID
198
+ */
199
+ interface CaptchaAnswer {
200
+ /** The solution to the captcha */
201
+ data: string;
202
+ /** The ID of the captcha solve */
203
+ id: string;
204
+ }
205
+ /**
206
+ * The main 2captcha class, housing all API calls and api interactions.
207
+ *
208
+ */
209
+ export declare class Solver {
210
+ _apikey: string;
211
+ _pollingFrequency: number;
212
+ _headerACAO: number;
213
+ /**
214
+ * The constructor for the 2captcha Solver class.
215
+ *
216
+ * @param {string} apikey The API key to use
217
+ * @param {number} pollingFrequency The frequency to poll for requests
218
+ *
219
+ */
220
+ constructor(apikey: string, pollingFrequency?: number, enableACAO?: boolean);
221
+ /** The API key this instance is using */
222
+ get apikey(): string;
223
+ /** Frequency the instance polls for updates */
224
+ get pollingFrequency(): number;
225
+ /** Set the API key for this instance */
226
+ set apikey(update: string);
227
+ private get in();
228
+ private get res();
229
+ private get defaultPayload();
230
+ /**
231
+ * Returns the remaining account balance.
232
+ *
233
+ * @return {Promise<Number>} Remaining balance
234
+ * @throws APIError
235
+ * @example
236
+ * solver.balance()
237
+ * .then((res) => {
238
+ * console.log(res)
239
+ * })
240
+ */
241
+ balance(): Promise<number>;
242
+ /**
243
+ * @private
244
+ *
245
+ * Polls for a captcha, finding out if it's been completed
246
+ * @param {string} id Captcha ID
247
+ *
248
+ * @returns {Promise<CaptchaAnswer>}
249
+ * @throws APIError
250
+ */
251
+ private pollResponse;
252
+ /**
253
+ * ### Solves a google reCAPTCHA V2 | V3.
254
+ *
255
+ * [Read more about other reCAPTCHA parameters](https://2captcha.com/2captcha-api#solving_recaptchav2_new).
256
+ *
257
+ * @param {{pageurl, googlekey, cookies, proxy, proxytype, userAgent, invisible, datas, pingback, action, enterprise, min_score, version, domain}} params Object
258
+ * @param {string} params.pageurl The URL the captcha appears on.
259
+ * @param {string} params.googlekey Value of `k` or `data-sitekey` parameter you found on page.
260
+ * @param {string} params.cookies Your cookies that will be passed to our worker who solve the captha.
261
+ * @param {string} params.proxy Format: `login:password@123.123.123.123:3128`. You can find more info about proxies [here](https://2captcha.com/2captcha-api#proxies).
262
+ * @param {string} params.proxytype Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
263
+ * @param {string} params.userAgent Your `userAgent` that will be passed to our worker and used to solve the captcha.
264
+ * @param {number} params.invisible `1` - means that reCAPTCHA is invisible. `0` - normal reCAPTCHA.
265
+ * @param {string} params.datas Value of `data-s` parameter you found on page. Curenttly applicable for Google Search and other Google services.
266
+ * @param {string} params.pingback URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on the server. [More info here](https://2captcha.com/2captcha-api#pingback).
267
+ * @param {string} params.action Value of `action` parameter you found on page.
268
+ * @param {string} params.enterprise `1` - defines that you're sending reCAPTCHA Enterpise.
269
+ * @param {number} params.min_score The score needed for resolution reCAPTCHA V3. Currently it's almost impossible to get token with score higher than `0.3`
270
+ * @param {string} params.version `v2` — defines that you're sending a reCAPTCHA V2. `v3` — defines that you're sending a reCAPTCHA V3.
271
+ * @param {string} params.domain Domain used to load the captcha: `google.com` or `recaptcha.net`
272
+ *
273
+ * @returns {Promise<CaptchaAnswer>} The result from the solve.
274
+ * @throws APIError
275
+ * @example
276
+ * solver.recaptcha({
277
+ * pageurl: 'https://2captcha.com/demo/recaptcha-v2',
278
+ * googlekey: '6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u'
279
+ * })
280
+ * .then((res) => {
281
+ * console.log(res);
282
+ * })
283
+ * .catch((err) => {
284
+ * console.log(err);
285
+ * })
286
+ */
287
+ recaptcha(params: paramsRecaptcha): Promise<CaptchaAnswer>;
288
+ /**
289
+ * Solves a hCaptcha, returning the result as a string.
290
+ *
291
+ * [Read more about other hCaptcha parameters](https://2captcha.com/2captcha-api#solving_hcaptcha).
292
+ *
293
+ * @param {{sitekey, pageurl, data, userAgent, invisible, pingback, proxy, proxytype, domain}} params Object
294
+ * @param {string} params.sitekey The hcaptcha site key. Value of `k` or `data-sitekey` parameter you found on page.
295
+ * @param {string} params.pageurl The URL the captcha appears on.
296
+ * @param {string} params.data Custom `data` that is used in some implementations of hCaptcha, mostly with `invisible=1`. In most cases you see it as `rqdata` inside network requests. IMPORTANT: you MUST provide `userAgent` if you submit captcha with `data` paramater. The value should match the User-Agent you use when interacting with the target website.
297
+ * @param {string} params.userAgent Your userAgent that will be passed to our worker and used to solve the captcha. Required for hCaptcha with `data` parameter.
298
+ * @param {number} params.invisible Use `1` for invisible version of hcaptcha. Currently it is a very rare case.
299
+ * @param {string} params.pingback URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on the server. More info [here](https://2captcha.com/2captcha-api#pingback).
300
+ * @param {string} params.proxy Format: `login:password@123.123.123.123:3128` You can find more info about proxies [here](https://2captcha.com/2captcha-api#proxies).
301
+ * @param {string} params.proxytype Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
302
+ * @param {string} params.domain Domain used to load the captcha: `hcaptcha.com` or `js.hcaptcha.com`
303
+ *
304
+ * @returns {Promise<CaptchaAnswer>} The result from the solve
305
+ * @throws APIError
306
+ * @example
307
+ * solver.hcaptcha({
308
+ * pageurl: "https://2captcha.com/demo/hcaptcha",
309
+ * sitekey: "b76cd927-d266-4cfb-a328-3b03ae07ded6"
310
+ * .then((res) => {
311
+ * console.log(res);
312
+ * })
313
+ * .catch((err) => {
314
+ * console.log(err);
315
+ * })
316
+ */
317
+ hcaptcha(params: paramsHCaptcha): Promise<CaptchaAnswer>;
318
+ /**
319
+ * Solves a GeeTest Captcha. [Read more about parameters and solving for Geetest captcha](https://2captcha.com/2captcha-api#solving_geetest).
320
+ *
321
+ * @param {{ gt, challenge, api_server, offline, new_captcha,
322
+ * pageurl, pingback, proxy, proxytype, userAgent }} params
323
+ * @param {string} params.gt Value of gt parameter found on site
324
+ * @param {string} params.challenge Value of challenge parameter found on site
325
+ * @param {string} params.pageurl The URL the captcha appears on
326
+ * @param {string} params.api_server The URL of the api_server (recommended)
327
+ * @param {number} params.offline In rare cases `initGeetest` can be called with `offline` parameter on the target page. If the call uses offline: true, set the value to `1`.
328
+ * @param {number} params.new_captcha In rare cases `initGeetest` can be called with `new_captcha` parameter. If the call uses `new_captcha: true`, set the value to `1`. Mostly used with offline parameter.
329
+ * @param {string} params.pingback URL for `pingback` (callback) response that will be sent when captcha is solved. [More info here](https://2captcha.com/2captcha-api#pingback).
330
+ * @param {string} params.proxy Format: `login:password@123.123.123.123:3128`. You can find more info about proxies [here](https://2captcha.com/2captcha-api#proxies).
331
+ * @param {string} params.proxytype Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
332
+ * @param {string} params.userAgent Your `userAgent` that will be passed to our worker and used to solve the captcha.
333
+ *
334
+ * @returns {Promise<CaptchaAnswer>} The result from the solve.
335
+ * @throws APIError
336
+ * @example
337
+ * ;(async () => {
338
+ *
339
+ * // Warning: Attention, the `challenge` value is not static but dynamic.
340
+ * // You need to find the queries that makes the captcha on the page to API.
341
+ * // Then you need to make request to this API and get new `challenge`.
342
+ *
343
+ * // For page https://rucaptcha.com/demo/geetest, api address is https://rucaptcha.com/api/v1/captcha-demo/gee-test/init-params?t=${t}
344
+ * // Also note that when make request to API, the request uses the dynamic parameter `t`
345
+ *
346
+ * // You can read more about sending GeeTest here https://2captcha.com/2captcha-api#solving_geetest, or here https://2captcha.com/p/geetest
347
+ * // In this example I solve GeeTest from page https://2captcha.com/demo/geetest
348
+ *
349
+ * const t = new Date().getTime()
350
+ * // below i make a request to get a new `challenge`.
351
+ * const response = await fetch(`https://2captcha.com/api/v1/captcha-demo/gee-test/init-params?t=${t}`)
352
+ * const data = await response.json()
353
+ *
354
+ * const params = {
355
+ * pageurl: 'https://rucaptcha.com/demo/geetest',
356
+ * gt: data.gt,
357
+ * challenge: data.challenge
358
+ * }
359
+ *
360
+ * const res = await solver.geetest(params)
361
+ * try {
362
+ * console.log(res)
363
+ * } catch (error) {
364
+ * console.error(error);
365
+ * }
366
+ * })()
367
+ */
368
+ geetest(params: paramsGeetest): Promise<CaptchaAnswer>;
369
+ /**
370
+ * ### Solves a GeeTest V4 Captcha.
371
+ *
372
+ *
373
+ * This method accepts an object with the following fields: `pageurl`, `captcha_id`, `pingback`, `proxy`, `proxytype`, `userAgent`.
374
+ * The `pageurl` and `captcha_id` fields are required.
375
+ *
376
+ * @param {{pageurl, captcha_id, pingback, proxy, proxytype, userAgent}} params The method geetestV4 takes arguments as an object.
377
+ * @param {string} params.pageurl Full URL of the page where you see Geetest V4 captcha.
378
+ * @param {string} params.captcha_id Required parameter. Value of `captcha_id` parameter you found on target website.
379
+ * @param {string} params.pingback An optional param. [More info here](https://2captcha.com/2captcha-api#pingback).
380
+ * @param {string} params.proxy An optional param. Format: `login:password@123.123.123.123:3128`. You can find more info about proxies [here](https://2captcha.com/2captcha-api#proxies).
381
+ * @param {string} params.proxytype An optional param. Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
382
+ * @param {string} params.userAgent An optional param. Your `userAgent` that will be passed to our worker and used to solve the captcha.
383
+ *
384
+ * @returns {Promise<CaptchaAnswer>} The result from the solve.
385
+ * @throws APIError
386
+ * @example
387
+ * solver.geetestV4({
388
+ * pageurl: 'https://2captcha.com/demo/geetest-v4',
389
+ * captcha_id: 'e392e1d7fd421dc63325744d5a2b9c73'
390
+ * })
391
+ * .then((res) => {
392
+ * console.log(res)
393
+ * })
394
+ * .catch((err) => {
395
+ * console.log(err);
396
+ * })
397
+ */
398
+ geetestV4(params: paramsGeeTestV4): Promise<CaptchaAnswer>;
399
+ /**
400
+ * Method for sending Yandex Smart Captcha.
401
+ * This method accepts an object with the following fields: `pageurl`, `sitekey`, `pingback`, `proxy`, `proxytype`.
402
+ * The `pageurl` and `sitekey` fields are required.
403
+ *
404
+ * @param {{pageurl, sitekey, pingback, proxy, proxytype, userAgent}} params The method takes arguments as an object.
405
+ * @param {string} params.pageurl Required parameter. URL of the page where the captcha is located.
406
+ * @param {string} params.sitekey Required parameter. The `sitekey` value you found on the captcha page.
407
+ * @param {string} params.pingback An optional param.
408
+ * @param {string} params.proxy An optional param. Format: `login:password@123.123.123.123:3128`.
409
+ * @param {string} params.proxytype An optional param. Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
410
+ * @param {string} params.userAgent An optional param. Your `userAgent` that will be passed to our worker and used to solve the captcha.
411
+ *
412
+ * @returns {Promise<CaptchaAnswer>} The result from the solve.
413
+ * @throws APIError
414
+ * @example
415
+ * solver.yandexSmart({
416
+ * pageurl: "https://captcha-api.yandex.ru/demo",
417
+ * sitekey: "FEXfAbHQsToo97VidNVk3j4dC74nGW1DgdxjtNB9"
418
+ * })
419
+ * .then((res) => {
420
+ * console.log(res)
421
+ * })
422
+ * .catch((err) => {
423
+ * console.log(err);
424
+ * })
425
+ */
426
+ yandexSmart(params: yandexSmart): Promise<CaptchaAnswer>;
427
+ /**
428
+ * Solves a image-based captcha. [Read more about parameters for image captcha](https://2captcha.com/2captcha-api#solving_normal_captcha).
429
+ *
430
+ * @param {{ body,
431
+ * phrase,
432
+ * regsense,
433
+ * numeric,
434
+ * calc,
435
+ * min_len,
436
+ * max_len,
437
+ * language,
438
+ * lang,
439
+ * textinstructions,
440
+ * pingback }} params Extra properties to pass to 2captcha.
441
+ * @param {number} params.body Base64 image data for the captcha.
442
+ * @param {number} params.phrase Captcha contains two or more words? `1` - Yes. `0` - No.
443
+ * @param {number} params.regsense Captcha is case sensitive? `1` - Yes. `0` - No.
444
+ * @param {number} params.numeric `0` - not specified. `1` - captcha contains only numbers. `2` - captcha contains only letters. `3` - captcha contains only numbers OR only letters. `4` - captcha MUST contain both numbers AND letters.
445
+ * @param {number} params.calc Does captcha require calculations? (e.g. type the result 4 + 8 = ) `1` - Yes. `0` - No.
446
+ * @param {number} params.min_len `1..20` - minimal number of symbols in captcha. `0` - not specified.
447
+ * @param {number} params.max_len `1..20` - maximal number of symbols in captcha. `0` - not specified.
448
+ * @param {number} params.language `0` - not specified. `1` - Cyrillic captcha. `2` - Latin captcha
449
+ * @param {string} params.lang Language code. [See the list of supported languages](https://2captcha.com/2captcha-api#language).
450
+ * @param {string} params.textinstructions Text will be shown to worker to help him to solve the captcha correctly. For example: type red symbols only.
451
+ * @param {string} params.pingback URL for `pingback` (callback) response that will be sent when captcha is solved. [More info here](https://2captcha.com/2captcha-api#pingback).
452
+ *
453
+ * @returns {Promise<CaptchaAnswer>} The result from the solve
454
+ * @throws APIError
455
+ * @example
456
+ * const imageBase64 = fs.readFileSync("./tests/media/imageCaptcha_6e584.png", "base64")
457
+ *
458
+ * solver.imageCaptcha({
459
+ * body: imageBase64,
460
+ * numeric: 4,
461
+ * min_len: 5,
462
+ * max_len: 5
463
+ * })
464
+ * .then((res) => {
465
+ * console.log(res);
466
+ * })
467
+ * .catch((err) => {
468
+ * console.log(err);
469
+ * })
470
+ */
471
+ imageCaptcha(params: paramsImageCaptcha): Promise<CaptchaAnswer>;
472
+ /**
473
+ * ### Solves Arkose Labs FunCaptcha.
474
+ *
475
+ * [Read more](https://2captcha.com/2captcha-api#solving_funcaptcha_new) about other solving and other parameters for Arkose Labs FunCaptcha.
476
+ *
477
+ * @param {{pageurl, publicKey, surl, data, pingback, proxy, proxytype, userAgent}} params Object
478
+ * @param {string} params.publicKey The FunCaptcha Public Key
479
+ * @param {string} params.pageurl The URL to the website the captcha is seen on
480
+ * @param {string} params.surl The FunCaptcha Service URL (recommended)
481
+ * @param {string} params.data Custom data to pass to FunCaptcha. For example: `'data': '{"blob": "foo"}'`.
482
+ * @param {string} params.pingback URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on the server. [More info here](https://2captcha.com/2captcha-api#pingback).
483
+ * @param {string} params.proxy Format: `login:password@123.123.123.123:3128` You can find more info about proxies [here](https://2captcha.com/2captcha-api#proxies).
484
+ * @param {string} params.proxytype Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
485
+ * @param {string} params.userAgent Your `userAgent` that will be passed to our worker and used to solve the captcha.
486
+ *
487
+ * @returns {Promise<CaptchaAnswer>} The result from the solve
488
+ * @throws APIError
489
+ *
490
+ * @example
491
+ * solver.funCaptcha({
492
+ * pageurl: "https://funcaptcha.com/tile-game-lite-mode/fc/api/nojs/?pkey=804380F4-6844-FFA1-ED4E-5877CA1F1EA4&lang=en",
493
+ * publickey: "804380F4-6844-FFA1-ED4E-5877CA1F1EA4"
494
+ * })
495
+ * .then((res) => {
496
+ * console.log(res);
497
+ * })
498
+ * .catch((err) => {
499
+ * console.log(err);
500
+ * })
501
+ */
502
+ funCaptcha(params: paramsFunCaptcha): Promise<CaptchaAnswer>;
503
+ /**
504
+ *
505
+ * ### Solves a Lemin captcha
506
+ *
507
+ * [Read more about other Lemin captcha parameters](https://2captcha.com/2captcha-api#lemin).
508
+ *
509
+ * @param {{ pageurl, captcha_id, div_id, api_server, pingback, proxy, proxytype}} params Object
510
+ * @param {string} params.pageurl The URL the captcha appears on.
511
+ * @param {string} params.captcha_id Value of `captcha_id` parameter you found on page.
512
+ * @param {string} params.div_id Value `id` of captcha pareent `<div></div>` element.
513
+ * @param {string} params.api_server The domain part of script URL you found on page. Default value: `https://api.leminnow.com/`
514
+ * @param {string} params.pingback URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on the server. [More info here](https://2captcha.com/2captcha-api#pingback).
515
+ * @param {string} params.proxy Format: `login:password@123.123.123.123:3128` You can find more info about proxies [here](https://2captcha.com/2captcha-api#proxies).
516
+ * @param {string} params.proxytype Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
517
+ *
518
+ * @example
519
+ * solver.lemin({
520
+ * pageurl:'https://2captcha.com/demo/lemin',
521
+ * captcha_id: 'CROPPED_3dfdd5c_d1872b526b794d83ba3b365eb15a200b',
522
+ * div_id: 'lemin-cropped-captcha',
523
+ * api_server: 'api.leminnow.com'
524
+ * })
525
+ * .then((res) => {
526
+ * console.log(res);
527
+ * })
528
+ * .catch((err) => {
529
+ * console.log(err);
530
+ * })
531
+ */
532
+ lemin(params: paramsLemin): Promise<CaptchaAnswer>;
533
+ /**
534
+ *
535
+ * ### Solves Amazon WAF captcha
536
+ *
537
+ * [Read more about "Amazon WAF" captcha](https://2captcha.com/2captcha-api#amazon-waf).
538
+ *
539
+ * @param {{ pageurl, sitekey, iv, context, pingback, proxy, proxytype}} params The `amazonWaf` method takes arguments as an object. Thus, the `pageurl`, `sitekey`, `iv`, `context` fields in the passed object are mandatory.
540
+ * @param {string} params.pageurl Is the full `URL` of page where you were challenged by the captcha.
541
+ * @param {string} params.sitekey Is a value of `key` parameter in the page source.
542
+ * @param {string} params.iv Is a value of `iv` parameter in the page source.
543
+ * @param {string} params.context Is a value of `context` parameter in the page source.
544
+ * @param {string} params.pingback URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on the server. [More info here](https://2captcha.com/2captcha-api#pingback).
545
+ * @param {string} params.proxy Format: `login:password@123.123.123.123:3128` You can find more info about proxies [here](https://2captcha.com/2captcha-api#proxies).
546
+ * @param {string} params.proxytype Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
547
+ *
548
+ * @example
549
+ * solver.amazonWaf({
550
+ * pageurl: "https://non-existent-example.execute-api.us-east-1.amazonaws.com/latest",
551
+ * sitekey: "AQIDAHjcYu/GjX+QlghicBgQ/7bFaQZ+m5FKCMDnO+vTbNg96AHMDLodoefdvyOnsHMRtEKQAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMUX+ZqwwuANRnZujSAgEQgDvHSxUQmVBuyUtumoW2n4ccTG7xQN1r3X/zz41qmQaYv9SSSvQrjIoDXKaUQ23tVb4ii8+uljuRdz/HPA==",
552
+ * context: "9BUgmlm48F92WUoqv97a49ZuEJJ50TCk9MVr3C7WMtQ0X6flVbufM4n8mjFLmbLVAPgaQ1Jydeaja94iAS49ljb+sUNLoukWedAQZKrlY4RdbOOzvcFqmD/ZepQFS9N5w15Exr4VwnVq+HIxTsDJwRviElWCdzKDebN/mk8/eX2n7qJi5G3Riq0tdQw9+C4diFZU5E97RSeahejOAAJTDqduqW6uLw9NsjJBkDRBlRjxjn5CaMMo5pYOxYbGrM8Un1JH5DMOLeXbq1xWbC17YSEoM1cRFfTgOoc+VpCe36Ai9Kc=",
553
+ * iv: "CgAHbCe2GgAAAAAj",
554
+ * })
555
+ * .then((res) => {
556
+ * console.log(res);
557
+ * })
558
+ * .catch((err) => {
559
+ * console.log(err);
560
+ * })
561
+ */
562
+ amazonWaf(params: paramsAmazonWAF): Promise<CaptchaAnswer>;
563
+ /**
564
+ *
565
+ * ### Solves Cloudflare Turnstile captcha
566
+ *
567
+ * [Read more about Cloudflare Turnstile captcha](https://2captcha.com/2captcha-api#turnstile).
568
+ *
569
+ * @param {{ pageurl, sitekey, action, data, pingback, proxy, proxytype}} params The `сloudflareTurnstile` method takes arguments as an object. Thus, the `pageurl`, `sitekey` fields in the passed object are mandatory.
570
+ * @param {string} params.pageurl Full `URL` of the page where you see the captcha.
571
+ * @param {string} params.sitekey Is a value of `sitekey` parameter in the page source.
572
+ * @param {string} params.action Value of optional `action` parameter you found on page.
573
+ * @param {string} params.data Value of optional `data` parameter you found on page.
574
+ * @param {string} params.pingback URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on the server. [More info here](https://2captcha.com/2captcha-api#pingback).
575
+ * @param {string} params.proxy Format: `login:password@123.123.123.123:3128` You can find more info about proxies [here](https://2captcha.com/2captcha-api#proxies).
576
+ * @param {string} params.proxytype Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
577
+ *
578
+ * @example
579
+ * solver.cloudflareTurnstile({
580
+ * pageurl: "https://app.nodecraft.com/login",
581
+ * sitekey: "0x4AAAAAAAAkg0s3VIOD10y4"
582
+ * })
583
+ * .then((res) => {
584
+ * console.log(res);
585
+ * })
586
+ * .catch((err) => {
587
+ * console.log(err);
588
+ * })
589
+ */
590
+ cloudflareTurnstile(params: paramsTurnstile): Promise<CaptchaAnswer>;
591
+ /**
592
+ * ### Solves a Coordinates captcha.
593
+ *
594
+ * @param {{ body, imginstructions, textinstructions, language, lang, pingback }} params parameters Сoordinates Captcha as an object.
595
+ * @param {string} params.body Base64-encoded captcha image.
596
+ * @param {string} params.imginstructions Base64-encoded image with instruction for solving captcha.
597
+ * @param {string} params.textinstructions Text will be shown to worker to help him to solve the captcha correctly. For example: click on all objects in red color.
598
+ * @param {number} params.language `0` - not specified. `1` - Cyrillic captcha. `2` - Latin captcha
599
+ * @param {string} params.lang Language code. [See the list of supported languages](https://2captcha.com/2captcha-api#language).
600
+ * @param {string} params.pingback URL for `pingback` (callback) response that will be sent when captcha is solved. [More info here](https://2captcha.com/2captcha-api#pingback).
601
+ *
602
+ * @returns {Promise<CaptchaAnswer>} The result from the solve
603
+ *
604
+ * @example
605
+ * const imageBase64 = fs.readFileSync("./tests/media/hCaptchaImage.jpg", "base64")
606
+ *
607
+ * solver.coordinates({
608
+ * body: imageBase64,
609
+ * textinstructions: 'Select all photos containing the boat'
610
+ * })
611
+ * .then((res) => {
612
+ * console.log(res);
613
+ * })
614
+ * .catch((err) => {
615
+ * console.log(err);
616
+ * })
617
+ */
618
+ coordinates(params: paramsCoordinates): Promise<CaptchaAnswer>;
619
+ /**
620
+ * pageurl: string,
621
+ captchakey: string,
622
+ api_server?: string,
623
+ version?: string,
624
+ header_acao?: boolean,
625
+ pingback?: string,
626
+ proxy?: string,
627
+ proxytype?: string,
628
+ */
629
+ /**
630
+ * ### Solves Capy Puzzle captcha
631
+ *
632
+ * @param {{ pageurl, captchakey, api_server, version, pingback, proxy, proxytype}} params Parameters Capy Puzzle Captcha as an object.
633
+ * @param {string} params.pageurl Full `URL`of the page where you see the captcha.
634
+ * @param {string} params.captchakey Value of `captchakey` parameter you found on page.
635
+ * @param {string} params.api_server The domain part of script URL you found on page. Default value: `https://jp.api.capy.me/`.
636
+ * @param {string} params.version The version of captcha task: `puzzle` (assemble a puzzle) or `avatar` (drag an object)..
637
+ * @param {string} params.pingback URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on the server. [More info here](https://2captcha.com/2captcha-api#pingback).
638
+ * @param {string} params.proxy Format: `login:password@123.123.123.123:3128` You can find more info about proxies [here](https://2captcha.com/2captcha-api#proxies).
639
+ * @param {string} params.proxytype Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
640
+ *
641
+ * @example
642
+ * solver.capyPuzzle({
643
+ * pageurl: "https://www.capy.me/account/register/",
644
+ * captchakey: "PUZZLE_Cme4hZLjuZRMYC3uh14C52D3uNms5w"
645
+ * })
646
+ * .then((res) => {
647
+ * console.log(res);
648
+ * })
649
+ * .catch((err) => {
650
+ * console.log(err);
651
+ * })
652
+ */
653
+ capyPuzzle(params: paramsCapyPuzzle): Promise<CaptchaAnswer>;
654
+ /**
655
+ * ### Solves DataDome captcha
656
+ *
657
+ * @param {{ pageurl, captcha_url, userAgent, pingback, proxy, proxytype}} params Parameters DataDome Captcha as an object.
658
+ * @param {string} params.pageurl Full `URL` of the page where you see the captcha.
659
+ * @param {string} params.captcha_url The value of the `src` parameter for the `iframe` element containing the captcha on the page.
660
+ * @param {string} params.userAgent ser-Agent of your MODERN browser
661
+ * @param {string} params.pingback URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on the server. [More info here](https://2captcha.com/2captcha-api#pingback).
662
+ * @param {string} params.proxy Format: `login:password@123.123.123.123:3128` You can find more info about proxies [here](https://2captcha.com/2captcha-api#proxies).
663
+ * @param {string} params.proxytype Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
664
+ *
665
+ * @example
666
+ * solver.dataDome({
667
+ * pageurl: "https://rendezvousparis.hermes.com/client/register",
668
+ * captcha_url: "https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAAAAMAEuQtkf4k1c0ABZhYZA%3D%3D&hash=789361B674144528D0B7EE76B35826&cid=mY4z7GNmh7Nt1lAFwpbNHAOcWPhyPgjHD2K1Pm~Od1iEKYLUnK3t7N2ZGUj8OqDK65cnwJHtHwd~t902vlwpSBA5l4ZHbS1Qszv~jEuEUJNQ_jMAjar2Kj3kq20MRJYh&t=fe&referer=https%3A%2F%2Frendezvousparis.hermes.com%2Fclient%2Fregister&s=40119&e=67fef144ac1a54dbd7507776367d2f9d5e36ec3add17fa22f3cb881db8385838",
669
+ * userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36",
670
+ * proxy: "1.2.3.4:8888:user:password",
671
+ * proxytype: "http"
672
+ * })
673
+ * .then((res) => {
674
+ * console.log(res);
675
+ * })
676
+ * .catch((err) => {
677
+ * console.log(err);
678
+ * })
679
+ */
680
+ dataDome(params: paramsDataDome): Promise<CaptchaAnswer>;
681
+ /**
682
+ * ### Solves CyberSiARA captcha
683
+ *
684
+ * @param {{ pageurl, master_url_id, userAgent, pingback, proxy, proxytype}} params Parameters CyberSiARA Captcha as an object.
685
+ * @param {string} params.pageurl Full `URL` of the page where you see the captcha.
686
+ * @param {string} params.master_url_id The value of `MasterUrlId` parameter obtained from the request to the endpoint `API/CyberSiara/GetCyberSiara`.
687
+ * @param {string} params.userAgent ser-Agent of your MODERN browser
688
+ * @param {string} params.pingback URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on the server. [More info here](https://2captcha.com/2captcha-api#pingback).
689
+ * @param {string} params.proxy Format: `login:password@123.123.123.123:3128` You can find more info about proxies [here](https://2captcha.com/2captcha-api#proxies).
690
+ * @param {string} params.proxytype Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
691
+ *
692
+ * @example
693
+ * solver.cyberSiARA({
694
+ * pageurl: "https://www.cybersiara.com/book-a-demo",
695
+ * master_url_id: "OXR2LVNvCuXykkZbB8KZIfh162sNT8S2",
696
+ * userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36"
697
+ * })
698
+ * .then((res) => {
699
+ * console.log(res);
700
+ * })
701
+ * .catch((err) => {
702
+ * console.log(err);
703
+ * })
704
+ */
705
+ cyberSiARA(params: paramsCyberSiARA): Promise<CaptchaAnswer>;
706
+ /**
707
+ * ### Solves MTCaptcha
708
+ *
709
+ * @param {{ pageurl, sitekey, userAgent, pingback, proxy, proxytype}} params Parameters MTCaptcha as an object.
710
+ * @param {string} params.pageurl Full `URL` of the page where you see the captcha.
711
+ * @param {string} params.sitekey TThe value of `sitekey` parameter found on the page.
712
+ * @param {string} params.pingback URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on the server. [More info here](https://2captcha.com/2captcha-api#pingback).
713
+ * @param {string} params.proxy Format: `login:password@123.123.123.123:3128` You can find more info about proxies [here](https://2captcha.com/2captcha-api#proxies).
714
+ * @param {string} params.proxytype Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
715
+ *
716
+ * @example
717
+ * solver.mtCaptcha({
718
+ * pageurl: "https://service.mtcaptcha.com/mtcv1/demo/index.html",
719
+ * sitekey: "MTPublic-DemoKey9M"
720
+ * })
721
+ * .then((res) => {
722
+ * console.log(res);
723
+ * })
724
+ * .catch((err) => {
725
+ * console.log(err);
726
+ * })
727
+ */
728
+ mtCaptcha(params: paramsMTCaptcha): Promise<CaptchaAnswer>;
729
+ /**
730
+ * ### Solves Cutcaptcha
731
+ *
732
+ * @param {{ pageurl, sitekey, userAgent, pingback, proxy, proxytype}} params Parameters MTCaptcha as an object.
733
+ * @param {string} params.pageurl Full `URL` of the page where you see the captcha.
734
+ * @param {string} params.sitekey TThe value of `sitekey` parameter found on the page.
735
+ * @param {string} params.pingback URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on the server. [More info here](https://2captcha.com/2captcha-api#pingback).
736
+ * @param {string} params.proxy Format: `login:password@123.123.123.123:3128` You can find more info about proxies [here](https://2captcha.com/2captcha-api#proxies).
737
+ * @param {string} params.proxytype Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
738
+ *
739
+ * @example
740
+ * solver.cutCaptcha({
741
+ * pageurl: "https://service.mtcaptcha.com/mtcv1/demo/index.html",
742
+ * sitekey: "MTPublic-DemoKey9M"
743
+ * })
744
+ * .then((res) => {
745
+ * console.log(res);
746
+ * })
747
+ * .catch((err) => {
748
+ * console.log(err);
749
+ * })
750
+ */
751
+ cutCaptcha(params: paramsMTCaptcha): Promise<CaptchaAnswer>;
752
+ /**
753
+ * ### Solves Friendly Captcha
754
+ *
755
+ * @param {{ pageurl, sitekey, pingback, proxy, proxytype}} params Parameters Friendly Captcha as an object.
756
+ * @param {string} params.pageurl Full `URL` of the page where you see the captcha.
757
+ * @param {string} params.sitekey The value of `data-apikey` or `data-sitekey` parameter found on the page.
758
+ * @param {string} params.pingback URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on the server. [More info here](https://2captcha.com/2captcha-api#pingback).
759
+ * @param {string} params.proxy Format: `login:password@123.123.123.123:3128` You can find more info about proxies [here](https://2captcha.com/2captcha-api#proxies).
760
+ * @param {string} params.proxytype Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
761
+ *
762
+ * @example
763
+ * solver.friendlyCaptcha({
764
+ * pageurl: "https://geizhals.de/?liftban=1&from=/455973138?fsean=5901747021356",
765
+ * sitekey: "FCMST5VUMCBOCGQ9"
766
+ * })
767
+ * .then((res) => {
768
+ * console.log(res);
769
+ * })
770
+ * .catch((err) => {
771
+ * console.log(err);
772
+ * })
773
+ */
774
+ friendlyCaptcha(params: friendlyCaptcha): Promise<CaptchaAnswer>;
775
+ /**
776
+ * ### Bounding Box Method
777
+ *
778
+ * @param {{ image, textinstructions, imginstructions }} params Parameters Bounding Box Method as an object.
779
+ * @param {image} params.image Image containing data for markup. The image must be encoded in `Base64` format.
780
+ * @param {textinstructions} params.textinstructions Text will be shown to worker to help him to select object on the image correctly. For example: "*Select cars in the image*". **Optional parameter**, if the instruction already exists in the form of the `imginstructions`.
781
+ * @param {imginstructions} params.imginstructions Image with instruction for worker to help him to select object on the image correctly. The image must be encoded in `Base64` format. **Optional parameter**, if the instruction already exists in the form of the `textinstructions`.
782
+ *
783
+ * @example
784
+ * solver.boundingBox({
785
+ * image: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgG...",
786
+ * textinstructions: "Select cars in the image"
787
+ * })
788
+ * .then((res) => {
789
+ * console.log(res);
790
+ * })
791
+ * .catch((err) => {
792
+ * console.log(err);
793
+ * })
794
+ */
795
+ boundingBox(params: paramsBoundingBox): Promise<CaptchaAnswer>;
796
+ /**
797
+ * Reports a captcha as correctly solved.
798
+ *
799
+ * @param {string} id The ID of the captcha
800
+ * @throws APIError
801
+ * @example
802
+ * solver.goodReport("7031854546")
803
+ *
804
+ */
805
+ goodReport(id: string): Promise<void>;
806
+ /**
807
+ * Report an unsuccessful solve
808
+ *
809
+ * @param {string} id The id of the captcha solve
810
+ *
811
+ * @returns {Promise<void>} Resolves on completion
812
+ * @throws APIError
813
+ * @example
814
+ * solver.badReport("7031854546")
815
+ */
816
+ badReport(id: string): Promise<void>;
817
+ }
818
+ export {};
819
+ //# sourceMappingURL=2captcha.d.ts.map