capskip 1.4.0 → 1.6.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/CHANGELOG.md +66 -0
- package/README.md +125 -7
- package/docs/API_REFERENCE.md +243 -0
- package/examples/datadome.js +142 -0
- package/examples/hcaptcha.js +98 -0
- package/package.json +7 -2
- package/src/apiParams.js +290 -0
- package/src/index.js +1 -1
- package/src/solver.js +163 -1
- package/types/index.d.ts +124 -6
package/types/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface CapSkipOptions {
|
|
|
20
20
|
defaultTimeout?: number;
|
|
21
21
|
/**
|
|
22
22
|
* Seconds to poll reCAPTCHA / Turnstile / GeeTest / CaptchaFox / Friendly
|
|
23
|
-
* Captcha / AWS WAF before timing out. Default `300`. ALTCHA and Capy use
|
|
23
|
+
* Captcha / AWS WAF / DataDome / hCaptcha before timing out. Default `300`. ALTCHA and Capy use
|
|
24
24
|
* `defaultTimeout` instead — neither is a browser solve.
|
|
25
25
|
*/
|
|
26
26
|
recaptchaTimeout?: number;
|
|
@@ -37,13 +37,16 @@ export interface SolveResult {
|
|
|
37
37
|
* this is the raw JSON string CapSkip returns — prefer the parsed
|
|
38
38
|
* `challenge` / `validate` / `seccode` fields below. For ALTCHA it is the
|
|
39
39
|
* base64 token, also exposed as `token`. For Capy and AWS WAF it is the raw
|
|
40
|
-
* answer object, expanded into the fields below.
|
|
40
|
+
* answer object, expanded into the fields below. For DataDome it is the
|
|
41
|
+
* `datadome` cookie exactly as DataDome set it, attributes included.
|
|
41
42
|
*/
|
|
42
43
|
code: string | Record<string, unknown>;
|
|
43
44
|
/**
|
|
44
|
-
* Turnstile and
|
|
45
|
-
* For CaptchaFox this is the browser's own,
|
|
46
|
-
* when the solve
|
|
45
|
+
* Turnstile, CaptchaFox, hCaptcha and DataDome — the User-Agent to use when
|
|
46
|
+
* submitting the token. For CaptchaFox and hCaptcha this is the browser's own,
|
|
47
|
+
* not one you sent, and it is absent when the solve reported none. For DataDome
|
|
48
|
+
* it is the User-Agent the cookie was earned with — the one you sent, or
|
|
49
|
+
* CapSkip's own browser's — and every request carrying the cookie must send it.
|
|
47
50
|
*/
|
|
48
51
|
userAgent?: string;
|
|
49
52
|
/** GeeTest only — the `geetest_challenge` value to post back. */
|
|
@@ -69,7 +72,12 @@ export interface SolveResult {
|
|
|
69
72
|
*/
|
|
70
73
|
answer?: string;
|
|
71
74
|
/**
|
|
72
|
-
*
|
|
75
|
+
* hCaptcha — the second value hCaptcha hands the widget next to the token.
|
|
76
|
+
* Always present on an `hcaptcha()` result, `''` when the widget handed out
|
|
77
|
+
* none; most sites never read it. Other polled results carry it only when
|
|
78
|
+
* the server sent one.
|
|
79
|
+
*
|
|
80
|
+
* Capy — empty for a puzzle solve. Present for shape compatibility with
|
|
73
81
|
* 2Captcha's documented response; it carries nothing.
|
|
74
82
|
*/
|
|
75
83
|
respKey?: string;
|
|
@@ -82,6 +90,17 @@ export interface SolveResult {
|
|
|
82
90
|
captcha_voucher?: string;
|
|
83
91
|
/** AWS WAF only — the token the voucher was issued for. Pair with `captcha_voucher`. */
|
|
84
92
|
existing_token?: string;
|
|
93
|
+
/**
|
|
94
|
+
* DataDome only — the `datadome=...` pair alone (`code` up to its first
|
|
95
|
+
* `;`), ready for a `Cookie` header.
|
|
96
|
+
*/
|
|
97
|
+
cookie?: string;
|
|
98
|
+
/**
|
|
99
|
+
* DataDome only — present only when the task sent no proxy and CapSkip solved
|
|
100
|
+
* through its own DataDome proxy list: that proxy as `host:port`. The cookie
|
|
101
|
+
* works only through it.
|
|
102
|
+
*/
|
|
103
|
+
proxy?: string;
|
|
85
104
|
}
|
|
86
105
|
|
|
87
106
|
/** Extra options for {@link CapSkip.normal}. */
|
|
@@ -280,6 +299,73 @@ export interface AmazonWafOptions {
|
|
|
280
299
|
[key: string]: unknown;
|
|
281
300
|
}
|
|
282
301
|
|
|
302
|
+
/** Extra options for {@link CapSkip.dataDome}. */
|
|
303
|
+
export interface DataDomeOptions {
|
|
304
|
+
/**
|
|
305
|
+
* The User-Agent you will send with the cookie. Must be stock Chrome for
|
|
306
|
+
* Windows with the same major version as the browser CapSkip solves with.
|
|
307
|
+
* Leave it out and CapSkip uses its own browser's, reported as `userAgent`.
|
|
308
|
+
*/
|
|
309
|
+
userAgent?: string;
|
|
310
|
+
/** Alias for `userAgent`. */
|
|
311
|
+
useragent?: string;
|
|
312
|
+
/** The challenge iframe URL (alias for the `captchaUrl` argument). */
|
|
313
|
+
captcha_url?: string;
|
|
314
|
+
/** The challenge iframe URL (alias for the `captchaUrl` argument). */
|
|
315
|
+
captchaUrl?: string;
|
|
316
|
+
/**
|
|
317
|
+
* The proxy your later requests go through. Left out, CapSkip solves through
|
|
318
|
+
* its own DataDome proxy list and the result names that proxy as `proxy`.
|
|
319
|
+
*/
|
|
320
|
+
proxy?: Proxy | string;
|
|
321
|
+
/** Proxy type when `proxy` is a bare string. Default `HTTP`. */
|
|
322
|
+
proxytype?: string;
|
|
323
|
+
/** Poll timeout in seconds. Default: the client's `recaptchaTimeout`. */
|
|
324
|
+
timeout?: number;
|
|
325
|
+
/** Max seconds between polls for this solve. */
|
|
326
|
+
polling_interval?: number;
|
|
327
|
+
/** `1` to request the raw JSON response from CapSkip. */
|
|
328
|
+
json?: number;
|
|
329
|
+
[key: string]: unknown;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/** Extra options for {@link CapSkip.hcaptcha}. */
|
|
333
|
+
export interface HCaptchaOptions {
|
|
334
|
+
/** The page URL (alias for the `url` argument). */
|
|
335
|
+
pageurl?: string;
|
|
336
|
+
/** The page URL (alias for the `url` argument). */
|
|
337
|
+
url?: string;
|
|
338
|
+
/**
|
|
339
|
+
* `1` / `true` for a `data-size="invisible"` widget; `0` / `false` (the
|
|
340
|
+
* default) is not sent. The strings `"1"`, `"0"`, `"true"` and `"false"`
|
|
341
|
+
* are accepted too; anything else is refused.
|
|
342
|
+
*/
|
|
343
|
+
invisible?: boolean | 0 | 1 | '0' | '1' | 'true' | 'false';
|
|
344
|
+
/**
|
|
345
|
+
* hCaptcha Enterprise `rqdata`, the value the site passes to
|
|
346
|
+
* `hcaptcha.setData()`. Single use and short-lived: fetch a fresh one per task.
|
|
347
|
+
*/
|
|
348
|
+
data?: string;
|
|
349
|
+
/**
|
|
350
|
+
* The User-Agent you will submit the form with. CapSkip uses it only when it
|
|
351
|
+
* matches the browser it solves with.
|
|
352
|
+
*/
|
|
353
|
+
userAgent?: string;
|
|
354
|
+
/** Alias for `userAgent`. */
|
|
355
|
+
useragent?: string;
|
|
356
|
+
/** Proxy used for solving. */
|
|
357
|
+
proxy?: Proxy | string;
|
|
358
|
+
/** Proxy type when `proxy` is a bare string. Default `HTTP`. */
|
|
359
|
+
proxytype?: string;
|
|
360
|
+
/** Poll timeout in seconds. Default: the client's `recaptchaTimeout`. */
|
|
361
|
+
timeout?: number;
|
|
362
|
+
/** Max seconds between polls for this solve. */
|
|
363
|
+
polling_interval?: number;
|
|
364
|
+
/** `1` to request the raw JSON response from CapSkip. */
|
|
365
|
+
json?: number;
|
|
366
|
+
[key: string]: unknown;
|
|
367
|
+
}
|
|
368
|
+
|
|
283
369
|
/** Options for the {@link CapSkip.solve} manual workflow. */
|
|
284
370
|
export interface SolveOptions {
|
|
285
371
|
/** Poll timeout in seconds (falls back to the configured default). */
|
|
@@ -376,6 +462,38 @@ export class CapSkip {
|
|
|
376
462
|
url: string,
|
|
377
463
|
options?: AmazonWafOptions,
|
|
378
464
|
): Promise<SolveResult>;
|
|
465
|
+
/**
|
|
466
|
+
* Solve a DataDome challenge (slider or device check) and return the
|
|
467
|
+
* `datadome` cookie.
|
|
468
|
+
*
|
|
469
|
+
* `captchaUrl` is the challenge iframe's address on captcha-delivery.com
|
|
470
|
+
* (`/captcha/` or `/interstitial/`), `url` the page that returned the block
|
|
471
|
+
* page. The result carries `code` (the cookie as set), `cookie` (the
|
|
472
|
+
* `datadome=...` pair), `userAgent` (send it with the cookie) and, only when
|
|
473
|
+
* no proxy was passed and CapSkip used its own DataDome proxy list, `proxy`
|
|
474
|
+
* — the cookie works only through that address.
|
|
475
|
+
*/
|
|
476
|
+
dataDome(
|
|
477
|
+
captchaUrl: string | undefined,
|
|
478
|
+
url: string,
|
|
479
|
+
options?: DataDomeOptions,
|
|
480
|
+
): Promise<SolveResult>;
|
|
481
|
+
/**
|
|
482
|
+
* Solve an hCaptcha widget (checkbox, invisible or Enterprise) and return
|
|
483
|
+
* its token.
|
|
484
|
+
*
|
|
485
|
+
* `sitekey` is the widget's `data-sitekey`, `url` the page it is on
|
|
486
|
+
* (`options.pageurl` is accepted in its place). The result carries the token
|
|
487
|
+
* as `code` and `token` (for `h-captcha-response` and
|
|
488
|
+
* `g-recaptcha-response`), `respKey` (always present, `''` when none) and
|
|
489
|
+
* `userAgent`, the User-Agent the token was earned with. Tokens are single
|
|
490
|
+
* use and expire about two minutes after they are issued.
|
|
491
|
+
*/
|
|
492
|
+
hcaptcha(
|
|
493
|
+
sitekey: string,
|
|
494
|
+
url: string | undefined,
|
|
495
|
+
options?: HCaptchaOptions,
|
|
496
|
+
): Promise<SolveResult>;
|
|
379
497
|
/** Submit then poll to completion. Used by the higher-level solve methods. */
|
|
380
498
|
solve(options?: SolveOptions): Promise<SolveResult>;
|
|
381
499
|
/** Submit a captcha without polling; resolves to the captcha id. */
|