node-libcurl-ja3
Version:
Node.js native bindings for libcurl-impersonate. Impersonate Chrome, Edge, Firefox and Safari TLS fingerprints.
46 lines • 2.76 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SAFARI_BROWSER_CONFIGS = exports.getSafariConfig = exports.DEFAULT_SAFARI_VERSION = exports.DEFAULT_SAFARI_FINGERPRINT = exports.SafariBrowser = void 0;
const CurlSslVersion_1 = require("../../enum/CurlSslVersion");
const fingerprint_1 = require("../fingerprint");
const util_1 = require("../util");
var SafariBrowser;
(function (SafariBrowser) {
SafariBrowser["Safari18_0"] = "safari18_0";
SafariBrowser["Safari18_3"] = "safari18_3";
SafariBrowser["Safari"] = "safari18_3";
})(SafariBrowser || (exports.SafariBrowser = SafariBrowser = {}));
exports.DEFAULT_SAFARI_FINGERPRINT = {
ja3: '771,4865-4866-4867-49196-49195-52393-49200-49199-52392-49162-49161-49172-49171-157-156-53-47-49160-49170-10,0-23-65281-10-11-16-5-13-18-51-45-43-27-21,29-23-24-25,0',
ja4: 't13d2014h2_1301,1302,1303,c02c,c02b,cca9,c030,c02f,cca8,c00a,c009,c014,c013,009d,009c,0035,002f,c008,c012,000a_0000,0017,ff01,000a,000b,0010,0005,000d,0012,0033,002d,002b,001b,0015_0403,0804,0401,0503,0805,0805,0501,0806,0601,0201',
akami: '2:0;3:100;4:2097152;8:1;9:1|10420225|0|m,s,a,p',
};
exports.DEFAULT_SAFARI_VERSION = '18.3';
function getSafariConfig(config) {
var _a, _b, _c;
const version = (_a = config === null || config === void 0 ? void 0 : config.version) !== null && _a !== void 0 ? _a : exports.DEFAULT_SAFARI_VERSION;
return (0, util_1.deepMerge)({
compressed: true,
headers: (0, util_1.parseHeaders)([
'sec-fetch-dest: document',
`user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/${version} Safari/605.1.15`,
'accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'sec-fetch-site: none',
'sec-fetch-mode: navigate',
'accept-language: en-US,en;q=0.9',
'priority: u=0, i',
'accept-encoding: gzip, deflate, br',
]),
http2StreamExclusive: 1,
http2StreamWeight: 256,
sslCertCompression: 'zlib',
tlsGrease: true,
tlsVersion: CurlSslVersion_1.CurlSslVersion.TlsV1_0,
}, (0, fingerprint_1.parseFingerprint)((0, util_1.deepMerge)(exports.DEFAULT_SAFARI_FINGERPRINT, (_b = config === null || config === void 0 ? void 0 : config.fingerprint) !== null && _b !== void 0 ? _b : {})), (_c = config === null || config === void 0 ? void 0 : config.override) !== null && _c !== void 0 ? _c : {});
}
exports.getSafariConfig = getSafariConfig;
exports.SAFARI_BROWSER_CONFIGS = {
[SafariBrowser.Safari18_0]: getSafariConfig({ version: '18.0' }),
[SafariBrowser.Safari18_3]: getSafariConfig(),
};
//# sourceMappingURL=safari.js.map