curl-wrap 1.0.3 → 2.0.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/README.md +3 -1
- package/index.d.ts +133 -0
- package/index.js +164 -50
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -88,13 +88,15 @@ curl.apiToken('your-api-token');
|
|
|
88
88
|
|
|
89
89
|
### Impersonating a Browser
|
|
90
90
|
|
|
91
|
-
**NOTE**: it will use `curl-impersonate
|
|
91
|
+
> **NOTE**: it will use `curl-impersonate` if it is in `PATH`.
|
|
92
|
+
> **See**: `https://github.com/lexiforest/curl-impersonate`
|
|
92
93
|
|
|
93
94
|
```js
|
|
94
95
|
curl.impersonate('chrome');
|
|
95
96
|
curl.impersonate('chromeMobile');
|
|
96
97
|
curl.impersonate('firefox');
|
|
97
98
|
curl.impersonate('safari');
|
|
99
|
+
curl.impersonate('safariMobile');
|
|
98
100
|
curl.impersonate('edge');
|
|
99
101
|
```
|
|
100
102
|
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { CookieJar } from "tough-cookie";
|
|
2
|
+
|
|
3
|
+
interface CurlOptions {
|
|
4
|
+
method?: string; // HTTP method (e.g., GET, POST)
|
|
5
|
+
headers?: Record<string, string>; // Request headers
|
|
6
|
+
body?: string | object | null; // Request body
|
|
7
|
+
timeout?: number; // Timeout in milliseconds
|
|
8
|
+
[key: string]: any; // Allow additional options
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface CurlResponse {
|
|
12
|
+
url: string;
|
|
13
|
+
body: string; // Response body as a string
|
|
14
|
+
headers: Record<string, string>; // Response headers
|
|
15
|
+
statusCode: number; // HTTP status code
|
|
16
|
+
status: number; // alias for .statusCode
|
|
17
|
+
ip: string;
|
|
18
|
+
errorMsg: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function curl(
|
|
22
|
+
url: string,
|
|
23
|
+
options?: CurlOptions
|
|
24
|
+
): Promise<CurlResponse>;
|
|
25
|
+
|
|
26
|
+
type BrowserType =
|
|
27
|
+
| "chrome"
|
|
28
|
+
| "edge"
|
|
29
|
+
| "chromeMobile"
|
|
30
|
+
| "firefox"
|
|
31
|
+
| "safari"
|
|
32
|
+
| "safariMobile";
|
|
33
|
+
|
|
34
|
+
export class Curl {
|
|
35
|
+
constructor();
|
|
36
|
+
|
|
37
|
+
url(url: string): Curl;
|
|
38
|
+
static url(url: string): Curl;
|
|
39
|
+
|
|
40
|
+
get(url: string): Curl;
|
|
41
|
+
static get(url: string): Curl;
|
|
42
|
+
|
|
43
|
+
post(url: string): Curl;
|
|
44
|
+
static post(url: string): Curl;
|
|
45
|
+
|
|
46
|
+
put(url: string): Curl;
|
|
47
|
+
static put(url: string): Curl;
|
|
48
|
+
|
|
49
|
+
static getNewCookieJar(...args: any[]): CookieJar;
|
|
50
|
+
static getGlobalCookieJar(): CookieJar;
|
|
51
|
+
|
|
52
|
+
static hasCurlImpersonate(): boolean;
|
|
53
|
+
|
|
54
|
+
cliCommand(command: string): Curl;
|
|
55
|
+
cliOptions(options: string | string[]): Curl;
|
|
56
|
+
|
|
57
|
+
impersonate(browser?: BrowserType): Curl;
|
|
58
|
+
|
|
59
|
+
followRedirect(shouldFollowRedirect?: boolean): Curl;
|
|
60
|
+
maxRedirects(numRedirects: number): Curl;
|
|
61
|
+
|
|
62
|
+
header(headerName: string | object, headerValue?: string): Curl;
|
|
63
|
+
headers(headers: object): Curl;
|
|
64
|
+
|
|
65
|
+
json(body?: object): Curl;
|
|
66
|
+
body(body: any, contentType?: string): Curl;
|
|
67
|
+
|
|
68
|
+
referer(referer: string): Curl;
|
|
69
|
+
referrer(referrer: string): Curl;
|
|
70
|
+
|
|
71
|
+
userAgent(userAgent: string): Curl;
|
|
72
|
+
contentType(contentType: string): Curl;
|
|
73
|
+
|
|
74
|
+
isJSON(): boolean;
|
|
75
|
+
isForm(): boolean;
|
|
76
|
+
|
|
77
|
+
cookie(
|
|
78
|
+
cookieName: string | boolean | object,
|
|
79
|
+
cookieValue?: string
|
|
80
|
+
): Curl;
|
|
81
|
+
cookies(cookies: object | boolean): Curl;
|
|
82
|
+
|
|
83
|
+
globalCookies(options?: boolean | object): Curl;
|
|
84
|
+
cookieJar(cookieJar: CookieJar, options?: { readOnly?: boolean }): Curl;
|
|
85
|
+
cookieFile(fileName: string, options?: object): Curl;
|
|
86
|
+
|
|
87
|
+
timeout(timeout: number): Curl;
|
|
88
|
+
timeoutMs(timeoutInMs: number): Curl;
|
|
89
|
+
|
|
90
|
+
field(fieldName: string | object, fieldValue?: string): Curl;
|
|
91
|
+
fields(fields: object): Curl;
|
|
92
|
+
|
|
93
|
+
query(name: string | object, value?: string): Curl;
|
|
94
|
+
compress(askForCompression?: boolean): Curl;
|
|
95
|
+
|
|
96
|
+
method(method: string): Curl;
|
|
97
|
+
|
|
98
|
+
httpAuth(
|
|
99
|
+
username: string | { username: string; password: string },
|
|
100
|
+
password?: string
|
|
101
|
+
): Curl;
|
|
102
|
+
bearerToken(token: string): Curl;
|
|
103
|
+
apiToken(token: string): Curl;
|
|
104
|
+
|
|
105
|
+
useProxy(shouldUseProxy?: boolean): Curl;
|
|
106
|
+
proxy(proxy: string | object, options?: object): Curl;
|
|
107
|
+
|
|
108
|
+
keepalive(isKeepAlive?: boolean): Curl;
|
|
109
|
+
|
|
110
|
+
get(): Curl;
|
|
111
|
+
post(): Curl;
|
|
112
|
+
put(): Curl;
|
|
113
|
+
|
|
114
|
+
verbose(isVerbose?: boolean): Curl;
|
|
115
|
+
|
|
116
|
+
fetch(): Promise<CurlResponse>;
|
|
117
|
+
|
|
118
|
+
then(
|
|
119
|
+
successCallback: (response: any) => CurlResponse,
|
|
120
|
+
errorCallback?: (error: Error) => CurlResponse
|
|
121
|
+
): Promise<CurlResponse>;
|
|
122
|
+
|
|
123
|
+
catch(
|
|
124
|
+
errorCallback: (error: Error) => CurlResponse
|
|
125
|
+
): Promise<CurlResponse>;
|
|
126
|
+
|
|
127
|
+
finally(callback: () => CurlResponse): Promise<CurlResponse>;
|
|
128
|
+
|
|
129
|
+
// Additional properties for options or cookie jars
|
|
130
|
+
private options: any;
|
|
131
|
+
private _fields: Record<string, any>;
|
|
132
|
+
private _query: Record<string, any>;
|
|
133
|
+
}
|
package/index.js
CHANGED
|
@@ -115,7 +115,7 @@ class Curl {
|
|
|
115
115
|
// 'sec-fetch-mode': 'navigate',
|
|
116
116
|
// 'sec-fetch-site': 'same-origin',
|
|
117
117
|
// 'upgrade-insecure-requests': 1,
|
|
118
|
-
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/
|
|
118
|
+
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36',
|
|
119
119
|
},
|
|
120
120
|
// whether to follow redirects
|
|
121
121
|
followRedirect: true,
|
|
@@ -252,25 +252,13 @@ class Curl {
|
|
|
252
252
|
/**
|
|
253
253
|
* @static
|
|
254
254
|
* whether curl-impersonate-chrome is available or not
|
|
255
|
-
* @see https://github.com/
|
|
255
|
+
* @see https://github.com/lexiforest/curl-impersonate
|
|
256
256
|
*/
|
|
257
|
-
static
|
|
258
|
-
if (this.
|
|
259
|
-
this.
|
|
257
|
+
static hasCurlImpersonate() {
|
|
258
|
+
if (this._hasCurlImpersonate === undefined) {
|
|
259
|
+
this._hasCurlImpersonate = spawnSync('curl-impersonate', ['--version']).status === 0;
|
|
260
260
|
}
|
|
261
|
-
return this.
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* @static
|
|
266
|
-
* whether curl-impersonate-ff is available or not
|
|
267
|
-
* @see https://github.com/lwthiker/curl-impersonate
|
|
268
|
-
*/
|
|
269
|
-
static hasCurlImpersonateFirefox() {
|
|
270
|
-
if (this._hasCurlImpersonateFirefox === undefined) {
|
|
271
|
-
this._hasCurlImpersonateFirefox = spawnSync('curl-impersonate-ff', ['--version']).status === 0;
|
|
272
|
-
}
|
|
273
|
-
return this._hasCurlImpersonateFirefox;
|
|
261
|
+
return this._hasCurlImpersonate;
|
|
274
262
|
}
|
|
275
263
|
|
|
276
264
|
/**
|
|
@@ -304,82 +292,124 @@ class Curl {
|
|
|
304
292
|
/**
|
|
305
293
|
* impersonate a browser
|
|
306
294
|
*
|
|
307
|
-
* @param {string} browser browser to impersonate (chrome / chromeMobile / edge / safari / firefox)
|
|
295
|
+
* @param {string} browser browser to impersonate (chrome / chromeMobile / edge / safari / safariMobile / firefox)
|
|
308
296
|
* @return {Curl} self
|
|
309
297
|
*/
|
|
310
298
|
impersonate(browser = 'chrome') {
|
|
311
299
|
if (browser === 'chrome') {
|
|
312
|
-
if (this.constructor.
|
|
313
|
-
this.cliCommand('curl-impersonate
|
|
300
|
+
if (this.constructor.hasCurlImpersonate()) {
|
|
301
|
+
this.cliCommand('curl-impersonate');
|
|
314
302
|
this.cliOptions([
|
|
315
303
|
'--ciphers',
|
|
316
304
|
'TLS_AES_128_GCM_SHA256,TLS_AES_256_GCM_SHA384,TLS_CHACHA20_POLY1305_SHA256,ECDHE-ECDSA-AES128-GCM-SHA256,ECDHE-RSA-AES128-GCM-SHA256,ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384,ECDHE-ECDSA-CHACHA20-POLY1305,ECDHE-RSA-CHACHA20-POLY1305,ECDHE-RSA-AES128-SHA,ECDHE-RSA-AES256-SHA,AES128-GCM-SHA256,AES256-GCM-SHA384,AES128-SHA,AES256-SHA',
|
|
305
|
+
'--curves',
|
|
306
|
+
'X25519MLKEM768:X25519:P-256:P-384',
|
|
317
307
|
'--http2',
|
|
318
|
-
'--http2-
|
|
308
|
+
'--http2-settings',
|
|
309
|
+
'1:65536;2:0;4:6291456;6:262144',
|
|
310
|
+
'--http2-window-update',
|
|
311
|
+
'15663105',
|
|
312
|
+
'--http2-stream-weight',
|
|
313
|
+
'256',
|
|
314
|
+
'--http2-stream-exclusive',
|
|
315
|
+
'1',
|
|
319
316
|
'--compressed',
|
|
317
|
+
'--ech',
|
|
318
|
+
'grease',
|
|
320
319
|
'--tlsv1.2',
|
|
321
320
|
'--alps',
|
|
322
321
|
'--tls-permute-extensions',
|
|
323
322
|
'--cert-compression',
|
|
324
323
|
'brotli',
|
|
324
|
+
'--tls-grease',
|
|
325
|
+
'--tls-use-new-alps-codepoint',
|
|
326
|
+
'--tls-signed-cert-timestamps',
|
|
325
327
|
]);
|
|
326
328
|
}
|
|
327
329
|
this.headers({
|
|
328
|
-
'sec-ch-ua': '"
|
|
330
|
+
'sec-ch-ua': '"Google Chrome";v="137", "Chromium";v="137", "Not/A)Brand";v="24"',
|
|
329
331
|
'sec-ch-ua-mobile': '?0',
|
|
330
|
-
'sec-ch-ua-platform': '"
|
|
332
|
+
'sec-ch-ua-platform': '"macOS"',
|
|
331
333
|
'Upgrade-Insecure-Requests': '1',
|
|
332
|
-
'User-Agent': 'Mozilla/5.0 (
|
|
334
|
+
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36',
|
|
333
335
|
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
|
|
334
336
|
'Sec-Fetch-Site': 'none',
|
|
335
337
|
'Sec-Fetch-Mode': 'navigate',
|
|
336
338
|
'Sec-Fetch-User': '?1',
|
|
337
339
|
'Sec-Fetch-Dest': 'document',
|
|
338
|
-
'Accept-Encoding': 'gzip, deflate, br',
|
|
340
|
+
'Accept-Encoding': 'gzip, deflate, br, zstd',
|
|
339
341
|
'Accept-Language': 'en-US,en;q=0.9',
|
|
342
|
+
'Priority': 'u=0, i',
|
|
340
343
|
});
|
|
341
344
|
}
|
|
342
345
|
else if (browser === 'chromeMobile') {
|
|
343
|
-
if (this.constructor.
|
|
344
|
-
this.cliCommand('curl-impersonate
|
|
346
|
+
if (this.constructor.hasCurlImpersonate()) {
|
|
347
|
+
this.cliCommand('curl-impersonate');
|
|
345
348
|
this.cliOptions([
|
|
346
349
|
'--ciphers',
|
|
347
350
|
'TLS_AES_128_GCM_SHA256,TLS_AES_256_GCM_SHA384,TLS_CHACHA20_POLY1305_SHA256,ECDHE-ECDSA-AES128-GCM-SHA256,ECDHE-RSA-AES128-GCM-SHA256,ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384,ECDHE-ECDSA-CHACHA20-POLY1305,ECDHE-RSA-CHACHA20-POLY1305,ECDHE-RSA-AES128-SHA,ECDHE-RSA-AES256-SHA,AES128-GCM-SHA256,AES256-GCM-SHA384,AES128-SHA,AES256-SHA',
|
|
351
|
+
'--curves',
|
|
352
|
+
'X25519:P-256:P-384',
|
|
348
353
|
'--http2',
|
|
354
|
+
'--http2-settings',
|
|
355
|
+
'1:65536;2:0;4:6291456;6:262144',
|
|
356
|
+
'--http2-window-update',
|
|
357
|
+
'15663105',
|
|
358
|
+
'--http2-stream-weight',
|
|
359
|
+
'256',
|
|
360
|
+
'--http2-stream-exclusive',
|
|
361
|
+
'1',
|
|
349
362
|
'--compressed',
|
|
363
|
+
'--ech',
|
|
364
|
+
'grease',
|
|
350
365
|
'--tlsv1.2',
|
|
351
366
|
'--alps',
|
|
367
|
+
'--tls-permute-extensions',
|
|
352
368
|
'--cert-compression',
|
|
353
369
|
'brotli',
|
|
370
|
+
'--tls-grease',
|
|
371
|
+
'--tls-use-new-alps-codepoint',
|
|
372
|
+
'--tls-signed-cert-timestamps',
|
|
354
373
|
]);
|
|
355
374
|
}
|
|
356
375
|
this.headers({
|
|
357
|
-
'sec-ch-ua': '
|
|
358
|
-
'sec-ch-ua-mobile': '?
|
|
376
|
+
'sec-ch-ua': 'Google Chrome";v="137", "Chromium";v="137", "Not_A Brand";v="24"',
|
|
377
|
+
'sec-ch-ua-mobile': '?0',
|
|
359
378
|
'sec-ch-ua-platform': '"Android"',
|
|
360
379
|
'Upgrade-Insecure-Requests': '1',
|
|
361
|
-
'User-Agent': 'Mozilla/5.0 (Linux; Android 12; Pixel 6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/
|
|
362
|
-
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.
|
|
380
|
+
'User-Agent': 'Mozilla/5.0 (Linux; Android 12; Pixel 6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Mobile Safari/537.36',
|
|
381
|
+
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
|
|
363
382
|
'Sec-Fetch-Site': 'none',
|
|
364
383
|
'Sec-Fetch-Mode': 'navigate',
|
|
365
384
|
'Sec-Fetch-User': '?1',
|
|
366
385
|
'Sec-Fetch-Dest': 'document',
|
|
367
|
-
'Accept-Encoding': 'gzip, deflate, br',
|
|
386
|
+
'Accept-Encoding': 'gzip, deflate, br, zstd',
|
|
368
387
|
'Accept-Language': 'en-US,en;q=0.9',
|
|
388
|
+
'Priority': 'u=0, i',
|
|
369
389
|
});
|
|
370
390
|
}
|
|
371
391
|
else if (browser === 'edge') {
|
|
372
|
-
if (this.constructor.
|
|
373
|
-
this.cliCommand('curl-impersonate
|
|
392
|
+
if (this.constructor.hasCurlImpersonate()) {
|
|
393
|
+
this.cliCommand('curl-impersonate');
|
|
374
394
|
this.cliOptions([
|
|
375
395
|
'--ciphers',
|
|
376
396
|
'TLS_AES_128_GCM_SHA256,TLS_AES_256_GCM_SHA384,TLS_CHACHA20_POLY1305_SHA256,ECDHE-ECDSA-AES128-GCM-SHA256,ECDHE-RSA-AES128-GCM-SHA256,ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384,ECDHE-ECDSA-CHACHA20-POLY1305,ECDHE-RSA-CHACHA20-POLY1305,ECDHE-RSA-AES128-SHA,ECDHE-RSA-AES256-SHA,AES128-GCM-SHA256,AES256-GCM-SHA384,AES128-SHA,AES256-SHA',
|
|
377
397
|
'--http2',
|
|
398
|
+
'--http2-settings',
|
|
399
|
+
'1:65536;3:1000;4:6291456;6:262144',
|
|
400
|
+
'--http2-window-update',
|
|
401
|
+
'15663105',
|
|
402
|
+
'--http2-stream-weight',
|
|
403
|
+
'256',
|
|
404
|
+
'--http2-stream-exclusive',
|
|
405
|
+
'1',
|
|
378
406
|
'--compressed',
|
|
379
407
|
'--tlsv1.2',
|
|
380
408
|
'--alps',
|
|
381
409
|
'--cert-compression',
|
|
382
410
|
'brotli',
|
|
411
|
+
'--tls-grease',
|
|
412
|
+
'--tls-signed-cert-timestamps',
|
|
383
413
|
]);
|
|
384
414
|
}
|
|
385
415
|
this.headers({
|
|
@@ -398,53 +428,137 @@ class Curl {
|
|
|
398
428
|
});
|
|
399
429
|
}
|
|
400
430
|
else if (browser === 'safari') {
|
|
401
|
-
if (this.constructor.
|
|
402
|
-
this.cliCommand('curl-impersonate
|
|
431
|
+
if (this.constructor.hasCurlImpersonate()) {
|
|
432
|
+
this.cliCommand('curl-impersonate');
|
|
403
433
|
this.cliOptions([
|
|
404
434
|
'--ciphers',
|
|
405
435
|
'TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256:TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384:TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256:TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256:TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA:TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA:TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA:TLS_RSA_WITH_AES_256_GCM_SHA384:TLS_RSA_WITH_AES_128_GCM_SHA256:TLS_RSA_WITH_AES_256_CBC_SHA:TLS_RSA_WITH_AES_128_CBC_SHA:TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA:TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA:TLS_RSA_WITH_3DES_EDE_CBC_SHA',
|
|
406
436
|
'--curves',
|
|
407
437
|
'X25519:P-256:P-384:P-521',
|
|
408
438
|
'--signature-hashes',
|
|
409
|
-
'ecdsa_secp256r1_sha256,rsa_pss_rsae_sha256,rsa_pkcs1_sha256,ecdsa_secp384r1_sha384,
|
|
439
|
+
'ecdsa_secp256r1_sha256,rsa_pss_rsae_sha256,rsa_pkcs1_sha256,ecdsa_secp384r1_sha384,rsa_pss_rsae_sha384,rsa_pss_rsae_sha384,rsa_pkcs1_sha384,rsa_pss_rsae_sha512,rsa_pkcs1_sha512,rsa_pkcs1_sha1',
|
|
410
440
|
'--http2',
|
|
441
|
+
'--http2-settings',
|
|
442
|
+
'2:0;3:100;4:2097152;9:1',
|
|
443
|
+
'--http2-pseudo-headers-order',
|
|
444
|
+
'msap',
|
|
445
|
+
'--http2-window-update',
|
|
446
|
+
'10420225',
|
|
447
|
+
'--http2-stream-weight',
|
|
448
|
+
'256',
|
|
449
|
+
'--http2-stream-exclusive',
|
|
450
|
+
'0',
|
|
411
451
|
'--compressed',
|
|
412
452
|
'--tlsv1.0',
|
|
413
453
|
'--no-tls-session-ticket',
|
|
414
454
|
'--cert-compression',
|
|
415
455
|
'zlib',
|
|
456
|
+
'--tls-grease',
|
|
457
|
+
'--tls-signed-cert-timestamps',
|
|
458
|
+
]);
|
|
459
|
+
}
|
|
460
|
+
this.headers({
|
|
461
|
+
'sec-fetch-dest': 'document',
|
|
462
|
+
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.4 Safari/605.1.15',
|
|
463
|
+
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
|
464
|
+
'sec-fetch-site': 'none',
|
|
465
|
+
'sec-fetch-mode': 'navigate',
|
|
466
|
+
'accept-language': 'en-US,en;q=0.9',
|
|
467
|
+
'priority': 'u=0, i',
|
|
468
|
+
'accept-encoding': 'gzip, deflate, br',
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
else if (browser === 'safariMobile') {
|
|
472
|
+
if (this.constructor.hasCurlImpersonate()) {
|
|
473
|
+
this.cliCommand('curl-impersonate');
|
|
474
|
+
this.cliOptions([
|
|
475
|
+
'--ciphers',
|
|
476
|
+
'TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256:TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384:TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256:TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256:TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA:TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA:TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA:TLS_RSA_WITH_AES_256_GCM_SHA384:TLS_RSA_WITH_AES_128_GCM_SHA256:TLS_RSA_WITH_AES_256_CBC_SHA:TLS_RSA_WITH_AES_128_CBC_SHA:TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA:TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA:TLS_RSA_WITH_3DES_EDE_CBC_SHA',
|
|
477
|
+
'--curves',
|
|
478
|
+
'X25519:P-256:P-384:P-521',
|
|
479
|
+
'--signature-hashes',
|
|
480
|
+
'ecdsa_secp256r1_sha256,rsa_pss_rsae_sha256,rsa_pkcs1_sha256,ecdsa_secp384r1_sha384,rsa_pss_rsae_sha384,rsa_pss_rsae_sha384,rsa_pkcs1_sha384,rsa_pss_rsae_sha512,rsa_pkcs1_sha512,rsa_pkcs1_sha1',
|
|
481
|
+
'--http2',
|
|
482
|
+
'--http2-settings',
|
|
483
|
+
'2:0;3:100;4:2097152;9:1',
|
|
416
484
|
'--http2-pseudo-headers-order',
|
|
417
|
-
'
|
|
485
|
+
'msap',
|
|
486
|
+
'--http2-window-update',
|
|
487
|
+
'10420225',
|
|
488
|
+
'--http2-stream-weight',
|
|
489
|
+
'256',
|
|
490
|
+
'--http2-stream-exclusive',
|
|
491
|
+
'0',
|
|
492
|
+
'--compressed',
|
|
493
|
+
'--tlsv1.0',
|
|
494
|
+
'--no-tls-session-ticket',
|
|
495
|
+
'--cert-compression',
|
|
496
|
+
'zlib',
|
|
497
|
+
'--tls-grease',
|
|
498
|
+
'--tls-signed-cert-timestamps',
|
|
418
499
|
]);
|
|
419
500
|
}
|
|
420
501
|
this.headers({
|
|
421
|
-
'
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
'
|
|
502
|
+
'sec-fetch-dest': 'document',
|
|
503
|
+
'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.4 Mobile/15E148 Safari/604.1',
|
|
504
|
+
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
|
505
|
+
'sec-fetch-site': 'none',
|
|
506
|
+
'sec-fetch-mode': 'navigate',
|
|
507
|
+
'accept-language': 'en-US,en;q=0.9',
|
|
508
|
+
'priority': 'u=0, i',
|
|
509
|
+
'accept-encoding': 'gzip, deflate, br',
|
|
425
510
|
});
|
|
426
511
|
}
|
|
427
512
|
else if (browser === 'firefox') {
|
|
428
|
-
if (this.constructor.
|
|
429
|
-
this.cliCommand('curl-impersonate
|
|
513
|
+
if (this.constructor.hasCurlImpersonate()) {
|
|
514
|
+
this.cliCommand('curl-impersonate');
|
|
430
515
|
this.cliOptions([
|
|
431
516
|
'--ciphers',
|
|
432
|
-
'
|
|
517
|
+
'TLS_AES_128_GCM_SHA256,TLS_CHACHA20_POLY1305_SHA256,TLS_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_AES_128_GCM_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA',
|
|
518
|
+
'--curves',
|
|
519
|
+
'X25519MLKEM768:X25519:P-256:P-384:P-521:ffdhe2048:ffdhe3072',
|
|
520
|
+
'--signature-hashes',
|
|
521
|
+
'ecdsa_secp256r1_sha256,ecdsa_secp384r1_sha384,ecdsa_secp521r1_sha512,rsa_pss_rsae_sha256,rsa_pss_rsae_sha384,rsa_pss_rsae_sha512,rsa_pkcs1_sha256,rsa_pkcs1_sha384,rsa_pkcs1_sha512,ecdsa_sha1,rsa_pkcs1_sha1',
|
|
433
522
|
'--http2',
|
|
523
|
+
'--http2-settings',
|
|
524
|
+
'1:65536;2:0;4:131072;5:16384',
|
|
525
|
+
'--http2-pseudo-headers-order',
|
|
526
|
+
'msap',
|
|
527
|
+
'--http2-window-update',
|
|
528
|
+
'12517377',
|
|
529
|
+
'--http2-stream-weight',
|
|
530
|
+
'42',
|
|
531
|
+
'--http2-stream-exclusive',
|
|
532
|
+
'0',
|
|
434
533
|
'--compressed',
|
|
534
|
+
'--ech',
|
|
535
|
+
'grease',
|
|
536
|
+
'--tls-extension-order',
|
|
537
|
+
'0-23-65281-10-11-35-16-5-34-18-51-43-13-45-28-27-65037',
|
|
538
|
+
'--tls-delegated-credentials',
|
|
539
|
+
'ecdsa_secp256r1_sha256:ecdsa_secp384r1_sha384:ecdsa_secp521r1_sha512:ecdsa_sha1',
|
|
540
|
+
'--tls-record-size-limit',
|
|
541
|
+
'4001',
|
|
542
|
+
'--tls-key-shares-limit',
|
|
543
|
+
'3',
|
|
544
|
+
'--cert-compression',
|
|
545
|
+
'zlib,brotli,zstd',
|
|
546
|
+
'--tls-signed-cert-timestamps',
|
|
547
|
+
'--tls-use-firefox-tls13-ciphers',
|
|
435
548
|
]);
|
|
436
549
|
}
|
|
437
550
|
this.headers({
|
|
438
|
-
'User-Agent': 'Mozilla/5.0 (
|
|
439
|
-
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9
|
|
551
|
+
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:135.0) Gecko/20100101 Firefox/135.0',
|
|
552
|
+
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
|
440
553
|
'Accept-Language': 'en-US,en;q=0.5',
|
|
441
|
-
'Accept-Encoding': 'gzip, deflate, br',
|
|
554
|
+
'Accept-Encoding': 'gzip, deflate, br, zstd',
|
|
442
555
|
'Upgrade-Insecure-Requests': '1',
|
|
443
556
|
'Sec-Fetch-Dest': 'document',
|
|
444
557
|
'Sec-Fetch-Mode': 'navigate',
|
|
445
558
|
'Sec-Fetch-Site': 'none',
|
|
446
559
|
'Sec-Fetch-User': '?1',
|
|
447
|
-
|
|
560
|
+
'Priority': 'u=0, i',
|
|
561
|
+
'TE': 'trailers',
|
|
448
562
|
});
|
|
449
563
|
}
|
|
450
564
|
return this;
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "curl-wrap",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Nodejs library that wraps curl command line",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
8
9
|
"url": "git+https://github.com/hkk12369/curl-wrap.git"
|