@2captcha/captcha-solver 1.0.2 → 1.0.4

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