@iflyrpa/actions 4.1.0 → 4.1.1-beta.1
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/dist/actions/toutiaoPublish/index.d.ts +1 -1
- package/dist/bundle.js +1564 -1605
- package/dist/bundle.js.map +1 -1
- package/dist/index.js +3410 -3451
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3411 -3452
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! For license information please see bundle.js.LICENSE.txt */
|
|
2
2
|
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="fdd0923e-73a8-549c-a3d0-16e8b052096c")}catch(e){}}();
|
|
4
4
|
var __webpack_modules__ = {
|
|
5
5
|
"../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js": function(__unused_webpack_module, exports1, __webpack_require__) {
|
|
6
6
|
"use strict";
|
|
@@ -12493,9 +12493,7 @@ var __webpack_exports__ = {};
|
|
|
12493
12493
|
var package_namespaceObject = {
|
|
12494
12494
|
i8: "0.2.0"
|
|
12495
12495
|
};
|
|
12496
|
-
var package_namespaceObject_0 = {
|
|
12497
|
-
i8: "4.1.0"
|
|
12498
|
-
};
|
|
12496
|
+
var package_namespaceObject_0 = JSON.parse('{"i8":"4.1.1-beta.1"}');
|
|
12499
12497
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
12500
12498
|
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
12501
12499
|
const external_node_http_namespaceObject = require("node:http");
|
|
@@ -27524,6 +27522,14 @@ var __webpack_exports__ = {};
|
|
|
27524
27522
|
this.logger?.debug(`[告警跳过] 本机地址不上报: ${fullUrl}`);
|
|
27525
27523
|
return;
|
|
27526
27524
|
}
|
|
27525
|
+
if (attempts < 3) {
|
|
27526
|
+
const isAuthExpired = 401 === status;
|
|
27527
|
+
const isTimeoutCanceled = "ERR_CANCELED" === axiosCode;
|
|
27528
|
+
if (isAuthExpired || isTimeoutCanceled) {
|
|
27529
|
+
this.logger?.debug(`[告警跳过] 低重试次数(${attempts})的常见错误不上报: status=${status}, code=${error.code}, axiosCode=${axiosCode}, url=${fullUrl}`);
|
|
27530
|
+
return;
|
|
27531
|
+
}
|
|
27532
|
+
}
|
|
27527
27533
|
const rawMsg = "string" == typeof error.message && error.message.trim() ? error.message : "";
|
|
27528
27534
|
const baseMsg = rawMsg || `请求失败(无错误文案,code=${error.code ?? "unknown"})`;
|
|
27529
27535
|
const retriedSuffix = attempts > 0 ? `(已重试${attempts}次仍失败)` : "";
|
|
@@ -33746,1066 +33752,493 @@ var __webpack_exports__ = {};
|
|
|
33746
33752
|
if (0 === desc.errno) fans.description = desc.data.user.wishes;
|
|
33747
33753
|
return success(fans, "获取粉丝数成功!");
|
|
33748
33754
|
};
|
|
33749
|
-
|
|
33750
|
-
|
|
33751
|
-
|
|
33752
|
-
|
|
33753
|
-
|
|
33754
|
-
|
|
33755
|
-
|
|
33756
|
-
|
|
33757
|
-
|
|
33758
|
-
|
|
33759
|
-
|
|
33760
|
-
|
|
33761
|
-
|
|
33762
|
-
|
|
33763
|
-
|
|
33764
|
-
|
|
33765
|
-
static{
|
|
33766
|
-
this.X3_BASE64_ALPHABET = "MfgqrsbcyzPQRStuvC7mn501HIJBo2DEFTKdeNOwxWXYZap89+/A4UVLhijkl63G";
|
|
33767
|
-
}
|
|
33768
|
-
static{
|
|
33769
|
-
this.HEX_KEY = "71a302257793271ddd273bcee3e4b98d9d7935e1da33f5765e2ea8afb6dc77a51a499d23b67c20660025860cbf13d4540d92497f58686c574e508f46e1956344f39139bf4faf22a3eef120b79258145b2feb5193b6478669961298e79bedca646e1a693a926154a5a7a1bd1cf0dedb742f917a747a1e388b234f2277";
|
|
33770
|
-
}
|
|
33771
|
-
static{
|
|
33772
|
-
this.EXPECTED_HEX_LENGTH = 32;
|
|
33773
|
-
}
|
|
33774
|
-
static{
|
|
33775
|
-
this.OUTPUT_BYTE_COUNT = 8;
|
|
33776
|
-
}
|
|
33777
|
-
static{
|
|
33778
|
-
this.HEX_CHUNK_SIZE = 2;
|
|
33779
|
-
}
|
|
33780
|
-
static{
|
|
33781
|
-
this.VERSION_BYTES = [
|
|
33782
|
-
119,
|
|
33783
|
-
104,
|
|
33784
|
-
96,
|
|
33785
|
-
41
|
|
33786
|
-
];
|
|
33787
|
-
}
|
|
33788
|
-
static{
|
|
33789
|
-
this.SEQUENCE_VALUE_MIN = 15;
|
|
33790
|
-
}
|
|
33791
|
-
static{
|
|
33792
|
-
this.SEQUENCE_VALUE_MAX = 50;
|
|
33793
|
-
}
|
|
33794
|
-
static{
|
|
33795
|
-
this.WINDOW_PROPS_LENGTH_MIN = 900;
|
|
33796
|
-
}
|
|
33797
|
-
static{
|
|
33798
|
-
this.WINDOW_PROPS_LENGTH_MAX = 1200;
|
|
33799
|
-
}
|
|
33800
|
-
static{
|
|
33801
|
-
this.CHECKSUM_VERSION = 1;
|
|
33802
|
-
}
|
|
33803
|
-
static{
|
|
33804
|
-
this.CHECKSUM_XOR_KEY = 115;
|
|
33805
|
-
}
|
|
33806
|
-
static{
|
|
33807
|
-
this.CHECKSUM_FIXED_TAIL = [
|
|
33808
|
-
249,
|
|
33809
|
-
65,
|
|
33810
|
-
103,
|
|
33811
|
-
103,
|
|
33812
|
-
201,
|
|
33813
|
-
181,
|
|
33814
|
-
131,
|
|
33815
|
-
99,
|
|
33816
|
-
94,
|
|
33817
|
-
7,
|
|
33818
|
-
68,
|
|
33819
|
-
250,
|
|
33820
|
-
132,
|
|
33821
|
-
21
|
|
33822
|
-
];
|
|
33823
|
-
}
|
|
33824
|
-
static{
|
|
33825
|
-
this.ENV_FINGERPRINT_XOR_KEY = 41;
|
|
33826
|
-
}
|
|
33827
|
-
static{
|
|
33828
|
-
this.ENV_FINGERPRINT_TIME_OFFSET_MIN = 10;
|
|
33829
|
-
}
|
|
33830
|
-
static{
|
|
33831
|
-
this.ENV_FINGERPRINT_TIME_OFFSET_MAX = 50;
|
|
33832
|
-
}
|
|
33833
|
-
static{
|
|
33834
|
-
this.SIGNATURE_DATA_TEMPLATE = {
|
|
33835
|
-
x0: "4.2.6",
|
|
33836
|
-
x1: "xhs-pc-web",
|
|
33837
|
-
x2: "Windows",
|
|
33838
|
-
x3: "",
|
|
33839
|
-
x4: ""
|
|
33840
|
-
};
|
|
33841
|
-
}
|
|
33842
|
-
static{
|
|
33843
|
-
this.X3_PREFIX = "mns0301_";
|
|
33844
|
-
}
|
|
33845
|
-
static{
|
|
33846
|
-
this.XYS_PREFIX = "XYS_";
|
|
33847
|
-
}
|
|
33848
|
-
static{
|
|
33849
|
-
this.HEX_CHARS = "abcdef0123456789";
|
|
33850
|
-
}
|
|
33851
|
-
static{
|
|
33852
|
-
this.XRAY_TRACE_ID_SEQ_MAX = 8388607;
|
|
33853
|
-
}
|
|
33854
|
-
static{
|
|
33855
|
-
this.XRAY_TRACE_ID_TIMESTAMP_SHIFT = 23;
|
|
33856
|
-
}
|
|
33857
|
-
static{
|
|
33858
|
-
this.B3_TRACE_ID_LENGTH = 16;
|
|
33859
|
-
}
|
|
33860
|
-
static{
|
|
33861
|
-
this.PUBLIC_USERAGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0";
|
|
33862
|
-
}
|
|
33863
|
-
static{
|
|
33864
|
-
this.SIGNATURE_XSCOMMON_TEMPLATE = {
|
|
33865
|
-
s0: 5,
|
|
33866
|
-
s1: "",
|
|
33867
|
-
x0: "1",
|
|
33868
|
-
x1: "4.2.6",
|
|
33869
|
-
x2: "Windows",
|
|
33870
|
-
x3: "xhs-pc-web",
|
|
33871
|
-
x4: "4.86.0",
|
|
33872
|
-
x5: "",
|
|
33873
|
-
x6: "",
|
|
33874
|
-
x7: "",
|
|
33875
|
-
x8: "",
|
|
33876
|
-
x9: -596800761,
|
|
33877
|
-
x10: 0,
|
|
33878
|
-
x11: "normal"
|
|
33879
|
-
};
|
|
33880
|
-
}
|
|
33881
|
-
}
|
|
33882
|
-
class BitOperations {
|
|
33883
|
-
normalizeTo32bit(value) {
|
|
33884
|
-
return value & this.config.MAX_32BIT;
|
|
33885
|
-
}
|
|
33886
|
-
xorTransformArray(inputArray) {
|
|
33887
|
-
const keyBytes = this.hexStringToBytes(this.config.HEX_KEY);
|
|
33888
|
-
const result = new Uint8Array(inputArray.length);
|
|
33889
|
-
for(let i = 0; i < inputArray.length; i++)result[i] = inputArray[i] ^ keyBytes[i % keyBytes.length];
|
|
33890
|
-
return result;
|
|
33891
|
-
}
|
|
33892
|
-
hexStringToBytes(hexString) {
|
|
33893
|
-
const bytes = [];
|
|
33894
|
-
for(let i = 0; i < hexString.length; i += 2)bytes.push(parseInt(hexString.substr(i, 2), 16));
|
|
33895
|
-
return bytes;
|
|
33896
|
-
}
|
|
33897
|
-
constructor(){
|
|
33898
|
-
this.config = CryptoConfig;
|
|
33899
|
-
}
|
|
33900
|
-
}
|
|
33901
|
-
class RandomGenerator {
|
|
33902
|
-
generateRandomBytes(byteCount) {
|
|
33903
|
-
const result = [];
|
|
33904
|
-
for(let i = 0; i < byteCount; i++)result.push(Math.floor(Math.random() * (this.config.MAX_BYTE + 1)));
|
|
33905
|
-
return result;
|
|
33906
|
-
}
|
|
33907
|
-
generateRandomByteInRange(minVal, maxVal) {
|
|
33908
|
-
return Math.floor(Math.random() * (maxVal - minVal + 1)) + minVal;
|
|
33909
|
-
}
|
|
33910
|
-
generateRandomInt() {
|
|
33911
|
-
return Math.floor(Math.random() * (this.config.MAX_32BIT + 1));
|
|
33912
|
-
}
|
|
33913
|
-
generateB3TraceId() {
|
|
33914
|
-
let result = '';
|
|
33915
|
-
for(let i = 0; i < this.config.B3_TRACE_ID_LENGTH; i++)result += this.config.HEX_CHARS[Math.floor(Math.random() * this.config.HEX_CHARS.length)];
|
|
33916
|
-
return result;
|
|
33917
|
-
}
|
|
33918
|
-
generateXrayTraceId(timestamp, seq) {
|
|
33919
|
-
if (void 0 === timestamp) timestamp = Date.now();
|
|
33920
|
-
if (void 0 === seq) seq = Math.floor(Math.random() * (this.config.XRAY_TRACE_ID_SEQ_MAX + 1));
|
|
33921
|
-
const part1 = (timestamp << this.config.XRAY_TRACE_ID_TIMESTAMP_SHIFT | seq).toString(16).padStart(16, '0');
|
|
33922
|
-
let part2 = '';
|
|
33923
|
-
for(let i = 0; i < 16; i++)part2 += this.config.HEX_CHARS[Math.floor(Math.random() * this.config.HEX_CHARS.length)];
|
|
33924
|
-
return part1 + part2;
|
|
33925
|
-
}
|
|
33926
|
-
constructor(){
|
|
33927
|
-
this.config = CryptoConfig;
|
|
33928
|
-
}
|
|
33929
|
-
}
|
|
33930
|
-
class Base64Encoder {
|
|
33931
|
-
encode(dataToEncode) {
|
|
33932
|
-
const dataBytes = Buffer.from(dataToEncode, 'utf-8');
|
|
33933
|
-
const standardEncodedString = dataBytes.toString('base64');
|
|
33934
|
-
let result = '';
|
|
33935
|
-
for (const char of standardEncodedString){
|
|
33936
|
-
const index = this.config.STANDARD_BASE64_ALPHABET.indexOf(char);
|
|
33937
|
-
if (-1 !== index) result += this.config.CUSTOM_BASE64_ALPHABET[index];
|
|
33938
|
-
else result += char;
|
|
33755
|
+
let lastEnvLogTime = 0;
|
|
33756
|
+
const ENV_LOG_INTERVAL_MS = 5000;
|
|
33757
|
+
const SessionCheckResultSchema = classic_schemas_object({
|
|
33758
|
+
isValidSession: classic_schemas_boolean()
|
|
33759
|
+
});
|
|
33760
|
+
const WxBjhSessionParamsSchema = ActionCommonParamsSchema.extend({
|
|
33761
|
+
token: schemas_union([
|
|
33762
|
+
classic_schemas_string(),
|
|
33763
|
+
classic_schemas_number()
|
|
33764
|
+
])
|
|
33765
|
+
});
|
|
33766
|
+
const TTSessionCheck = async (_task, params)=>{
|
|
33767
|
+
const http = new Http({
|
|
33768
|
+
headers: {
|
|
33769
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
33770
|
+
referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
|
|
33939
33771
|
}
|
|
33940
|
-
|
|
33941
|
-
|
|
33942
|
-
|
|
33943
|
-
|
|
33944
|
-
|
|
33945
|
-
|
|
33946
|
-
|
|
33947
|
-
|
|
33772
|
+
});
|
|
33773
|
+
const res = await http.api({
|
|
33774
|
+
method: "get",
|
|
33775
|
+
url: "https://mp.toutiao.com/mp/agw/creator_center/user_info",
|
|
33776
|
+
defaultErrorMsg: "头条号登录状态失效。"
|
|
33777
|
+
});
|
|
33778
|
+
const isSuccess = 0 === res.code;
|
|
33779
|
+
const message = "头条账号有效性检测成功";
|
|
33780
|
+
const data = isSuccess ? {
|
|
33781
|
+
isValidSession: true
|
|
33782
|
+
} : {
|
|
33783
|
+
isValidSession: false
|
|
33784
|
+
};
|
|
33785
|
+
return success(data, message);
|
|
33786
|
+
};
|
|
33787
|
+
const WxSessionCheck = async (_task, params)=>{
|
|
33788
|
+
const http = new Http({
|
|
33789
|
+
headers: {
|
|
33790
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
33948
33791
|
}
|
|
33949
|
-
|
|
33950
|
-
|
|
33951
|
-
|
|
33952
|
-
|
|
33953
|
-
|
|
33954
|
-
|
|
33955
|
-
|
|
33956
|
-
|
|
33957
|
-
|
|
33792
|
+
});
|
|
33793
|
+
const fingerprint = "4695500bc93ab4ce8fb2692da6564e04";
|
|
33794
|
+
const res = await http.api({
|
|
33795
|
+
method: "get",
|
|
33796
|
+
url: "https://mp.weixin.qq.com/cgi-bin/appmsgpublish",
|
|
33797
|
+
params: {
|
|
33798
|
+
fingerprint,
|
|
33799
|
+
sub: "list",
|
|
33800
|
+
begin: 0,
|
|
33801
|
+
count: 10,
|
|
33802
|
+
query: "",
|
|
33803
|
+
type: 1011102103,
|
|
33804
|
+
show_type: "",
|
|
33805
|
+
free_publish_type: 1102103,
|
|
33806
|
+
sub_action: "list_ex",
|
|
33807
|
+
search_card: 0,
|
|
33808
|
+
token: params.token,
|
|
33809
|
+
lang: "zh_CN",
|
|
33810
|
+
f: "json",
|
|
33811
|
+
ajax: 1
|
|
33958
33812
|
}
|
|
33959
|
-
|
|
33813
|
+
});
|
|
33814
|
+
return success(0 === res.base_resp.ret ? {
|
|
33815
|
+
isValidSession: true
|
|
33816
|
+
} : {
|
|
33817
|
+
isValidSession: false
|
|
33818
|
+
}, "微信账号有效性检测完成!");
|
|
33819
|
+
};
|
|
33820
|
+
const XhsSessionCheck = async (_task, params)=>{
|
|
33821
|
+
const now = Date.now();
|
|
33822
|
+
const shouldLogEnv = now - lastEnvLogTime >= ENV_LOG_INTERVAL_MS;
|
|
33823
|
+
if (shouldLogEnv) {
|
|
33824
|
+
lastEnvLogTime = now;
|
|
33825
|
+
_task.logger?.debug("[XhsSessionCheck] 环境信息", {
|
|
33826
|
+
processType: process.type,
|
|
33827
|
+
pid: process.pid,
|
|
33828
|
+
nodeVersion: process.version,
|
|
33829
|
+
platform: process.platform,
|
|
33830
|
+
memoryUsage: {
|
|
33831
|
+
heapUsed: `${Math.round(process.memoryUsage().heapUsed / 1024 / 1024)} MB`,
|
|
33832
|
+
heapTotal: `${Math.round(process.memoryUsage().heapTotal / 1024 / 1024)} MB`
|
|
33833
|
+
},
|
|
33834
|
+
accountId: params.accountId,
|
|
33835
|
+
hasProxy: !!params.proxyLoc
|
|
33836
|
+
});
|
|
33960
33837
|
}
|
|
33961
|
-
|
|
33962
|
-
|
|
33963
|
-
|
|
33964
|
-
|
|
33965
|
-
|
|
33966
|
-
|
|
33838
|
+
const check = {
|
|
33839
|
+
isValidSession: false,
|
|
33840
|
+
isValidWebSession: false
|
|
33841
|
+
};
|
|
33842
|
+
const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
|
|
33843
|
+
if (!a1Cookie) return {
|
|
33844
|
+
code: 414,
|
|
33845
|
+
message: "账号数据异常,请重新绑定账号后重试。",
|
|
33846
|
+
data: check
|
|
33847
|
+
};
|
|
33848
|
+
const headers = {
|
|
33849
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
33850
|
+
referer: "https://creator.xiaohongshu.com/new/home?source=official"
|
|
33851
|
+
};
|
|
33852
|
+
const args = [
|
|
33853
|
+
{
|
|
33854
|
+
headers
|
|
33855
|
+
},
|
|
33856
|
+
_task.logger,
|
|
33857
|
+
params.proxyLoc,
|
|
33858
|
+
params.accountId,
|
|
33859
|
+
"xiaohongshu"
|
|
33860
|
+
];
|
|
33861
|
+
const http = new Http(...args);
|
|
33862
|
+
http.addResponseInterceptor((response)=>{
|
|
33863
|
+
if (response?.status === 401) return {
|
|
33864
|
+
code: response.data.code,
|
|
33865
|
+
message: response.data.msg,
|
|
33866
|
+
data: response.data.data
|
|
33867
|
+
};
|
|
33868
|
+
});
|
|
33869
|
+
const loginBasePath = "/api/galaxy/creator/home/personal_info";
|
|
33870
|
+
const baseInfoStart = Date.now();
|
|
33871
|
+
const baseInfo = await http.api({
|
|
33872
|
+
method: "get",
|
|
33873
|
+
baseURL: "https://creator.xiaohongshu.com",
|
|
33874
|
+
url: loginBasePath
|
|
33875
|
+
}, {
|
|
33876
|
+
retries: 3,
|
|
33877
|
+
retryDelay: 300,
|
|
33878
|
+
timeout: 30000
|
|
33879
|
+
}).catch((e)=>{
|
|
33880
|
+
const clientTimestamp = Date.now();
|
|
33881
|
+
const serverDate = e?.extra?.serverDate;
|
|
33882
|
+
const serverTimestamp = serverDate ? new Date(serverDate).getTime() : null;
|
|
33883
|
+
const timeDriftMs = serverTimestamp ? clientTimestamp - serverTimestamp : null;
|
|
33884
|
+
_task.logger?.warn("[XhsSessionCheck] creator personal_info 接口请求失败", {
|
|
33885
|
+
accountId: params.accountId,
|
|
33886
|
+
duration: Date.now() - baseInfoStart,
|
|
33887
|
+
code: e?.code,
|
|
33888
|
+
message: e?.message,
|
|
33889
|
+
data: e?.data,
|
|
33890
|
+
extra: e?.extra,
|
|
33891
|
+
proxyInfo: http.proxyInfo,
|
|
33892
|
+
clientTimestamp,
|
|
33893
|
+
serverDate,
|
|
33894
|
+
serverTimestamp,
|
|
33895
|
+
timeDriftMs,
|
|
33896
|
+
isLikelyClockDrift: null !== timeDriftMs && Math.abs(timeDriftMs) > 300000
|
|
33897
|
+
});
|
|
33898
|
+
return e.data;
|
|
33899
|
+
});
|
|
33900
|
+
const isValid = baseInfo?.code === 0;
|
|
33901
|
+
check.isValidSession = isValid;
|
|
33902
|
+
check.isValidWebSession = isValid;
|
|
33903
|
+
const message = `小红书账号有效性检测成功${_task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
33904
|
+
return success(check, message);
|
|
33905
|
+
};
|
|
33906
|
+
const BjhSessionCheck = async (_task, params)=>{
|
|
33907
|
+
const http = new Http({
|
|
33908
|
+
headers: {
|
|
33909
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
33910
|
+
token: params.token,
|
|
33911
|
+
referer: "https://baijiahao.baidu.com/builder/rc/home"
|
|
33967
33912
|
}
|
|
33968
|
-
|
|
33969
|
-
|
|
33970
|
-
|
|
33971
|
-
|
|
33972
|
-
|
|
33973
|
-
|
|
33974
|
-
|
|
33975
|
-
|
|
33976
|
-
|
|
33977
|
-
|
|
33978
|
-
|
|
33979
|
-
|
|
33980
|
-
|
|
33981
|
-
|
|
33982
|
-
|
|
33983
|
-
|
|
33984
|
-
|
|
33985
|
-
|
|
33986
|
-
|
|
33987
|
-
|
|
33988
|
-
}
|
|
33989
|
-
static validateA1Value(a1Value) {
|
|
33990
|
-
if ('string' != typeof a1Value) throw new TypeError(`a1_value must be str, got ${typeof a1Value}`);
|
|
33991
|
-
if (!a1Value.trim()) throw new Error('a1_value cannot be empty');
|
|
33992
|
-
return a1Value.trim();
|
|
33993
|
-
}
|
|
33994
|
-
static validateXsecAppid(xsecAppid) {
|
|
33995
|
-
if ('string' != typeof xsecAppid) throw new TypeError(`xsec_appid must be str, got ${typeof xsecAppid}`);
|
|
33996
|
-
if (!xsecAppid.trim()) throw new Error('xsec_appid cannot be empty');
|
|
33997
|
-
return xsecAppid.trim();
|
|
33998
|
-
}
|
|
33999
|
-
static validatePayload(payload) {
|
|
34000
|
-
if (null !== payload && ('object' != typeof payload || Array.isArray(payload))) throw new TypeError(`payload must be dict or None, got ${typeof payload}`);
|
|
34001
|
-
if (null !== payload) {
|
|
34002
|
-
for(const key in payload)if ('string' != typeof key) throw new TypeError(`payload keys must be str, got ${typeof key} for key '${key}'`);
|
|
33913
|
+
});
|
|
33914
|
+
const res = await http.api({
|
|
33915
|
+
method: "get",
|
|
33916
|
+
url: "https://baijiahao.baidu.com/user-ui/cms/settingInfo",
|
|
33917
|
+
defaultErrorMsg: "百家号登录状态失效。"
|
|
33918
|
+
});
|
|
33919
|
+
const isSuccess = 0 === res.errno;
|
|
33920
|
+
const message = "百家号账号有效性检测成功";
|
|
33921
|
+
const data = isSuccess ? {
|
|
33922
|
+
isValidSession: true
|
|
33923
|
+
} : {
|
|
33924
|
+
isValidSession: false
|
|
33925
|
+
};
|
|
33926
|
+
return success(data, message);
|
|
33927
|
+
};
|
|
33928
|
+
const DySessionCheck = async (_task, params)=>{
|
|
33929
|
+
const http = new Http({
|
|
33930
|
+
headers: {
|
|
33931
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
33932
|
+
referer: "https://creator.douyin.com/"
|
|
34003
33933
|
}
|
|
34004
|
-
|
|
34005
|
-
|
|
34006
|
-
|
|
34007
|
-
|
|
34008
|
-
|
|
34009
|
-
|
|
34010
|
-
|
|
34011
|
-
|
|
34012
|
-
|
|
33934
|
+
});
|
|
33935
|
+
const res = await http.api({
|
|
33936
|
+
method: "get",
|
|
33937
|
+
url: "https://creator.douyin.com/aweme/v1/creator/user/info/",
|
|
33938
|
+
params: {
|
|
33939
|
+
_ts: Date.now()
|
|
33940
|
+
},
|
|
33941
|
+
defaultErrorMsg: "抖音登录状态失效。"
|
|
33942
|
+
});
|
|
33943
|
+
const isSuccess = 0 === res.status_code;
|
|
33944
|
+
const message = "抖音账号有效性检测成功";
|
|
33945
|
+
const data = isSuccess ? {
|
|
33946
|
+
isValidSession: true
|
|
33947
|
+
} : {
|
|
33948
|
+
isValidSession: false
|
|
33949
|
+
};
|
|
33950
|
+
return success(data, message);
|
|
33951
|
+
};
|
|
33952
|
+
const ShipinhaoSessionCheck = async (_task, params)=>{
|
|
33953
|
+
const http = new Http({
|
|
33954
|
+
headers: {
|
|
33955
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
33956
|
+
referer: "https://channels.weixin.qq.com",
|
|
33957
|
+
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
|
|
33958
|
+
"Content-Type": "application/json"
|
|
34013
33959
|
}
|
|
34014
|
-
|
|
34015
|
-
|
|
34016
|
-
|
|
34017
|
-
|
|
34018
|
-
|
|
34019
|
-
|
|
34020
|
-
|
|
34021
|
-
|
|
34022
|
-
|
|
34023
|
-
|
|
34024
|
-
}
|
|
34025
|
-
|
|
34026
|
-
|
|
34027
|
-
|
|
34028
|
-
|
|
34029
|
-
|
|
34030
|
-
|
|
34031
|
-
|
|
34032
|
-
|
|
34033
|
-
|
|
34034
|
-
|
|
34035
|
-
|
|
34036
|
-
|
|
34037
|
-
|
|
34038
|
-
|
|
34039
|
-
|
|
34040
|
-
|
|
34041
|
-
|
|
34042
|
-
|
|
34043
|
-
|
|
34044
|
-
|
|
34045
|
-
|
|
34046
|
-
|
|
34047
|
-
|
|
34048
|
-
|
|
34049
|
-
|
|
34050
|
-
|
|
34051
|
-
|
|
34052
|
-
|
|
34053
|
-
|
|
34054
|
-
|
|
34055
|
-
|
|
34056
|
-
|
|
34057
|
-
|
|
34058
|
-
|
|
34059
|
-
|
|
34060
|
-
|
|
34061
|
-
|
|
34062
|
-
|
|
34063
|
-
|
|
34064
|
-
|
|
34065
|
-
|
|
34066
|
-
|
|
34067
|
-
|
|
34068
|
-
|
|
34069
|
-
|
|
34070
|
-
|
|
34071
|
-
|
|
34072
|
-
|
|
34073
|
-
|
|
34074
|
-
|
|
34075
|
-
|
|
34076
|
-
|
|
34077
|
-
|
|
34078
|
-
|
|
34079
|
-
|
|
34080
|
-
|
|
34081
|
-
|
|
34082
|
-
|
|
34083
|
-
|
|
34084
|
-
|
|
34085
|
-
|
|
34086
|
-
|
|
34087
|
-
|
|
34088
|
-
|
|
34089
|
-
|
|
34090
|
-
|
|
34091
|
-
|
|
34092
|
-
|
|
34093
|
-
|
|
34094
|
-
|
|
34095
|
-
|
|
34096
|
-
|
|
34097
|
-
|
|
33960
|
+
});
|
|
33961
|
+
const getTimeStamp = (length)=>Date.now().toString().substring(0, length);
|
|
33962
|
+
const requestBody = {
|
|
33963
|
+
timestamp: getTimeStamp(13),
|
|
33964
|
+
_log_finder_uin: "",
|
|
33965
|
+
_log_finder_id: "",
|
|
33966
|
+
rawKeyBuff: null,
|
|
33967
|
+
pluginSessionId: null,
|
|
33968
|
+
scene: 7,
|
|
33969
|
+
reqScene: 7
|
|
33970
|
+
};
|
|
33971
|
+
const res = await http.api({
|
|
33972
|
+
method: "post",
|
|
33973
|
+
url: "https://channels.weixin.qq.com/cgi-bin/mmfinderassistant-bin/auth/auth_data",
|
|
33974
|
+
data: requestBody,
|
|
33975
|
+
defaultErrorMsg: "视频号登录状态失效。"
|
|
33976
|
+
});
|
|
33977
|
+
const isSuccess = 0 === res.errCode && res.data?.finderUser !== void 0;
|
|
33978
|
+
const message = isSuccess ? "视频号账号有效性检测成功" : 300333 === res.errCode || 300334 === res.errCode ? "视频号登录已失效,请重新登录" : "视频号账号有效性检测失败";
|
|
33979
|
+
const data = isSuccess ? {
|
|
33980
|
+
isValidSession: true
|
|
33981
|
+
} : {
|
|
33982
|
+
isValidSession: false
|
|
33983
|
+
};
|
|
33984
|
+
return success(data, message);
|
|
33985
|
+
};
|
|
33986
|
+
const extractEncFileKey = (downloadUrl)=>{
|
|
33987
|
+
if (!downloadUrl) return "";
|
|
33988
|
+
return downloadUrl.split("encfilekey=")[1]?.split("&")[0] || "";
|
|
33989
|
+
};
|
|
33990
|
+
const rid = ()=>`${Math.floor(Date.now() / 1e3).toString(16)}-${[
|
|
33991
|
+
...Array(8)
|
|
33992
|
+
].map(()=>Math.floor(16 * Math.random()).toString(16)).join("")}`;
|
|
33993
|
+
new Uint8Array(16);
|
|
33994
|
+
const hexTable = [];
|
|
33995
|
+
for(let i = 0; i < 256; i++)hexTable.push((i + 256).toString(16).substr(1));
|
|
33996
|
+
const createShipinhaoComment = async (_task, params)=>{
|
|
33997
|
+
if (!params.content || "" === params.content.trim()) return utils_response(400, "评论内容不能为空", void 0);
|
|
33998
|
+
if (!params.exportId) return utils_response(400, "exportId 不能为空", void 0);
|
|
33999
|
+
if (!params.extraParam) return utils_response(400, "缺少 extraParam 参数", void 0);
|
|
34000
|
+
if (!params.extraParam.fingerPrintDeviceId || !params.extraParam.aId || !params.extraParam.uin) return utils_response(400, "fingerPrintDeviceId、aId和uin不能为空", void 0);
|
|
34001
|
+
const headers = {
|
|
34002
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
34003
|
+
referer: "https://channels.weixin.qq.com/micro/interaction/comment",
|
|
34004
|
+
origin: "https://channels.weixin.qq.com",
|
|
34005
|
+
"content-type": "application/json",
|
|
34006
|
+
"finger-print-device-id": params.extraParam.fingerPrintDeviceId,
|
|
34007
|
+
"x-wechat-uin": params.extraParam.uin
|
|
34008
|
+
};
|
|
34009
|
+
const http = new Http({
|
|
34010
|
+
headers
|
|
34011
|
+
});
|
|
34012
|
+
const urlParams = new URLSearchParams({
|
|
34013
|
+
_aid: params.extraParam.aId,
|
|
34014
|
+
_rid: rid(),
|
|
34015
|
+
_pageUrl: "https://channels.weixin.qq.com/micro/interaction/comment"
|
|
34016
|
+
}).toString();
|
|
34017
|
+
const requestData = {
|
|
34018
|
+
replyCommentId: params.replyCommentId || "",
|
|
34019
|
+
content: params.content,
|
|
34020
|
+
clientId: `${Date.now()}-${Math.random().toString(36).substring(2, 15)}`,
|
|
34021
|
+
rootCommentId: params.rootCommentId || "",
|
|
34022
|
+
comment: {},
|
|
34023
|
+
exportId: params.exportId,
|
|
34024
|
+
timestamp: Date.now().toString(),
|
|
34025
|
+
_log_finder_uin: "",
|
|
34026
|
+
_log_finder_id: params.extraParam.finderUserName || "",
|
|
34027
|
+
rawKeyBuff: null,
|
|
34028
|
+
pluginSessionId: null,
|
|
34029
|
+
scene: 7,
|
|
34030
|
+
reqScene: 7
|
|
34031
|
+
};
|
|
34032
|
+
if (params.rootCommentId) requestData.rootCommentId = params.rootCommentId;
|
|
34033
|
+
if (params.replyCommentId) requestData.replyCommentId = params.replyCommentId;
|
|
34034
|
+
const res = await http.api({
|
|
34035
|
+
method: "post",
|
|
34036
|
+
url: `https://channels.weixin.qq.com/micro/interaction/cgi-bin/mmfinderassistant-bin/comment/create_comment?${urlParams}`,
|
|
34037
|
+
data: requestData
|
|
34038
|
+
});
|
|
34039
|
+
console.log(res, "----create comment res");
|
|
34040
|
+
const isSuccess = res?.errCode === 0;
|
|
34041
|
+
return utils_response(isSuccess ? 0 : 414, res?.errMsg || "添加评论失败", res.data);
|
|
34042
|
+
};
|
|
34043
|
+
const { generateCsrfTokenAdvanced } = __webpack_require__("./src/utils/douyin/douyinSafe/csrfToken.js");
|
|
34044
|
+
const { getABogus } = __webpack_require__("./src/utils/douyin/douyinSafe/a_bogus.js");
|
|
34045
|
+
const { generateDtrait } = __webpack_require__("./src/utils/douyin/douyinSafe/dtrait.js");
|
|
34046
|
+
const DouyinCheckVerifyQrCodeParamsSchema = ActionCommonParamsSchema.extend({
|
|
34047
|
+
token: classic_schemas_string(),
|
|
34048
|
+
encrypt_uid: classic_schemas_string(),
|
|
34049
|
+
verify_scene: classic_schemas_string().optional(),
|
|
34050
|
+
verify_reason: classic_schemas_string().optional(),
|
|
34051
|
+
extraParam: classic_schemas_object({
|
|
34052
|
+
browserInfo: classic_schemas_object({
|
|
34053
|
+
screen_width: classic_schemas_string().optional(),
|
|
34054
|
+
screen_height: classic_schemas_string().optional(),
|
|
34055
|
+
browser_language: classic_schemas_string().optional(),
|
|
34056
|
+
browser_platform: classic_schemas_string().optional(),
|
|
34057
|
+
browser_name: classic_schemas_string().optional(),
|
|
34058
|
+
"sec-ch-ua-platform": classic_schemas_string().optional(),
|
|
34059
|
+
"sec-ch-ua": classic_schemas_string().optional(),
|
|
34060
|
+
userAgent: classic_schemas_string().optional()
|
|
34061
|
+
})
|
|
34062
|
+
}).optional()
|
|
34063
|
+
});
|
|
34064
|
+
function mergeSetCookies(oldCookies, setCookieHeader) {
|
|
34065
|
+
if (!setCookieHeader) return oldCookies;
|
|
34066
|
+
const setCookies = Array.isArray(setCookieHeader) ? setCookieHeader : [
|
|
34067
|
+
setCookieHeader
|
|
34068
|
+
];
|
|
34069
|
+
const cookieMap = new Map(oldCookies.map((c)=>[
|
|
34070
|
+
c.name,
|
|
34071
|
+
c
|
|
34072
|
+
]));
|
|
34073
|
+
for (const raw of setCookies){
|
|
34074
|
+
const parts = raw.split(";");
|
|
34075
|
+
const [nameValue] = parts;
|
|
34076
|
+
if (!nameValue) continue;
|
|
34077
|
+
const eqIdx = nameValue.indexOf("=");
|
|
34078
|
+
if (-1 === eqIdx) continue;
|
|
34079
|
+
const name = nameValue.slice(0, eqIdx).trim();
|
|
34080
|
+
const value = nameValue.slice(eqIdx + 1).trim();
|
|
34081
|
+
if (!name) continue;
|
|
34082
|
+
const attrs = {};
|
|
34083
|
+
for(let i = 1; i < parts.length; i++){
|
|
34084
|
+
const part = parts[i].trim();
|
|
34085
|
+
const attrEq = part.indexOf("=");
|
|
34086
|
+
if (-1 === attrEq) attrs[part.toLowerCase()] = true;
|
|
34087
|
+
else attrs[part.slice(0, attrEq).trim().toLowerCase()] = part.slice(attrEq + 1).trim();
|
|
34098
34088
|
}
|
|
34099
|
-
|
|
34089
|
+
const existing = cookieMap.get(name);
|
|
34090
|
+
cookieMap.set(name, {
|
|
34091
|
+
...existing || {},
|
|
34092
|
+
...attrs,
|
|
34093
|
+
name,
|
|
34094
|
+
value
|
|
34095
|
+
});
|
|
34100
34096
|
}
|
|
34097
|
+
return Array.from(cookieMap.values());
|
|
34101
34098
|
}
|
|
34102
|
-
|
|
34103
|
-
|
|
34104
|
-
|
|
34105
|
-
|
|
34106
|
-
|
|
34107
|
-
|
|
34108
|
-
|
|
34109
|
-
|
|
34110
|
-
|
|
34111
|
-
"
|
|
34112
|
-
"
|
|
34113
|
-
"
|
|
34114
|
-
"
|
|
34115
|
-
"
|
|
34116
|
-
"
|
|
34117
|
-
"
|
|
34118
|
-
"
|
|
34119
|
-
"
|
|
34120
|
-
"
|
|
34121
|
-
"
|
|
34122
|
-
"
|
|
34123
|
-
"
|
|
34124
|
-
"Google Inc. (Intel)|ANGLE (Intel, Intel Arc A380M (0x0000AF5E) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34125
|
-
"Google Inc. (Intel)|ANGLE (Intel, Intel Arc A550 (0x0000AF42) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34126
|
-
"Google Inc. (Intel)|ANGLE (Intel, Intel Arc A770 (0x0000AF43) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34127
|
-
"Google Inc. (Intel)|ANGLE (Intel, Intel Arc A770M (0x0000AF50) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34128
|
-
"Google Inc. (Intel)|ANGLE (Intel, Mesa Intel(R) Graphics (RPL‑P GT1) (0x0000A702) OpenGL 4.6)",
|
|
34129
|
-
"Google Inc. (Intel)|ANGLE (Intel, Mesa Intel(R) UHD Graphics 770 (0x00004680) OpenGL 4.6)",
|
|
34130
|
-
"Google Inc. (Intel)|ANGLE (Intel, Mesa Intel(R) HD Graphics 4400 (0x00001122) OpenGL 4.6)",
|
|
34131
|
-
"Google Inc. (Intel)|ANGLE (Intel, Mesa Intel(R) Graphics (ADL‑S GT1) (0x0000A0A1) OpenGL 4.6)",
|
|
34132
|
-
"Google Inc. (Intel)|ANGLE (Intel, Mesa Intel(R) Graphics (RKL GT1) (0x0000A9A1) OpenGL 4.6)",
|
|
34133
|
-
"Google Inc. (Intel)|ANGLE (Intel, Mesa Intel(R) UHD Graphics (CML GT2) (0x00009A14) OpenGL 4.6)",
|
|
34134
|
-
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) HD Graphics 3000 (0x00001022) Direct3D9Ex vs_3_0 ps_3_0, igdumd64.dll)",
|
|
34135
|
-
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) HD Graphics Family (0x00000A16) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34136
|
-
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) Iris Pro OpenGL Engine, OpenGL 4.1)",
|
|
34137
|
-
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) Iris(TM) Plus Graphics 645 (0x1616) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34138
|
-
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) Iris(TM) Plus Graphics 655 (0x161E) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34139
|
-
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) UHD Graphics 730 (0x0000A100) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34140
|
-
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) UHD Graphics 805 (0x0000B0A0) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34141
|
-
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon Vega 3 Graphics (0x000015E0) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34142
|
-
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon Vega 8 Graphics (0x000015D8) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34143
|
-
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon Vega 11 Graphics (0x000015DD) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34144
|
-
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon Graphics (0x00001636) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34145
|
-
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 5500 XT Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34146
|
-
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 560 (0x000067EF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34147
|
-
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 570 (0x000067DF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34148
|
-
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 580 2048SP (0x00006FDF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34149
|
-
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 590 (0x000067FF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34150
|
-
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 6600 (0x000073FF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34151
|
-
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 6600 XT (0x000073FF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34152
|
-
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 6650 XT Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34153
|
-
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 6700 XT (0x000073DF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34154
|
-
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 6800 (0x000073BF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34155
|
-
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 6900 XT (0x000073C2) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34156
|
-
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 7700 XT Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34157
|
-
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon Pro 5300M OpenGL Engine, OpenGL 4.1)",
|
|
34158
|
-
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon Pro 5500 XT OpenGL Engine, OpenGL 4.1)",
|
|
34159
|
-
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon R7 370 Series (0x00006811) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34160
|
-
"Google Inc. (AMD)|ANGLE (AMD, ATI Technologies Inc. AMD Radeon RX Vega 64 OpenGL Engine, OpenGL 4.1)",
|
|
34161
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce GTX 1050 (0x00001C81) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34162
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce GTX 1050 Ti (0x00001C8C) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34163
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce GTX 1060 6GB (0x000010DE) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34164
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce GTX 1070 (0x00001B81) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34165
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce GTX 1080 (0x00001B80) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34166
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 2060 (0x00001F06) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34167
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 2060 SUPER (0x00001F06) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34168
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 2070 (0x00001F10) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34169
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 2070 SUPER (0x00001F10) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34170
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 3060 (0x0000250F) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34171
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 3060 Ti (0x00002489) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34172
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 3070 (0x00002488) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34173
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 3070 Ti (0x000028A5) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34174
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 3080 (0x00002206) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34175
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 3080 Ti (0x00002208) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34176
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 3090 (0x00002204) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34177
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 4060 (0x00002882) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34178
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 4060 Ti (0x00002803) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34179
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 4070 (0x00002786) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34180
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 4070 Ti (0x00002857) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34181
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 4080 (0x00002819) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34182
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 4090 (0x00002684) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34183
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA Quadro RTX 5000 Ada Generation (0x000026B2) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34184
|
-
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA Quadro P400 (0x00001CB3) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
34185
|
-
"Google Inc. (Google)|ANGLE (Google, Vulkan 1.3.0 (SwiftShader Device (Subzero) (0x0000C0DE)), SwiftShader driver)",
|
|
34186
|
-
"Google Inc. (Google)|ANGLE (Google, Vulkan 1.3.0 (SwiftShader Device (Subzero)), SwiftShader driver)",
|
|
34187
|
-
"Google Inc. (Google)|ANGLE (Google, Vulkan 1.3.0 (SwiftShader Device), SwiftShader driver)"
|
|
34188
|
-
];
|
|
34189
|
-
}
|
|
34190
|
-
static{
|
|
34191
|
-
this.SCREEN_RESOLUTIONS = {
|
|
34192
|
-
resolutions: [
|
|
34193
|
-
"1366;768",
|
|
34194
|
-
"1600;900",
|
|
34195
|
-
"1920;1080",
|
|
34196
|
-
"2560;1440",
|
|
34197
|
-
"3840;2160",
|
|
34198
|
-
"7680;4320"
|
|
34199
|
-
],
|
|
34200
|
-
weights: [
|
|
34201
|
-
0.25,
|
|
34202
|
-
0.15,
|
|
34203
|
-
0.35,
|
|
34204
|
-
0.15,
|
|
34205
|
-
0.08,
|
|
34206
|
-
0.02
|
|
34207
|
-
]
|
|
34208
|
-
};
|
|
34209
|
-
}
|
|
34210
|
-
static{
|
|
34211
|
-
this.COLOR_DEPTH_OPTIONS = {
|
|
34212
|
-
values: [
|
|
34213
|
-
16,
|
|
34214
|
-
24,
|
|
34215
|
-
30,
|
|
34216
|
-
32
|
|
34217
|
-
],
|
|
34218
|
-
weights: [
|
|
34219
|
-
0.05,
|
|
34220
|
-
0.6,
|
|
34221
|
-
0.05,
|
|
34222
|
-
0.3
|
|
34223
|
-
]
|
|
34224
|
-
};
|
|
34225
|
-
}
|
|
34226
|
-
static{
|
|
34227
|
-
this.DEVICE_MEMORY_OPTIONS = {
|
|
34228
|
-
values: [
|
|
34229
|
-
1,
|
|
34230
|
-
2,
|
|
34231
|
-
4,
|
|
34232
|
-
8,
|
|
34233
|
-
12,
|
|
34234
|
-
16
|
|
34235
|
-
],
|
|
34236
|
-
weights: [
|
|
34237
|
-
0.10,
|
|
34238
|
-
0.25,
|
|
34239
|
-
0.4,
|
|
34240
|
-
0.2,
|
|
34241
|
-
0.03,
|
|
34242
|
-
0.01
|
|
34243
|
-
]
|
|
34244
|
-
};
|
|
34245
|
-
}
|
|
34246
|
-
static{
|
|
34247
|
-
this.CORE_OPTIONS = {
|
|
34248
|
-
values: [
|
|
34249
|
-
2,
|
|
34250
|
-
4,
|
|
34251
|
-
6,
|
|
34252
|
-
8,
|
|
34253
|
-
12,
|
|
34254
|
-
16,
|
|
34255
|
-
24,
|
|
34256
|
-
32
|
|
34257
|
-
],
|
|
34258
|
-
weights: [
|
|
34259
|
-
0.1,
|
|
34260
|
-
0.4,
|
|
34261
|
-
0.2,
|
|
34262
|
-
0.15,
|
|
34263
|
-
0.08,
|
|
34264
|
-
0.04,
|
|
34265
|
-
0.02,
|
|
34266
|
-
0.01
|
|
34267
|
-
]
|
|
34099
|
+
const douyinCheckVerifyQrCode = async (task, params)=>{
|
|
34100
|
+
const userAgent = params.userAgent || "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.38";
|
|
34101
|
+
const bizTraceId = params.cookies.find((e)=>"biz_trace_id" === e.name)?.value || "00000000";
|
|
34102
|
+
const msToken = params.cookies.find((e)=>"msToken" === e.name)?.value || "";
|
|
34103
|
+
const passportCsrfToken = params.cookies.find((e)=>"passport_csrf_token" === e.name)?.value || "";
|
|
34104
|
+
try {
|
|
34105
|
+
task.logger.info(`[douyinCheckVerifyQrCode] 开始轮询二维码状态, token=${params.token}`);
|
|
34106
|
+
const headers = {
|
|
34107
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
34108
|
+
origin: "https://creator.douyin.com",
|
|
34109
|
+
referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
|
|
34110
|
+
Accept: "application/json, text/plain, */*",
|
|
34111
|
+
"Accept-Encoding": "gzip, deflate, br, zstd",
|
|
34112
|
+
"sec-ch-ua-platform": params.extraParam?.browserInfo?.["sec-ch-ua-platform"] || "",
|
|
34113
|
+
"sec-ch-ua": params.extraParam?.browserInfo?.["sec-ch-ua"] || "",
|
|
34114
|
+
"sec-ch-ua-mobile": "?0",
|
|
34115
|
+
"user-agent": userAgent,
|
|
34116
|
+
"sec-fetch-site": "same-origin",
|
|
34117
|
+
"sec-fetch-mode": "cors",
|
|
34118
|
+
"sec-fetch-dest": "empty",
|
|
34119
|
+
"accept-language": "zh-CN,zh;q=0.9",
|
|
34120
|
+
priority: "u=1, i"
|
|
34268
34121
|
};
|
|
34269
|
-
|
|
34270
|
-
|
|
34271
|
-
|
|
34272
|
-
|
|
34273
|
-
|
|
34274
|
-
|
|
34275
|
-
|
|
34276
|
-
|
|
34277
|
-
|
|
34278
|
-
|
|
34279
|
-
|
|
34280
|
-
|
|
34281
|
-
|
|
34282
|
-
|
|
34283
|
-
class FingerprintHelpers {
|
|
34284
|
-
static weightedRandomChoice(options, weights) {
|
|
34285
|
-
const totalWeight = weights.reduce((sum, weight)=>sum + weight, 0);
|
|
34286
|
-
let random = Math.random() * totalWeight;
|
|
34287
|
-
for(let i = 0; i < options.length; i++){
|
|
34288
|
-
random -= weights[i];
|
|
34289
|
-
if (random <= 0) return options[i];
|
|
34290
|
-
}
|
|
34291
|
-
return options[options.length - 1];
|
|
34292
|
-
}
|
|
34293
|
-
static getRendererInfo() {
|
|
34294
|
-
const rendererStr = FingerprintData.GPU_VENDORS[Math.floor(Math.random() * FingerprintData.GPU_VENDORS.length)];
|
|
34295
|
-
const [vendor, renderer] = rendererStr.split('|');
|
|
34296
|
-
return {
|
|
34297
|
-
vendor,
|
|
34298
|
-
renderer
|
|
34122
|
+
const checkBody = {
|
|
34123
|
+
encrypt_uid: params.encrypt_uid || "",
|
|
34124
|
+
verify_ticket: "",
|
|
34125
|
+
copywriting_key: "creator",
|
|
34126
|
+
new_verify_flow: "",
|
|
34127
|
+
aid: "2906",
|
|
34128
|
+
token: params.token,
|
|
34129
|
+
verify_type: "",
|
|
34130
|
+
need_record: "1",
|
|
34131
|
+
scene: "secondary_verify",
|
|
34132
|
+
verify_scene: params.verify_scene || "creator",
|
|
34133
|
+
verify_reason: params.verify_reason || "gateway_web_authlv_check",
|
|
34134
|
+
std_verify_way: "qr_code_verify",
|
|
34135
|
+
new_authn_sdk_version: "1.0.0.404-web"
|
|
34299
34136
|
};
|
|
34300
|
-
|
|
34301
|
-
|
|
34302
|
-
|
|
34303
|
-
|
|
34304
|
-
|
|
34305
|
-
|
|
34306
|
-
|
|
34307
|
-
|
|
34308
|
-
|
|
34309
|
-
|
|
34310
|
-
|
|
34311
|
-
|
|
34312
|
-
|
|
34313
|
-
], [
|
|
34314
|
-
0.1,
|
|
34315
|
-
0.4,
|
|
34316
|
-
0.3,
|
|
34317
|
-
0.2
|
|
34318
|
-
])));
|
|
34319
|
-
availHeight = height;
|
|
34320
|
-
} else {
|
|
34321
|
-
availWidth = width;
|
|
34322
|
-
availHeight = height - parseInt(String(this.weightedRandomChoice([
|
|
34323
|
-
30,
|
|
34324
|
-
60,
|
|
34325
|
-
80,
|
|
34326
|
-
100
|
|
34327
|
-
], [
|
|
34328
|
-
0.2,
|
|
34329
|
-
0.5,
|
|
34330
|
-
0.2,
|
|
34331
|
-
0.1
|
|
34332
|
-
])));
|
|
34333
|
-
}
|
|
34334
|
-
return {
|
|
34335
|
-
width,
|
|
34336
|
-
height,
|
|
34337
|
-
availWidth,
|
|
34338
|
-
availHeight
|
|
34137
|
+
const checkBodyStr = new URLSearchParams(checkBody).toString();
|
|
34138
|
+
const checkQueryParams = {
|
|
34139
|
+
passport_jssdk_version: "5.1.2",
|
|
34140
|
+
passport_jssdk_type: "lite",
|
|
34141
|
+
is_from_ttaccountsdk: "1",
|
|
34142
|
+
aid: "2906",
|
|
34143
|
+
language: "zh",
|
|
34144
|
+
account_app_language: "zh-CN",
|
|
34145
|
+
new_authn_sdk_version: "1.0.0.404-web",
|
|
34146
|
+
is_vcd: "1",
|
|
34147
|
+
biz_trace_id: bizTraceId,
|
|
34148
|
+
msToken,
|
|
34149
|
+
a_bogus: ""
|
|
34339
34150
|
};
|
|
34151
|
+
const checkQueryStr = new URLSearchParams(checkQueryParams).toString();
|
|
34152
|
+
const checkUrl = `https://creator.douyin.com/passport/mobile/validate_by_qrcode/?${checkQueryStr}`;
|
|
34153
|
+
const aBogus = getABogus(checkUrl, checkBodyStr, userAgent);
|
|
34154
|
+
checkQueryParams.a_bogus = aBogus;
|
|
34155
|
+
const finalQueryStr = new URLSearchParams(checkQueryParams).toString();
|
|
34156
|
+
const csrfToken = generateCsrfTokenAdvanced({
|
|
34157
|
+
cookies: params.cookies,
|
|
34158
|
+
url: "https://creator.douyin.com/passport/mobile/validate_by_qrcode/",
|
|
34159
|
+
method: "POST",
|
|
34160
|
+
userAgent
|
|
34161
|
+
});
|
|
34162
|
+
const sessionDtrait = generateDtrait("/passport/mobile/validate_by_qrcode/");
|
|
34163
|
+
let rawSetCookie;
|
|
34164
|
+
const checkHttp = new Http({
|
|
34165
|
+
headers: {
|
|
34166
|
+
...headers,
|
|
34167
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
34168
|
+
"x-secsdk-csrf-token": csrfToken,
|
|
34169
|
+
"x-tt-passport-csrf-token": passportCsrfToken,
|
|
34170
|
+
"x-tt-passport-trace-id": bizTraceId,
|
|
34171
|
+
"x-tt-passport-verify-portrait": "",
|
|
34172
|
+
"x-tt-session-dtrait": sessionDtrait || ""
|
|
34173
|
+
}
|
|
34174
|
+
});
|
|
34175
|
+
checkHttp.addResponseInterceptor((res)=>{
|
|
34176
|
+
task.logger.info(`[douyinCheckVerifyQrCode] 原始响应 status=${res.status} data=${JSON.stringify(res.data)}`);
|
|
34177
|
+
console.log("[douyinCheckVerifyQrCode] 原始响应:", JSON.stringify(res.data));
|
|
34178
|
+
rawSetCookie = res.headers["set-cookie"];
|
|
34179
|
+
});
|
|
34180
|
+
const checkResponse = await checkHttp.api({
|
|
34181
|
+
method: "post",
|
|
34182
|
+
url: `https://creator.douyin.com/passport/mobile/validate_by_qrcode/?${finalQueryStr}`,
|
|
34183
|
+
data: checkBodyStr
|
|
34184
|
+
}, {
|
|
34185
|
+
timeout: 10000
|
|
34186
|
+
});
|
|
34187
|
+
const data = checkResponse?.data;
|
|
34188
|
+
const status = data?.status;
|
|
34189
|
+
task.logger.info(`[douyinCheckVerifyQrCode] status=${status}`);
|
|
34190
|
+
const updatedCookies = mergeSetCookies(params.cookies, rawSetCookie);
|
|
34191
|
+
if ("new" === status) return utils_response(0, "二维码等待扫描", data);
|
|
34192
|
+
if ("scanned" === status) return utils_response(0, "二维码已扫码,待确认扫描", data);
|
|
34193
|
+
if ("confirmed" === status) return utils_response(0, "扫码验证成功", {
|
|
34194
|
+
status: "confirmed",
|
|
34195
|
+
redirect_url: data.redirect_url || "",
|
|
34196
|
+
ticket: data.ticket || "",
|
|
34197
|
+
cookies: updatedCookies
|
|
34198
|
+
});
|
|
34199
|
+
if ("expired" === status) return utils_response(0, "二维码已过期", {
|
|
34200
|
+
status: "expired",
|
|
34201
|
+
token: data.token || "",
|
|
34202
|
+
qrcode: data.qrcode || "",
|
|
34203
|
+
qrcode_index_url: data.qrcode_index_url || "",
|
|
34204
|
+
expire_time: data.expire_time || 0,
|
|
34205
|
+
app_name: data.app_name || "",
|
|
34206
|
+
web_name: data.web_name || ""
|
|
34207
|
+
});
|
|
34208
|
+
return utils_response(414, `未知二维码状态: ${status}`, "");
|
|
34209
|
+
} catch (err) {
|
|
34210
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
34211
|
+
task.logger.warn(`[douyinCheckVerifyQrCode] 请求失败: ${msg}`);
|
|
34212
|
+
return utils_response(500, `校验二维码失败: ${msg}`, "");
|
|
34340
34213
|
}
|
|
34341
|
-
static generateCanvasHash() {
|
|
34342
|
-
return FingerprintData.CANVAS_HASH;
|
|
34343
|
-
}
|
|
34344
|
-
static generateWebglHash() {
|
|
34345
|
-
return external_node_crypto_namespaceObject.createHash('md5').update(external_node_crypto_namespaceObject.randomBytes(32)).digest('hex');
|
|
34346
|
-
}
|
|
34347
|
-
}
|
|
34348
|
-
class ARC4 {
|
|
34349
|
-
constructor(key){
|
|
34350
|
-
this.s = [];
|
|
34351
|
-
for(let i = 0; i < 256; i++)this.s[i] = i;
|
|
34352
|
-
let j = 0;
|
|
34353
|
-
for(let i = 0; i < 256; i++){
|
|
34354
|
-
j = (j + this.s[i] + key[i % key.length]) % 256;
|
|
34355
|
-
[this.s[i], this.s[j]] = [
|
|
34356
|
-
this.s[j],
|
|
34357
|
-
this.s[i]
|
|
34358
|
-
];
|
|
34359
|
-
}
|
|
34360
|
-
}
|
|
34361
|
-
encrypt(data) {
|
|
34362
|
-
const result = new Uint8Array(data.length);
|
|
34363
|
-
let i = 0, j = 0;
|
|
34364
|
-
for(let k = 0; k < data.length; k++){
|
|
34365
|
-
i = (i + 1) % 256;
|
|
34366
|
-
j = (j + this.s[i]) % 256;
|
|
34367
|
-
[this.s[i], this.s[j]] = [
|
|
34368
|
-
this.s[j],
|
|
34369
|
-
this.s[i]
|
|
34370
|
-
];
|
|
34371
|
-
const keyByte = this.s[(this.s[i] + this.s[j]) % 256];
|
|
34372
|
-
result[k] = data[k] ^ keyByte;
|
|
34373
|
-
}
|
|
34374
|
-
return result;
|
|
34375
|
-
}
|
|
34376
|
-
}
|
|
34377
|
-
class FingerprintGenerator {
|
|
34378
|
-
constructor(){
|
|
34379
|
-
this.config = CryptoConfig;
|
|
34380
|
-
this.b1Key = new TextEncoder().encode("xhswebmplfbt");
|
|
34381
|
-
this.encoder = new Base64Encoder();
|
|
34382
|
-
}
|
|
34383
|
-
generate(cookies, userAgent) {
|
|
34384
|
-
const cookieString = Object.entries(cookies).map(([k, v])=>`${k}=${v}`).join('; ');
|
|
34385
|
-
const screenConfig = FingerprintHelpers.getScreenConfig();
|
|
34386
|
-
const isIncognitoMode = FingerprintHelpers.weightedRandomChoice([
|
|
34387
|
-
"true",
|
|
34388
|
-
"false"
|
|
34389
|
-
], [
|
|
34390
|
-
0.95,
|
|
34391
|
-
0.05
|
|
34392
|
-
]);
|
|
34393
|
-
const { vendor, renderer } = FingerprintHelpers.getRendererInfo();
|
|
34394
|
-
const x78Y = Math.floor(101 * Math.random()) + 2350;
|
|
34395
|
-
const fp = {
|
|
34396
|
-
x1: userAgent,
|
|
34397
|
-
x2: "false",
|
|
34398
|
-
x3: "zh-CN",
|
|
34399
|
-
x4: String(FingerprintHelpers.weightedRandomChoice(FingerprintData.COLOR_DEPTH_OPTIONS.values, FingerprintData.COLOR_DEPTH_OPTIONS.weights)),
|
|
34400
|
-
x5: String(FingerprintHelpers.weightedRandomChoice(FingerprintData.DEVICE_MEMORY_OPTIONS.values, FingerprintData.DEVICE_MEMORY_OPTIONS.weights)),
|
|
34401
|
-
x6: "24",
|
|
34402
|
-
x7: `${vendor},${renderer}`,
|
|
34403
|
-
x8: String(FingerprintHelpers.weightedRandomChoice(FingerprintData.CORE_OPTIONS.values, FingerprintData.CORE_OPTIONS.weights)),
|
|
34404
|
-
x9: `${screenConfig.width};${screenConfig.height}`,
|
|
34405
|
-
x10: `${screenConfig.availWidth};${screenConfig.availHeight}`,
|
|
34406
|
-
x11: "-480",
|
|
34407
|
-
x12: "Asia/Shanghai",
|
|
34408
|
-
x13: isIncognitoMode,
|
|
34409
|
-
x14: isIncognitoMode,
|
|
34410
|
-
x15: isIncognitoMode,
|
|
34411
|
-
x16: "false",
|
|
34412
|
-
x17: "false",
|
|
34413
|
-
x18: "un",
|
|
34414
|
-
x19: "Win32",
|
|
34415
|
-
x20: "",
|
|
34416
|
-
x21: FingerprintData.BROWSER_PLUGINS,
|
|
34417
|
-
x22: FingerprintHelpers.generateWebglHash(),
|
|
34418
|
-
x23: "false",
|
|
34419
|
-
x24: "false",
|
|
34420
|
-
x25: "false",
|
|
34421
|
-
x26: "false",
|
|
34422
|
-
x27: "false",
|
|
34423
|
-
x28: "0,false,false",
|
|
34424
|
-
x29: "4,7,8",
|
|
34425
|
-
x30: "swf object not loaded",
|
|
34426
|
-
x33: "0",
|
|
34427
|
-
x34: "0",
|
|
34428
|
-
x35: "0",
|
|
34429
|
-
x36: String(Math.floor(20 * Math.random()) + 1),
|
|
34430
|
-
x37: "0|0|0|0|0|0|0|0|0|1|0|0|0|0|0|0|0|0|1|0|0|0|0|0",
|
|
34431
|
-
x38: "0|0|1|0|1|0|0|0|0|0|1|0|1|0|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0",
|
|
34432
|
-
x39: 0,
|
|
34433
|
-
x40: "0",
|
|
34434
|
-
x41: "0",
|
|
34435
|
-
x42: "3.4.4",
|
|
34436
|
-
x43: FingerprintHelpers.generateCanvasHash(),
|
|
34437
|
-
x44: String(Math.floor(Date.now())),
|
|
34438
|
-
x45: "__SEC_CAV__1-1-1-1-1|__SEC_WSA__|",
|
|
34439
|
-
x46: "false",
|
|
34440
|
-
x47: "1|0|0|0|0|0",
|
|
34441
|
-
x48: "",
|
|
34442
|
-
x49: "{list:[],type:}",
|
|
34443
|
-
x50: "",
|
|
34444
|
-
x51: "",
|
|
34445
|
-
x52: "",
|
|
34446
|
-
x53: external_node_crypto_namespaceObject.createHash('md5').update(external_node_crypto_namespaceObject.randomBytes(32)).digest('hex'),
|
|
34447
|
-
x54: FingerprintData.VOICE_HASH_OPTIONS,
|
|
34448
|
-
x55: "380,380,360,400,380,400,420,380,400,400,360,360,440,420",
|
|
34449
|
-
x56: `${vendor}|${renderer}|${FingerprintHelpers.generateWebglHash()}|35`,
|
|
34450
|
-
x57: cookieString,
|
|
34451
|
-
x58: "180",
|
|
34452
|
-
x59: "2",
|
|
34453
|
-
x60: "63",
|
|
34454
|
-
x61: "1291",
|
|
34455
|
-
x62: "2047",
|
|
34456
|
-
x63: "0",
|
|
34457
|
-
x64: "0",
|
|
34458
|
-
x65: "0",
|
|
34459
|
-
x66: {
|
|
34460
|
-
referer: "",
|
|
34461
|
-
location: "https://www.xiaohongshu.com/explore",
|
|
34462
|
-
frame: 0
|
|
34463
|
-
},
|
|
34464
|
-
x67: "1|0",
|
|
34465
|
-
x68: "0",
|
|
34466
|
-
x69: "326|1292|30",
|
|
34467
|
-
x70: [
|
|
34468
|
-
"location"
|
|
34469
|
-
],
|
|
34470
|
-
x71: "true",
|
|
34471
|
-
x72: "complete",
|
|
34472
|
-
x73: "1191",
|
|
34473
|
-
x74: "0|0|0",
|
|
34474
|
-
x75: "Google Inc.",
|
|
34475
|
-
x76: "true",
|
|
34476
|
-
x77: "1|1|1|1|1|1|1|1|1|1",
|
|
34477
|
-
x78: {
|
|
34478
|
-
x: 0,
|
|
34479
|
-
y: x78Y,
|
|
34480
|
-
left: 0,
|
|
34481
|
-
right: 290.828125,
|
|
34482
|
-
bottom: x78Y + 18,
|
|
34483
|
-
height: 18,
|
|
34484
|
-
top: x78Y,
|
|
34485
|
-
width: 290.828125,
|
|
34486
|
-
font: FingerprintData.FONTS
|
|
34487
|
-
},
|
|
34488
|
-
x79: "144|599565058866",
|
|
34489
|
-
x80: "1|[object FileSystemDirectoryHandle]",
|
|
34490
|
-
x31: "124.04347527516074",
|
|
34491
|
-
x82: "_0x17a2|_0x1954"
|
|
34492
|
-
};
|
|
34493
|
-
return fp;
|
|
34494
|
-
}
|
|
34495
|
-
generateB1(fp) {
|
|
34496
|
-
const b1Fp = {
|
|
34497
|
-
x33: fp.x33,
|
|
34498
|
-
x34: fp.x34,
|
|
34499
|
-
x35: fp.x35,
|
|
34500
|
-
x36: fp.x36,
|
|
34501
|
-
x37: fp.x37,
|
|
34502
|
-
x38: fp.x38,
|
|
34503
|
-
x39: fp.x39,
|
|
34504
|
-
x42: fp.x42,
|
|
34505
|
-
x43: fp.x43,
|
|
34506
|
-
x44: fp.x44,
|
|
34507
|
-
x45: fp.x45,
|
|
34508
|
-
x46: fp.x46,
|
|
34509
|
-
x48: fp.x48,
|
|
34510
|
-
x49: fp.x49,
|
|
34511
|
-
x50: fp.x50,
|
|
34512
|
-
x51: fp.x51,
|
|
34513
|
-
x52: fp.x52,
|
|
34514
|
-
x82: fp.x82
|
|
34515
|
-
};
|
|
34516
|
-
const b1Json = JSON.stringify(b1Fp, null, 0).replace(/\s+/g, '');
|
|
34517
|
-
const cipher = new ARC4(this.b1Key);
|
|
34518
|
-
const ciphertext = cipher.encrypt(new TextEncoder().encode(b1Json));
|
|
34519
|
-
let latin1String = '';
|
|
34520
|
-
for(let i = 0; i < ciphertext.length; i++)latin1String += String.fromCharCode(ciphertext[i]);
|
|
34521
|
-
const encodedUrl = encodeURIComponent(latin1String).replace(/[!'()*~_-]/g, (c)=>c);
|
|
34522
|
-
const b = [];
|
|
34523
|
-
const parts = encodedUrl.split('%').slice(1);
|
|
34524
|
-
for (const part of parts){
|
|
34525
|
-
const chars = part.split('');
|
|
34526
|
-
if (chars.length >= 2) {
|
|
34527
|
-
b.push(parseInt(chars.slice(0, 2).join(''), 16));
|
|
34528
|
-
for(let i = 2; i < chars.length; i++)b.push(chars[i].charCodeAt(0));
|
|
34529
|
-
}
|
|
34530
|
-
}
|
|
34531
|
-
const b1 = this.encoder.encode(JSON.stringify(b));
|
|
34532
|
-
return b1;
|
|
34533
|
-
}
|
|
34534
|
-
update(fp, cookies, url) {
|
|
34535
|
-
const cookieString = Object.entries(cookies).map(([k, v])=>`${k}=${v}`).join('; ');
|
|
34536
|
-
fp.x39 = 0;
|
|
34537
|
-
fp.x44 = String(Math.floor(Date.now()));
|
|
34538
|
-
fp.x57 = cookieString;
|
|
34539
|
-
fp.x66 = {
|
|
34540
|
-
referer: "https://www.xiaohongshu.com/explore",
|
|
34541
|
-
location: url,
|
|
34542
|
-
frame: 0
|
|
34543
|
-
};
|
|
34544
|
-
}
|
|
34545
|
-
}
|
|
34546
|
-
class XsCommonSigner {
|
|
34547
|
-
constructor(){
|
|
34548
|
-
this.config = CryptoConfig;
|
|
34549
|
-
this.fpGenerator = new FingerprintGenerator();
|
|
34550
|
-
this.encoder = new Base64Encoder();
|
|
34551
|
-
}
|
|
34552
|
-
sign(cookieDict) {
|
|
34553
|
-
if (!cookieDict.a1) throw new Error("Missing 'a1' in cookies");
|
|
34554
|
-
const a1Value = cookieDict.a1;
|
|
34555
|
-
const fingerprint = this.fpGenerator.generate(cookieDict, this.config.PUBLIC_USERAGENT);
|
|
34556
|
-
const b1 = this.fpGenerator.generateB1(fingerprint);
|
|
34557
|
-
const x9 = CRC32.crc32JsInt(b1, true);
|
|
34558
|
-
const signStruct = {
|
|
34559
|
-
s0: 5,
|
|
34560
|
-
s1: "",
|
|
34561
|
-
x0: "1",
|
|
34562
|
-
x1: "4.2.6",
|
|
34563
|
-
x2: "Windows",
|
|
34564
|
-
x3: "xhs-pc-web",
|
|
34565
|
-
x4: "4.86.0",
|
|
34566
|
-
x5: a1Value,
|
|
34567
|
-
x6: "",
|
|
34568
|
-
x7: "",
|
|
34569
|
-
x8: b1,
|
|
34570
|
-
x9: x9,
|
|
34571
|
-
x10: 0,
|
|
34572
|
-
x11: "normal"
|
|
34573
|
-
};
|
|
34574
|
-
const signJson = JSON.stringify(signStruct);
|
|
34575
|
-
return this.encoder.encode(signJson);
|
|
34576
|
-
}
|
|
34577
|
-
}
|
|
34578
|
-
class Xhshow {
|
|
34579
|
-
buildContentString(method, uri, payload = null) {
|
|
34580
|
-
payload = payload || {};
|
|
34581
|
-
if ('POST' === method.toUpperCase()) return uri + JSON.stringify(payload);
|
|
34582
|
-
if (0 === Object.keys(payload).length) return uri;
|
|
34583
|
-
{
|
|
34584
|
-
const params = Object.entries(payload).map(([key, value])=>{
|
|
34585
|
-
let valueStr;
|
|
34586
|
-
valueStr = Array.isArray(value) ? value.map((v)=>String(v)).join(',') : null !== value ? String(value) : '';
|
|
34587
|
-
valueStr = valueStr.replace(/=/g, '%3D');
|
|
34588
|
-
return `${key}=${valueStr}`;
|
|
34589
|
-
});
|
|
34590
|
-
return `${uri}?${params.join('&')}`;
|
|
34591
|
-
}
|
|
34592
|
-
}
|
|
34593
|
-
generateDValue(content) {
|
|
34594
|
-
return external_node_crypto_namespaceObject.createHash('md5').update(content, 'utf-8').digest('hex');
|
|
34595
|
-
}
|
|
34596
|
-
buildSignature(dValue, a1Value, xsecAppid = "xhs-pc-web", stringParam = "", timestamp) {
|
|
34597
|
-
const payloadArray = this.cryptoProcessor.buildPayloadArray(dValue, a1Value, xsecAppid, stringParam, timestamp);
|
|
34598
|
-
const xorResult = this.cryptoProcessor.bitOps.xorTransformArray(payloadArray);
|
|
34599
|
-
return this.cryptoProcessor.b64encoder.encodeX3(xorResult.slice(0, 124));
|
|
34600
|
-
}
|
|
34601
|
-
signXs(method, uri, a1Value, xsecAppid = "xhs-pc-web", payload = null, timestamp) {
|
|
34602
|
-
const validatedMethod = RequestSignatureValidator.validateMethod(method);
|
|
34603
|
-
const validatedUri = RequestSignatureValidator.validateUri(uri);
|
|
34604
|
-
const validatedA1Value = RequestSignatureValidator.validateA1Value(a1Value);
|
|
34605
|
-
const validatedXsecAppid = RequestSignatureValidator.validateXsecAppid(xsecAppid);
|
|
34606
|
-
const validatedPayload = RequestSignatureValidator.validatePayload(payload);
|
|
34607
|
-
const signatureData = JSON.parse(JSON.stringify(this.cryptoProcessor.config.SIGNATURE_DATA_TEMPLATE));
|
|
34608
|
-
const content = this.buildContentString(validatedMethod, validatedUri, validatedPayload);
|
|
34609
|
-
const dValue = this.generateDValue(content);
|
|
34610
|
-
signatureData.x3 = this.cryptoProcessor.config.X3_PREFIX + this.buildSignature(dValue, validatedA1Value, validatedXsecAppid, content, timestamp);
|
|
34611
|
-
const signatureJson = JSON.stringify(signatureData);
|
|
34612
|
-
return this.cryptoProcessor.config.XYS_PREFIX + this.cryptoProcessor.b64encoder.encode(signatureJson);
|
|
34613
|
-
}
|
|
34614
|
-
signXsGet(uri, a1Value, xsecAppid = "xhs-pc-web", params = null, timestamp) {
|
|
34615
|
-
return this.signXs('GET', uri, a1Value, xsecAppid, params, timestamp);
|
|
34616
|
-
}
|
|
34617
|
-
signXsPost(uri, a1Value, xsecAppid = "xhs-pc-web", payload = null, timestamp) {
|
|
34618
|
-
return this.signXs('POST', uri, a1Value, xsecAppid, payload, timestamp);
|
|
34619
|
-
}
|
|
34620
|
-
signXsCommon(cookieDict) {
|
|
34621
|
-
const cookies = this.parseCookies(cookieDict);
|
|
34622
|
-
return this.xsCommonSigner.sign(cookies);
|
|
34623
|
-
}
|
|
34624
|
-
signXsc(cookieDict) {
|
|
34625
|
-
return this.signXsCommon(cookieDict);
|
|
34626
|
-
}
|
|
34627
|
-
parseCookies(cookies) {
|
|
34628
|
-
if ('string' == typeof cookies) {
|
|
34629
|
-
const cookieObj = {};
|
|
34630
|
-
cookies.split(';').forEach((item)=>{
|
|
34631
|
-
const [key, value] = item.trim().split('=');
|
|
34632
|
-
if (key && value) cookieObj[key] = value;
|
|
34633
|
-
});
|
|
34634
|
-
return cookieObj;
|
|
34635
|
-
}
|
|
34636
|
-
return cookies;
|
|
34637
|
-
}
|
|
34638
|
-
signHeaders(method, uri, cookies, xsecAppid = "xhs-pc-web", params, payload, timestamp) {
|
|
34639
|
-
if (void 0 === timestamp) timestamp = Date.now() / 1000;
|
|
34640
|
-
const methodUpper = method.toUpperCase();
|
|
34641
|
-
let requestData = null;
|
|
34642
|
-
if ('GET' === methodUpper) {
|
|
34643
|
-
if (null != payload) throw new Error("GET requests must use 'params', not 'payload'");
|
|
34644
|
-
requestData = params || null;
|
|
34645
|
-
} else if ('POST' === methodUpper) {
|
|
34646
|
-
if (null != params) throw new Error("POST requests must use 'payload', not 'params'");
|
|
34647
|
-
requestData = payload || null;
|
|
34648
|
-
} else throw new Error(`Unsupported method: ${method}`);
|
|
34649
|
-
const cookieDict = this.parseCookies(cookies);
|
|
34650
|
-
const a1Value = cookieDict.a1;
|
|
34651
|
-
if (!a1Value) throw new Error("Missing 'a1' in cookies");
|
|
34652
|
-
const xS = this.signXs(methodUpper, uri, a1Value, xsecAppid, requestData, timestamp);
|
|
34653
|
-
const xSCommon = this.signXsCommon(cookieDict);
|
|
34654
|
-
const xT = this.getXT(timestamp);
|
|
34655
|
-
const xB3Traceid = this.getB3TraceId();
|
|
34656
|
-
const xXrayTraceid = this.getXrayTraceId(Math.floor(1000 * timestamp));
|
|
34657
|
-
return {
|
|
34658
|
-
'x-s': xS,
|
|
34659
|
-
'x-s-common': xSCommon,
|
|
34660
|
-
'x-t': xT.toString(),
|
|
34661
|
-
'x-b3-traceid': xB3Traceid,
|
|
34662
|
-
'x-xray-traceid': xXrayTraceid
|
|
34663
|
-
};
|
|
34664
|
-
}
|
|
34665
|
-
signHeadersGet(uri, cookies, xsecAppid = "xhs-pc-web", params, timestamp) {
|
|
34666
|
-
return this.signHeaders('GET', uri, cookies, xsecAppid, params, void 0, timestamp);
|
|
34667
|
-
}
|
|
34668
|
-
signHeadersPost(uri, cookies, xsecAppid = "xhs-pc-web", payload, timestamp) {
|
|
34669
|
-
return this.signHeaders('POST', uri, cookies, xsecAppid, void 0, payload, timestamp);
|
|
34670
|
-
}
|
|
34671
|
-
decodeX3(x3Signature) {
|
|
34672
|
-
if (x3Signature.startsWith(this.cryptoProcessor.config.X3_PREFIX)) x3Signature = x3Signature.substring(this.cryptoProcessor.config.X3_PREFIX.length);
|
|
34673
|
-
const decodedBytes = this.cryptoProcessor.b64encoder.decodeX3(x3Signature);
|
|
34674
|
-
return this.cryptoProcessor.bitOps.xorTransformArray(Array.from(decodedBytes));
|
|
34675
|
-
}
|
|
34676
|
-
decodeXs(xsSignature) {
|
|
34677
|
-
if (xsSignature.startsWith(this.cryptoProcessor.config.XYS_PREFIX)) xsSignature = xsSignature.substring(this.cryptoProcessor.config.XYS_PREFIX.length);
|
|
34678
|
-
const jsonString = this.cryptoProcessor.b64encoder.decode(xsSignature);
|
|
34679
|
-
try {
|
|
34680
|
-
return JSON.parse(jsonString);
|
|
34681
|
-
} catch (e) {
|
|
34682
|
-
throw new Error(`Invalid signature: JSON decode failed - ${e}`);
|
|
34683
|
-
}
|
|
34684
|
-
}
|
|
34685
|
-
getB3TraceId() {
|
|
34686
|
-
return this.cryptoProcessor.randomGen.generateB3TraceId();
|
|
34687
|
-
}
|
|
34688
|
-
getXrayTraceId(timestamp, seq) {
|
|
34689
|
-
return this.cryptoProcessor.randomGen.generateXrayTraceId(timestamp, seq);
|
|
34690
|
-
}
|
|
34691
|
-
getXT(timestamp) {
|
|
34692
|
-
if (void 0 === timestamp) timestamp = Date.now() / 1000;
|
|
34693
|
-
return Math.floor(1000 * timestamp);
|
|
34694
|
-
}
|
|
34695
|
-
buildUrl(baseUrl, params) {
|
|
34696
|
-
if (!params || 0 === Object.keys(params).length) return baseUrl;
|
|
34697
|
-
const queryString = Object.entries(params).map(([key, value])=>{
|
|
34698
|
-
const valueStr = Array.isArray(value) ? value.join(',') : String(value);
|
|
34699
|
-
return `${key}=${encodeURIComponent(valueStr)}`;
|
|
34700
|
-
}).join('&');
|
|
34701
|
-
return `${baseUrl}?${queryString}`;
|
|
34702
|
-
}
|
|
34703
|
-
buildJsonBody(payload) {
|
|
34704
|
-
return JSON.stringify(payload);
|
|
34705
|
-
}
|
|
34706
|
-
constructor(){
|
|
34707
|
-
this.cryptoProcessor = new CryptoProcessor();
|
|
34708
|
-
this.xsCommonSigner = new XsCommonSigner();
|
|
34709
|
-
}
|
|
34710
|
-
}
|
|
34711
|
-
new Xhshow();
|
|
34712
|
-
const sessionCheck_xsEncrypt = new Xhshow();
|
|
34713
|
-
let lastEnvLogTime = 0;
|
|
34714
|
-
const ENV_LOG_INTERVAL_MS = 5000;
|
|
34715
|
-
const SessionCheckResultSchema = classic_schemas_object({
|
|
34716
|
-
isValidSession: classic_schemas_boolean()
|
|
34717
|
-
});
|
|
34718
|
-
const WxBjhSessionParamsSchema = ActionCommonParamsSchema.extend({
|
|
34719
|
-
token: schemas_union([
|
|
34720
|
-
classic_schemas_string(),
|
|
34721
|
-
classic_schemas_number()
|
|
34722
|
-
])
|
|
34723
|
-
});
|
|
34724
|
-
const TTSessionCheck = async (_task, params)=>{
|
|
34725
|
-
const http = new Http({
|
|
34726
|
-
headers: {
|
|
34727
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
34728
|
-
referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
|
|
34729
|
-
}
|
|
34730
|
-
});
|
|
34731
|
-
const res = await http.api({
|
|
34732
|
-
method: "get",
|
|
34733
|
-
url: "https://mp.toutiao.com/mp/agw/creator_center/user_info",
|
|
34734
|
-
defaultErrorMsg: "头条号登录状态失效。"
|
|
34735
|
-
});
|
|
34736
|
-
const isSuccess = 0 === res.code;
|
|
34737
|
-
const message = "头条账号有效性检测成功";
|
|
34738
|
-
const data = isSuccess ? {
|
|
34739
|
-
isValidSession: true
|
|
34740
|
-
} : {
|
|
34741
|
-
isValidSession: false
|
|
34742
|
-
};
|
|
34743
|
-
return success(data, message);
|
|
34744
|
-
};
|
|
34745
|
-
const WxSessionCheck = async (_task, params)=>{
|
|
34746
|
-
const http = new Http({
|
|
34747
|
-
headers: {
|
|
34748
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
34749
|
-
}
|
|
34750
|
-
});
|
|
34751
|
-
const fingerprint = "4695500bc93ab4ce8fb2692da6564e04";
|
|
34752
|
-
const res = await http.api({
|
|
34753
|
-
method: "get",
|
|
34754
|
-
url: "https://mp.weixin.qq.com/cgi-bin/appmsgpublish",
|
|
34755
|
-
params: {
|
|
34756
|
-
fingerprint,
|
|
34757
|
-
sub: "list",
|
|
34758
|
-
begin: 0,
|
|
34759
|
-
count: 10,
|
|
34760
|
-
query: "",
|
|
34761
|
-
type: 1011102103,
|
|
34762
|
-
show_type: "",
|
|
34763
|
-
free_publish_type: 1102103,
|
|
34764
|
-
sub_action: "list_ex",
|
|
34765
|
-
search_card: 0,
|
|
34766
|
-
token: params.token,
|
|
34767
|
-
lang: "zh_CN",
|
|
34768
|
-
f: "json",
|
|
34769
|
-
ajax: 1
|
|
34770
|
-
}
|
|
34771
|
-
});
|
|
34772
|
-
return success(0 === res.base_resp.ret ? {
|
|
34773
|
-
isValidSession: true
|
|
34774
|
-
} : {
|
|
34775
|
-
isValidSession: false
|
|
34776
|
-
}, "微信账号有效性检测完成!");
|
|
34777
34214
|
};
|
|
34778
|
-
const
|
|
34779
|
-
|
|
34780
|
-
|
|
34781
|
-
|
|
34782
|
-
|
|
34783
|
-
|
|
34784
|
-
|
|
34785
|
-
|
|
34786
|
-
|
|
34787
|
-
platform: process.platform,
|
|
34788
|
-
memoryUsage: {
|
|
34789
|
-
heapUsed: `${Math.round(process.memoryUsage().heapUsed / 1024 / 1024)} MB`,
|
|
34790
|
-
heapTotal: `${Math.round(process.memoryUsage().heapTotal / 1024 / 1024)} MB`
|
|
34791
|
-
},
|
|
34792
|
-
accountId: params.accountId,
|
|
34793
|
-
hasProxy: !!params.proxyLoc
|
|
34794
|
-
});
|
|
34795
|
-
}
|
|
34796
|
-
const check = {
|
|
34797
|
-
isValidSession: false,
|
|
34798
|
-
isValidWebSession: false
|
|
34799
|
-
};
|
|
34800
|
-
const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
|
|
34801
|
-
if (!a1Cookie) return {
|
|
34802
|
-
code: 414,
|
|
34803
|
-
message: "账号数据异常,请重新绑定账号后重试。",
|
|
34804
|
-
data: check
|
|
34805
|
-
};
|
|
34215
|
+
const DouyinCreateCommentReplyParamsSchema = ActionCommonParamsSchema.extend({
|
|
34216
|
+
itemId: classic_schemas_string(),
|
|
34217
|
+
commentId: classic_schemas_string(),
|
|
34218
|
+
text: classic_schemas_string()
|
|
34219
|
+
});
|
|
34220
|
+
const { getABogus: douyinCreateCommentReply_getABogus } = __webpack_require__("./src/utils/douyin/douyinSafe/a_bogus.js");
|
|
34221
|
+
const { generateCsrfTokenAdvanced: douyinCreateCommentReply_generateCsrfTokenAdvanced } = __webpack_require__("./src/utils/douyin/douyinSafe/csrfToken.js");
|
|
34222
|
+
const douyinCreateCommentReply = async (_task, params)=>{
|
|
34223
|
+
const userAgent = params.userAgent || "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.38";
|
|
34806
34224
|
const headers = {
|
|
34807
34225
|
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
34808
|
-
|
|
34226
|
+
origin: "https://creator.douyin.com",
|
|
34227
|
+
referer: "https://creator.douyin.com/",
|
|
34228
|
+
Accept: "application/json, text/plain, */*",
|
|
34229
|
+
"Accept-Encoding": "gzip, deflate, br, zstd",
|
|
34230
|
+
"Content-Type": "application/json",
|
|
34231
|
+
pragma: "no-cache",
|
|
34232
|
+
"cache-control": "no-cache",
|
|
34233
|
+
"sec-ch-ua-platform": params.extraParam?.browserInfo?.["sec-ch-ua-platform"] || "",
|
|
34234
|
+
"sec-ch-ua": params.extraParam?.browserInfo?.["sec-ch-ua"] || "",
|
|
34235
|
+
"sec-ch-ua-mobile": "?0",
|
|
34236
|
+
"user-agent": userAgent,
|
|
34237
|
+
"sec-fetch-site": "same-origin",
|
|
34238
|
+
"sec-fetch-mode": "cors",
|
|
34239
|
+
"sec-fetch-dest": "empty",
|
|
34240
|
+
"accept-language": "zh-CN,zh;q=0.9",
|
|
34241
|
+
priority: "u=1, i"
|
|
34809
34242
|
};
|
|
34810
34243
|
const args = [
|
|
34811
34244
|
{
|
|
@@ -34813,452 +34246,14 @@ var __webpack_exports__ = {};
|
|
|
34813
34246
|
},
|
|
34814
34247
|
_task.logger,
|
|
34815
34248
|
params.proxyLoc,
|
|
34816
|
-
params.accountId
|
|
34817
|
-
"xiaohongshu"
|
|
34249
|
+
params.accountId
|
|
34818
34250
|
];
|
|
34819
34251
|
const http = new Http(...args);
|
|
34820
|
-
|
|
34821
|
-
|
|
34822
|
-
|
|
34823
|
-
|
|
34824
|
-
|
|
34825
|
-
};
|
|
34826
|
-
});
|
|
34827
|
-
const loginBasePath = "/api/galaxy/v2/creator/datacenter/account/base";
|
|
34828
|
-
const recordCookie = params.cookies.reduce((acc, cookie)=>{
|
|
34829
|
-
if (cookie.name && cookie.value) acc[cookie.name] = cookie.value;
|
|
34830
|
-
return acc;
|
|
34831
|
-
}, {});
|
|
34832
|
-
let loginBaseXsHeader;
|
|
34833
|
-
try {
|
|
34834
|
-
loginBaseXsHeader = sessionCheck_xsEncrypt.signHeadersGet(loginBasePath, recordCookie, "xhs-pc-web", null);
|
|
34835
|
-
} catch (signError) {
|
|
34836
|
-
_task.logger?.error("[XhsSessionCheck] 签名生成失败 - 环境快照", {
|
|
34837
|
-
accountId: params.accountId,
|
|
34838
|
-
error: signError instanceof Error ? signError.message : String(signError),
|
|
34839
|
-
stack: _task.debug ? signError instanceof Error ? signError.stack : void 0 : void 0,
|
|
34840
|
-
hasA1: !!recordCookie.a1,
|
|
34841
|
-
env: {
|
|
34842
|
-
processType: process.type,
|
|
34843
|
-
memoryUsage: {
|
|
34844
|
-
heapUsed: `${Math.round(process.memoryUsage().heapUsed / 1024 / 1024)} MB`,
|
|
34845
|
-
heapTotal: `${Math.round(process.memoryUsage().heapTotal / 1024 / 1024)} MB`
|
|
34846
|
-
},
|
|
34847
|
-
hasProxy: !!params.proxyLoc,
|
|
34848
|
-
timeSinceLastLog: Date.now() - lastEnvLogTime
|
|
34849
|
-
}
|
|
34850
|
-
});
|
|
34851
|
-
return {
|
|
34852
|
-
code: 500,
|
|
34853
|
-
message: "账号签名生成失败,请稍后重试。",
|
|
34854
|
-
data: check
|
|
34855
|
-
};
|
|
34856
|
-
}
|
|
34857
|
-
const baseInfoStart = Date.now();
|
|
34858
|
-
const _baseInfo = http.api({
|
|
34859
|
-
method: "get",
|
|
34860
|
-
baseURL: "https://creator.xiaohongshu.com",
|
|
34861
|
-
url: loginBasePath,
|
|
34862
|
-
headers: loginBaseXsHeader
|
|
34863
|
-
}, {
|
|
34864
|
-
retries: 3,
|
|
34865
|
-
retryDelay: 300,
|
|
34866
|
-
timeout: 30000
|
|
34867
|
-
}).catch((e)=>{
|
|
34868
|
-
const clientTimestamp = Date.now();
|
|
34869
|
-
const serverDate = e?.extra?.serverDate;
|
|
34870
|
-
const serverTimestamp = serverDate ? new Date(serverDate).getTime() : null;
|
|
34871
|
-
const timeDriftMs = serverTimestamp ? clientTimestamp - serverTimestamp : null;
|
|
34872
|
-
_task.logger?.warn("[XhsSessionCheck] creator base 接口请求失败", {
|
|
34873
|
-
accountId: params.accountId,
|
|
34874
|
-
duration: Date.now() - baseInfoStart,
|
|
34875
|
-
code: e?.code,
|
|
34876
|
-
message: e?.message,
|
|
34877
|
-
data: e?.data,
|
|
34878
|
-
extra: e?.extra,
|
|
34879
|
-
proxyInfo: http.proxyInfo,
|
|
34880
|
-
clientTimestamp,
|
|
34881
|
-
serverDate,
|
|
34882
|
-
serverTimestamp,
|
|
34883
|
-
timeDriftMs,
|
|
34884
|
-
isLikelyClockDrift: null !== timeDriftMs && Math.abs(timeDriftMs) > 300000
|
|
34885
|
-
});
|
|
34886
|
-
return e.data;
|
|
34887
|
-
});
|
|
34888
|
-
const webSessionPath = "/api/sns/web/unread_count";
|
|
34889
|
-
const webSessionData = {};
|
|
34890
|
-
const webSessionXsHeader = sessionCheck_xsEncrypt.signHeadersPost(webSessionPath, recordCookie, "xhs-pc-web", webSessionData);
|
|
34891
|
-
const _web_session = http.api({
|
|
34892
|
-
method: "GET",
|
|
34893
|
-
url: "https://edith.xiaohongshu.com/api/sns/web/unread_count",
|
|
34894
|
-
data: webSessionData,
|
|
34895
|
-
headers: webSessionXsHeader
|
|
34896
|
-
}, {
|
|
34897
|
-
retries: 3,
|
|
34898
|
-
retryDelay: 300,
|
|
34899
|
-
timeout: 30000
|
|
34900
|
-
});
|
|
34901
|
-
const [baseInfo, web_session] = await Promise.all([
|
|
34902
|
-
_baseInfo,
|
|
34903
|
-
_web_session
|
|
34904
|
-
]);
|
|
34905
|
-
if (baseInfo?.code === 0) check.isValidSession = true;
|
|
34906
|
-
if (web_session?.code === 0) check.isValidWebSession = true;
|
|
34907
|
-
baseInfo?.code, web_session?.code;
|
|
34908
|
-
const message = `小红书账号有效性检测成功${_task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
34909
|
-
return success(check, message);
|
|
34910
|
-
};
|
|
34911
|
-
const BjhSessionCheck = async (_task, params)=>{
|
|
34912
|
-
const http = new Http({
|
|
34913
|
-
headers: {
|
|
34914
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
34915
|
-
token: params.token,
|
|
34916
|
-
referer: "https://baijiahao.baidu.com/builder/rc/home"
|
|
34917
|
-
}
|
|
34918
|
-
});
|
|
34919
|
-
const res = await http.api({
|
|
34920
|
-
method: "get",
|
|
34921
|
-
url: "https://baijiahao.baidu.com/user-ui/cms/settingInfo",
|
|
34922
|
-
defaultErrorMsg: "百家号登录状态失效。"
|
|
34923
|
-
});
|
|
34924
|
-
const isSuccess = 0 === res.errno;
|
|
34925
|
-
const message = "百家号账号有效性检测成功";
|
|
34926
|
-
const data = isSuccess ? {
|
|
34927
|
-
isValidSession: true
|
|
34928
|
-
} : {
|
|
34929
|
-
isValidSession: false
|
|
34930
|
-
};
|
|
34931
|
-
return success(data, message);
|
|
34932
|
-
};
|
|
34933
|
-
const DySessionCheck = async (_task, params)=>{
|
|
34934
|
-
const http = new Http({
|
|
34935
|
-
headers: {
|
|
34936
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
34937
|
-
referer: "https://creator.douyin.com/"
|
|
34938
|
-
}
|
|
34939
|
-
});
|
|
34940
|
-
const res = await http.api({
|
|
34941
|
-
method: "get",
|
|
34942
|
-
url: "https://creator.douyin.com/aweme/v1/creator/user/info/",
|
|
34943
|
-
params: {
|
|
34944
|
-
_ts: Date.now()
|
|
34945
|
-
},
|
|
34946
|
-
defaultErrorMsg: "抖音登录状态失效。"
|
|
34947
|
-
});
|
|
34948
|
-
const isSuccess = 0 === res.status_code;
|
|
34949
|
-
const message = "抖音账号有效性检测成功";
|
|
34950
|
-
const data = isSuccess ? {
|
|
34951
|
-
isValidSession: true
|
|
34952
|
-
} : {
|
|
34953
|
-
isValidSession: false
|
|
34954
|
-
};
|
|
34955
|
-
return success(data, message);
|
|
34956
|
-
};
|
|
34957
|
-
const ShipinhaoSessionCheck = async (_task, params)=>{
|
|
34958
|
-
const http = new Http({
|
|
34959
|
-
headers: {
|
|
34960
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
34961
|
-
referer: "https://channels.weixin.qq.com",
|
|
34962
|
-
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
|
|
34963
|
-
"Content-Type": "application/json"
|
|
34964
|
-
}
|
|
34965
|
-
});
|
|
34966
|
-
const getTimeStamp = (length)=>Date.now().toString().substring(0, length);
|
|
34967
|
-
const requestBody = {
|
|
34968
|
-
timestamp: getTimeStamp(13),
|
|
34969
|
-
_log_finder_uin: "",
|
|
34970
|
-
_log_finder_id: "",
|
|
34971
|
-
rawKeyBuff: null,
|
|
34972
|
-
pluginSessionId: null,
|
|
34973
|
-
scene: 7,
|
|
34974
|
-
reqScene: 7
|
|
34975
|
-
};
|
|
34976
|
-
const res = await http.api({
|
|
34977
|
-
method: "post",
|
|
34978
|
-
url: "https://channels.weixin.qq.com/cgi-bin/mmfinderassistant-bin/auth/auth_data",
|
|
34979
|
-
data: requestBody,
|
|
34980
|
-
defaultErrorMsg: "视频号登录状态失效。"
|
|
34981
|
-
});
|
|
34982
|
-
const isSuccess = 0 === res.errCode && res.data?.finderUser !== void 0;
|
|
34983
|
-
const message = isSuccess ? "视频号账号有效性检测成功" : 300333 === res.errCode || 300334 === res.errCode ? "视频号登录已失效,请重新登录" : "视频号账号有效性检测失败";
|
|
34984
|
-
const data = isSuccess ? {
|
|
34985
|
-
isValidSession: true
|
|
34986
|
-
} : {
|
|
34987
|
-
isValidSession: false
|
|
34988
|
-
};
|
|
34989
|
-
return success(data, message);
|
|
34990
|
-
};
|
|
34991
|
-
const extractEncFileKey = (downloadUrl)=>{
|
|
34992
|
-
if (!downloadUrl) return "";
|
|
34993
|
-
return downloadUrl.split("encfilekey=")[1]?.split("&")[0] || "";
|
|
34994
|
-
};
|
|
34995
|
-
const rid = ()=>`${Math.floor(Date.now() / 1e3).toString(16)}-${[
|
|
34996
|
-
...Array(8)
|
|
34997
|
-
].map(()=>Math.floor(16 * Math.random()).toString(16)).join("")}`;
|
|
34998
|
-
new Uint8Array(16);
|
|
34999
|
-
const hexTable = [];
|
|
35000
|
-
for(let i = 0; i < 256; i++)hexTable.push((i + 256).toString(16).substr(1));
|
|
35001
|
-
const createShipinhaoComment = async (_task, params)=>{
|
|
35002
|
-
if (!params.content || "" === params.content.trim()) return utils_response(400, "评论内容不能为空", void 0);
|
|
35003
|
-
if (!params.exportId) return utils_response(400, "exportId 不能为空", void 0);
|
|
35004
|
-
if (!params.extraParam) return utils_response(400, "缺少 extraParam 参数", void 0);
|
|
35005
|
-
if (!params.extraParam.fingerPrintDeviceId || !params.extraParam.aId || !params.extraParam.uin) return utils_response(400, "fingerPrintDeviceId、aId和uin不能为空", void 0);
|
|
35006
|
-
const headers = {
|
|
35007
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
35008
|
-
referer: "https://channels.weixin.qq.com/micro/interaction/comment",
|
|
35009
|
-
origin: "https://channels.weixin.qq.com",
|
|
35010
|
-
"content-type": "application/json",
|
|
35011
|
-
"finger-print-device-id": params.extraParam.fingerPrintDeviceId,
|
|
35012
|
-
"x-wechat-uin": params.extraParam.uin
|
|
35013
|
-
};
|
|
35014
|
-
const http = new Http({
|
|
35015
|
-
headers
|
|
35016
|
-
});
|
|
35017
|
-
const urlParams = new URLSearchParams({
|
|
35018
|
-
_aid: params.extraParam.aId,
|
|
35019
|
-
_rid: rid(),
|
|
35020
|
-
_pageUrl: "https://channels.weixin.qq.com/micro/interaction/comment"
|
|
35021
|
-
}).toString();
|
|
35022
|
-
const requestData = {
|
|
35023
|
-
replyCommentId: params.replyCommentId || "",
|
|
35024
|
-
content: params.content,
|
|
35025
|
-
clientId: `${Date.now()}-${Math.random().toString(36).substring(2, 15)}`,
|
|
35026
|
-
rootCommentId: params.rootCommentId || "",
|
|
35027
|
-
comment: {},
|
|
35028
|
-
exportId: params.exportId,
|
|
35029
|
-
timestamp: Date.now().toString(),
|
|
35030
|
-
_log_finder_uin: "",
|
|
35031
|
-
_log_finder_id: params.extraParam.finderUserName || "",
|
|
35032
|
-
rawKeyBuff: null,
|
|
35033
|
-
pluginSessionId: null,
|
|
35034
|
-
scene: 7,
|
|
35035
|
-
reqScene: 7
|
|
35036
|
-
};
|
|
35037
|
-
if (params.rootCommentId) requestData.rootCommentId = params.rootCommentId;
|
|
35038
|
-
if (params.replyCommentId) requestData.replyCommentId = params.replyCommentId;
|
|
35039
|
-
const res = await http.api({
|
|
35040
|
-
method: "post",
|
|
35041
|
-
url: `https://channels.weixin.qq.com/micro/interaction/cgi-bin/mmfinderassistant-bin/comment/create_comment?${urlParams}`,
|
|
35042
|
-
data: requestData
|
|
35043
|
-
});
|
|
35044
|
-
console.log(res, "----create comment res");
|
|
35045
|
-
const isSuccess = res?.errCode === 0;
|
|
35046
|
-
return utils_response(isSuccess ? 0 : 414, res?.errMsg || "添加评论失败", res.data);
|
|
35047
|
-
};
|
|
35048
|
-
const { generateCsrfTokenAdvanced } = __webpack_require__("./src/utils/douyin/douyinSafe/csrfToken.js");
|
|
35049
|
-
const { getABogus } = __webpack_require__("./src/utils/douyin/douyinSafe/a_bogus.js");
|
|
35050
|
-
const { generateDtrait } = __webpack_require__("./src/utils/douyin/douyinSafe/dtrait.js");
|
|
35051
|
-
const DouyinCheckVerifyQrCodeParamsSchema = ActionCommonParamsSchema.extend({
|
|
35052
|
-
token: classic_schemas_string(),
|
|
35053
|
-
encrypt_uid: classic_schemas_string(),
|
|
35054
|
-
verify_scene: classic_schemas_string().optional(),
|
|
35055
|
-
verify_reason: classic_schemas_string().optional(),
|
|
35056
|
-
extraParam: classic_schemas_object({
|
|
35057
|
-
browserInfo: classic_schemas_object({
|
|
35058
|
-
screen_width: classic_schemas_string().optional(),
|
|
35059
|
-
screen_height: classic_schemas_string().optional(),
|
|
35060
|
-
browser_language: classic_schemas_string().optional(),
|
|
35061
|
-
browser_platform: classic_schemas_string().optional(),
|
|
35062
|
-
browser_name: classic_schemas_string().optional(),
|
|
35063
|
-
"sec-ch-ua-platform": classic_schemas_string().optional(),
|
|
35064
|
-
"sec-ch-ua": classic_schemas_string().optional(),
|
|
35065
|
-
userAgent: classic_schemas_string().optional()
|
|
35066
|
-
})
|
|
35067
|
-
}).optional()
|
|
35068
|
-
});
|
|
35069
|
-
function mergeSetCookies(oldCookies, setCookieHeader) {
|
|
35070
|
-
if (!setCookieHeader) return oldCookies;
|
|
35071
|
-
const setCookies = Array.isArray(setCookieHeader) ? setCookieHeader : [
|
|
35072
|
-
setCookieHeader
|
|
35073
|
-
];
|
|
35074
|
-
const cookieMap = new Map(oldCookies.map((c)=>[
|
|
35075
|
-
c.name,
|
|
35076
|
-
c
|
|
35077
|
-
]));
|
|
35078
|
-
for (const raw of setCookies){
|
|
35079
|
-
const parts = raw.split(";");
|
|
35080
|
-
const [nameValue] = parts;
|
|
35081
|
-
if (!nameValue) continue;
|
|
35082
|
-
const eqIdx = nameValue.indexOf("=");
|
|
35083
|
-
if (-1 === eqIdx) continue;
|
|
35084
|
-
const name = nameValue.slice(0, eqIdx).trim();
|
|
35085
|
-
const value = nameValue.slice(eqIdx + 1).trim();
|
|
35086
|
-
if (!name) continue;
|
|
35087
|
-
const attrs = {};
|
|
35088
|
-
for(let i = 1; i < parts.length; i++){
|
|
35089
|
-
const part = parts[i].trim();
|
|
35090
|
-
const attrEq = part.indexOf("=");
|
|
35091
|
-
if (-1 === attrEq) attrs[part.toLowerCase()] = true;
|
|
35092
|
-
else attrs[part.slice(0, attrEq).trim().toLowerCase()] = part.slice(attrEq + 1).trim();
|
|
35093
|
-
}
|
|
35094
|
-
const existing = cookieMap.get(name);
|
|
35095
|
-
cookieMap.set(name, {
|
|
35096
|
-
...existing || {},
|
|
35097
|
-
...attrs,
|
|
35098
|
-
name,
|
|
35099
|
-
value
|
|
35100
|
-
});
|
|
35101
|
-
}
|
|
35102
|
-
return Array.from(cookieMap.values());
|
|
35103
|
-
}
|
|
35104
|
-
const douyinCheckVerifyQrCode = async (task, params)=>{
|
|
35105
|
-
const userAgent = params.userAgent || "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.38";
|
|
35106
|
-
const bizTraceId = params.cookies.find((e)=>"biz_trace_id" === e.name)?.value || "00000000";
|
|
35107
|
-
const msToken = params.cookies.find((e)=>"msToken" === e.name)?.value || "";
|
|
35108
|
-
const passportCsrfToken = params.cookies.find((e)=>"passport_csrf_token" === e.name)?.value || "";
|
|
35109
|
-
try {
|
|
35110
|
-
task.logger.info(`[douyinCheckVerifyQrCode] 开始轮询二维码状态, token=${params.token}`);
|
|
35111
|
-
const headers = {
|
|
35112
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
35113
|
-
origin: "https://creator.douyin.com",
|
|
35114
|
-
referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
|
|
35115
|
-
Accept: "application/json, text/plain, */*",
|
|
35116
|
-
"Accept-Encoding": "gzip, deflate, br, zstd",
|
|
35117
|
-
"sec-ch-ua-platform": params.extraParam?.browserInfo?.["sec-ch-ua-platform"] || "",
|
|
35118
|
-
"sec-ch-ua": params.extraParam?.browserInfo?.["sec-ch-ua"] || "",
|
|
35119
|
-
"sec-ch-ua-mobile": "?0",
|
|
35120
|
-
"user-agent": userAgent,
|
|
35121
|
-
"sec-fetch-site": "same-origin",
|
|
35122
|
-
"sec-fetch-mode": "cors",
|
|
35123
|
-
"sec-fetch-dest": "empty",
|
|
35124
|
-
"accept-language": "zh-CN,zh;q=0.9",
|
|
35125
|
-
priority: "u=1, i"
|
|
35126
|
-
};
|
|
35127
|
-
const checkBody = {
|
|
35128
|
-
encrypt_uid: params.encrypt_uid || "",
|
|
35129
|
-
verify_ticket: "",
|
|
35130
|
-
copywriting_key: "creator",
|
|
35131
|
-
new_verify_flow: "",
|
|
35132
|
-
aid: "2906",
|
|
35133
|
-
token: params.token,
|
|
35134
|
-
verify_type: "",
|
|
35135
|
-
need_record: "1",
|
|
35136
|
-
scene: "secondary_verify",
|
|
35137
|
-
verify_scene: params.verify_scene || "creator",
|
|
35138
|
-
verify_reason: params.verify_reason || "gateway_web_authlv_check",
|
|
35139
|
-
std_verify_way: "qr_code_verify",
|
|
35140
|
-
new_authn_sdk_version: "1.0.0.404-web"
|
|
35141
|
-
};
|
|
35142
|
-
const checkBodyStr = new URLSearchParams(checkBody).toString();
|
|
35143
|
-
const checkQueryParams = {
|
|
35144
|
-
passport_jssdk_version: "5.1.2",
|
|
35145
|
-
passport_jssdk_type: "lite",
|
|
35146
|
-
is_from_ttaccountsdk: "1",
|
|
35147
|
-
aid: "2906",
|
|
35148
|
-
language: "zh",
|
|
35149
|
-
account_app_language: "zh-CN",
|
|
35150
|
-
new_authn_sdk_version: "1.0.0.404-web",
|
|
35151
|
-
is_vcd: "1",
|
|
35152
|
-
biz_trace_id: bizTraceId,
|
|
35153
|
-
msToken,
|
|
35154
|
-
a_bogus: ""
|
|
35155
|
-
};
|
|
35156
|
-
const checkQueryStr = new URLSearchParams(checkQueryParams).toString();
|
|
35157
|
-
const checkUrl = `https://creator.douyin.com/passport/mobile/validate_by_qrcode/?${checkQueryStr}`;
|
|
35158
|
-
const aBogus = getABogus(checkUrl, checkBodyStr, userAgent);
|
|
35159
|
-
checkQueryParams.a_bogus = aBogus;
|
|
35160
|
-
const finalQueryStr = new URLSearchParams(checkQueryParams).toString();
|
|
35161
|
-
const csrfToken = generateCsrfTokenAdvanced({
|
|
35162
|
-
cookies: params.cookies,
|
|
35163
|
-
url: "https://creator.douyin.com/passport/mobile/validate_by_qrcode/",
|
|
35164
|
-
method: "POST",
|
|
35165
|
-
userAgent
|
|
35166
|
-
});
|
|
35167
|
-
const sessionDtrait = generateDtrait("/passport/mobile/validate_by_qrcode/");
|
|
35168
|
-
let rawSetCookie;
|
|
35169
|
-
const checkHttp = new Http({
|
|
35170
|
-
headers: {
|
|
35171
|
-
...headers,
|
|
35172
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
35173
|
-
"x-secsdk-csrf-token": csrfToken,
|
|
35174
|
-
"x-tt-passport-csrf-token": passportCsrfToken,
|
|
35175
|
-
"x-tt-passport-trace-id": bizTraceId,
|
|
35176
|
-
"x-tt-passport-verify-portrait": "",
|
|
35177
|
-
"x-tt-session-dtrait": sessionDtrait || ""
|
|
35178
|
-
}
|
|
35179
|
-
});
|
|
35180
|
-
checkHttp.addResponseInterceptor((res)=>{
|
|
35181
|
-
task.logger.info(`[douyinCheckVerifyQrCode] 原始响应 status=${res.status} data=${JSON.stringify(res.data)}`);
|
|
35182
|
-
console.log("[douyinCheckVerifyQrCode] 原始响应:", JSON.stringify(res.data));
|
|
35183
|
-
rawSetCookie = res.headers["set-cookie"];
|
|
35184
|
-
});
|
|
35185
|
-
const checkResponse = await checkHttp.api({
|
|
35186
|
-
method: "post",
|
|
35187
|
-
url: `https://creator.douyin.com/passport/mobile/validate_by_qrcode/?${finalQueryStr}`,
|
|
35188
|
-
data: checkBodyStr
|
|
35189
|
-
}, {
|
|
35190
|
-
timeout: 10000
|
|
35191
|
-
});
|
|
35192
|
-
const data = checkResponse?.data;
|
|
35193
|
-
const status = data?.status;
|
|
35194
|
-
task.logger.info(`[douyinCheckVerifyQrCode] status=${status}`);
|
|
35195
|
-
const updatedCookies = mergeSetCookies(params.cookies, rawSetCookie);
|
|
35196
|
-
if ("new" === status) return utils_response(0, "二维码等待扫描", data);
|
|
35197
|
-
if ("scanned" === status) return utils_response(0, "二维码已扫码,待确认扫描", data);
|
|
35198
|
-
if ("confirmed" === status) return utils_response(0, "扫码验证成功", {
|
|
35199
|
-
status: "confirmed",
|
|
35200
|
-
redirect_url: data.redirect_url || "",
|
|
35201
|
-
ticket: data.ticket || "",
|
|
35202
|
-
cookies: updatedCookies
|
|
35203
|
-
});
|
|
35204
|
-
if ("expired" === status) return utils_response(0, "二维码已过期", {
|
|
35205
|
-
status: "expired",
|
|
35206
|
-
token: data.token || "",
|
|
35207
|
-
qrcode: data.qrcode || "",
|
|
35208
|
-
qrcode_index_url: data.qrcode_index_url || "",
|
|
35209
|
-
expire_time: data.expire_time || 0,
|
|
35210
|
-
app_name: data.app_name || "",
|
|
35211
|
-
web_name: data.web_name || ""
|
|
35212
|
-
});
|
|
35213
|
-
return utils_response(414, `未知二维码状态: ${status}`, "");
|
|
35214
|
-
} catch (err) {
|
|
35215
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
35216
|
-
task.logger.warn(`[douyinCheckVerifyQrCode] 请求失败: ${msg}`);
|
|
35217
|
-
return utils_response(500, `校验二维码失败: ${msg}`, "");
|
|
35218
|
-
}
|
|
35219
|
-
};
|
|
35220
|
-
const DouyinCreateCommentReplyParamsSchema = ActionCommonParamsSchema.extend({
|
|
35221
|
-
itemId: classic_schemas_string(),
|
|
35222
|
-
commentId: classic_schemas_string(),
|
|
35223
|
-
text: classic_schemas_string()
|
|
35224
|
-
});
|
|
35225
|
-
const { getABogus: douyinCreateCommentReply_getABogus } = __webpack_require__("./src/utils/douyin/douyinSafe/a_bogus.js");
|
|
35226
|
-
const { generateCsrfTokenAdvanced: douyinCreateCommentReply_generateCsrfTokenAdvanced } = __webpack_require__("./src/utils/douyin/douyinSafe/csrfToken.js");
|
|
35227
|
-
const douyinCreateCommentReply = async (_task, params)=>{
|
|
35228
|
-
const userAgent = params.userAgent || "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.38";
|
|
35229
|
-
const headers = {
|
|
35230
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
35231
|
-
origin: "https://creator.douyin.com",
|
|
35232
|
-
referer: "https://creator.douyin.com/",
|
|
35233
|
-
Accept: "application/json, text/plain, */*",
|
|
35234
|
-
"Accept-Encoding": "gzip, deflate, br, zstd",
|
|
35235
|
-
"Content-Type": "application/json",
|
|
35236
|
-
pragma: "no-cache",
|
|
35237
|
-
"cache-control": "no-cache",
|
|
35238
|
-
"sec-ch-ua-platform": params.extraParam?.browserInfo?.["sec-ch-ua-platform"] || "",
|
|
35239
|
-
"sec-ch-ua": params.extraParam?.browserInfo?.["sec-ch-ua"] || "",
|
|
35240
|
-
"sec-ch-ua-mobile": "?0",
|
|
35241
|
-
"user-agent": userAgent,
|
|
35242
|
-
"sec-fetch-site": "same-origin",
|
|
35243
|
-
"sec-fetch-mode": "cors",
|
|
35244
|
-
"sec-fetch-dest": "empty",
|
|
35245
|
-
"accept-language": "zh-CN,zh;q=0.9",
|
|
35246
|
-
priority: "u=1, i"
|
|
35247
|
-
};
|
|
35248
|
-
const args = [
|
|
35249
|
-
{
|
|
35250
|
-
headers
|
|
35251
|
-
},
|
|
35252
|
-
_task.logger,
|
|
35253
|
-
params.proxyLoc,
|
|
35254
|
-
params.accountId
|
|
35255
|
-
];
|
|
35256
|
-
const http = new Http(...args);
|
|
35257
|
-
const csrfToken = douyinCreateCommentReply_generateCsrfTokenAdvanced({
|
|
35258
|
-
cookies: params.cookies,
|
|
35259
|
-
url: "https://creator.douyin.com/aweme/v1/creator/comment/reply/",
|
|
35260
|
-
method: "POST",
|
|
35261
|
-
userAgent
|
|
34252
|
+
const csrfToken = douyinCreateCommentReply_generateCsrfTokenAdvanced({
|
|
34253
|
+
cookies: params.cookies,
|
|
34254
|
+
url: "https://creator.douyin.com/aweme/v1/creator/comment/reply/",
|
|
34255
|
+
method: "POST",
|
|
34256
|
+
userAgent
|
|
35262
34257
|
});
|
|
35263
34258
|
const queryParams = {
|
|
35264
34259
|
read_aid: "2906",
|
|
@@ -40328,125 +39323,1088 @@ var __webpack_exports__ = {};
|
|
|
40328
39323
|
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
40329
39324
|
referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
|
|
40330
39325
|
}
|
|
40331
|
-
});
|
|
40332
|
-
const res = await http.api({
|
|
40333
|
-
method: "get",
|
|
40334
|
-
url: "https://mp.toutiao.com/mp/fe_api/collection/list",
|
|
40335
|
-
params: {
|
|
40336
|
-
page_num: 0,
|
|
40337
|
-
page_size: 100,
|
|
40338
|
-
need_sub_item_count: true
|
|
39326
|
+
});
|
|
39327
|
+
const res = await http.api({
|
|
39328
|
+
method: "get",
|
|
39329
|
+
url: "https://mp.toutiao.com/mp/fe_api/collection/list",
|
|
39330
|
+
params: {
|
|
39331
|
+
page_num: 0,
|
|
39332
|
+
page_size: 100,
|
|
39333
|
+
need_sub_item_count: true
|
|
39334
|
+
}
|
|
39335
|
+
});
|
|
39336
|
+
return success(0 === res.code ? res.data : [], 0 === res.code ? "获取头条号合集成功!" : "获取头条号合集失败!");
|
|
39337
|
+
};
|
|
39338
|
+
const getToutiaoConfig = async (_task, params)=>{
|
|
39339
|
+
const cookies = params.cookies ?? [];
|
|
39340
|
+
const http = new Http({
|
|
39341
|
+
headers: {
|
|
39342
|
+
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
39343
|
+
referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
|
|
39344
|
+
}
|
|
39345
|
+
});
|
|
39346
|
+
const getSuggestWords = async ()=>{
|
|
39347
|
+
try {
|
|
39348
|
+
const res = await http.api({
|
|
39349
|
+
method: "get",
|
|
39350
|
+
url: "https://mp.toutiao.com/mp/agw/creator_helper/suggest_words",
|
|
39351
|
+
params: {
|
|
39352
|
+
type: 2,
|
|
39353
|
+
words: ""
|
|
39354
|
+
}
|
|
39355
|
+
});
|
|
39356
|
+
return 0 === res.code ? res.hots : [];
|
|
39357
|
+
} catch (_error) {
|
|
39358
|
+
return [];
|
|
39359
|
+
}
|
|
39360
|
+
};
|
|
39361
|
+
const getCityDistrict = async ()=>{
|
|
39362
|
+
try {
|
|
39363
|
+
const res = await http.api({
|
|
39364
|
+
method: "get",
|
|
39365
|
+
url: "https://mp.toutiao.com/toutiao/normandy/mp/city_district/"
|
|
39366
|
+
});
|
|
39367
|
+
return 0 === res.status ? res.data : null;
|
|
39368
|
+
} catch (_error) {
|
|
39369
|
+
return null;
|
|
39370
|
+
}
|
|
39371
|
+
};
|
|
39372
|
+
const getUserRights = async ()=>{
|
|
39373
|
+
try {
|
|
39374
|
+
const res = await http.api({
|
|
39375
|
+
method: "get",
|
|
39376
|
+
url: "https://mp.toutiao.com/mp/agw/creator_project/get_benefit_page_info"
|
|
39377
|
+
});
|
|
39378
|
+
return 0 === res.code ? res.data.benefit_level_info_list : [];
|
|
39379
|
+
} catch (_error) {
|
|
39380
|
+
return [];
|
|
39381
|
+
}
|
|
39382
|
+
};
|
|
39383
|
+
const [suggestWords, cityDistrict, userRights] = await Promise.all([
|
|
39384
|
+
getSuggestWords(),
|
|
39385
|
+
getCityDistrict(),
|
|
39386
|
+
getUserRights()
|
|
39387
|
+
]);
|
|
39388
|
+
return success({
|
|
39389
|
+
suggestWords,
|
|
39390
|
+
cityDistrict,
|
|
39391
|
+
userRights
|
|
39392
|
+
});
|
|
39393
|
+
};
|
|
39394
|
+
const getWeixinCollection = async (_task, params)=>{
|
|
39395
|
+
const http = new Http({
|
|
39396
|
+
headers: {
|
|
39397
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
39398
|
+
}
|
|
39399
|
+
});
|
|
39400
|
+
const fingerprint = "4695500bc93ab4ce8fb2692da6564e04";
|
|
39401
|
+
const res = await http.api({
|
|
39402
|
+
method: "get",
|
|
39403
|
+
url: "https://mp.weixin.qq.com/cgi-bin/appmsgalbummgr",
|
|
39404
|
+
params: {
|
|
39405
|
+
action: "list",
|
|
39406
|
+
begin: 0,
|
|
39407
|
+
count: 100,
|
|
39408
|
+
sub_title: "",
|
|
39409
|
+
type: 0,
|
|
39410
|
+
latest: 1,
|
|
39411
|
+
need_pay: 0,
|
|
39412
|
+
fingerprint,
|
|
39413
|
+
token: params.token,
|
|
39414
|
+
lang: "zh_CN",
|
|
39415
|
+
f: "json",
|
|
39416
|
+
ajax: 1
|
|
39417
|
+
}
|
|
39418
|
+
});
|
|
39419
|
+
return success(res.list_resp?.items ?? [], 0 === res.base_resp.ret ? "微信合计信息获取成功!" : "微信合集信息获取失败!");
|
|
39420
|
+
};
|
|
39421
|
+
const getWeixinConfig = async (_task, params)=>{
|
|
39422
|
+
const http = new Http({
|
|
39423
|
+
headers: {
|
|
39424
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
39425
|
+
}
|
|
39426
|
+
});
|
|
39427
|
+
const fingerprint = "4695500bc93ab4ce8fb2692da6564e04";
|
|
39428
|
+
const res = await http.api({
|
|
39429
|
+
method: "get",
|
|
39430
|
+
url: "https://mp.weixin.qq.com/cgi-bin/masssendpage",
|
|
39431
|
+
params: {
|
|
39432
|
+
f: "json",
|
|
39433
|
+
token: params.token,
|
|
39434
|
+
lang: "zh_CN",
|
|
39435
|
+
ajax: 1,
|
|
39436
|
+
fingerprint: fingerprint,
|
|
39437
|
+
random: Math.random().toString()
|
|
39438
|
+
}
|
|
39439
|
+
});
|
|
39440
|
+
const filtered = {
|
|
39441
|
+
publishQuota: 0 === res.base_resp.ret ? res.quota_detail_list.filter((item)=>"kQuotaTypeMassSendNormal" === item.quota_type).map((item)=>item.quota_item_list) : []
|
|
39442
|
+
};
|
|
39443
|
+
return success(filtered, 0 === res.base_resp.ret ? "微信配置信息获取成功!" : "微信配置信息获取失败!");
|
|
39444
|
+
};
|
|
39445
|
+
class CryptoConfig {
|
|
39446
|
+
static{
|
|
39447
|
+
this.MAX_32BIT = 0xFFFFFFFF;
|
|
39448
|
+
}
|
|
39449
|
+
static{
|
|
39450
|
+
this.MAX_SIGNED_32BIT = 0x7FFFFFFF;
|
|
39451
|
+
}
|
|
39452
|
+
static{
|
|
39453
|
+
this.MAX_BYTE = 255;
|
|
39454
|
+
}
|
|
39455
|
+
static{
|
|
39456
|
+
this.STANDARD_BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
39457
|
+
}
|
|
39458
|
+
static{
|
|
39459
|
+
this.CUSTOM_BASE64_ALPHABET = "ZmserbBoHQtNP+wOcza/LpngG8yJq42KWYj0DSfdikx3VT16IlUAFM97hECvuRX5";
|
|
39460
|
+
}
|
|
39461
|
+
static{
|
|
39462
|
+
this.X3_BASE64_ALPHABET = "MfgqrsbcyzPQRStuvC7mn501HIJBo2DEFTKdeNOwxWXYZap89+/A4UVLhijkl63G";
|
|
39463
|
+
}
|
|
39464
|
+
static{
|
|
39465
|
+
this.HEX_KEY = "71a302257793271ddd273bcee3e4b98d9d7935e1da33f5765e2ea8afb6dc77a51a499d23b67c20660025860cbf13d4540d92497f58686c574e508f46e1956344f39139bf4faf22a3eef120b79258145b2feb5193b6478669961298e79bedca646e1a693a926154a5a7a1bd1cf0dedb742f917a747a1e388b234f2277";
|
|
39466
|
+
}
|
|
39467
|
+
static{
|
|
39468
|
+
this.EXPECTED_HEX_LENGTH = 32;
|
|
39469
|
+
}
|
|
39470
|
+
static{
|
|
39471
|
+
this.OUTPUT_BYTE_COUNT = 8;
|
|
39472
|
+
}
|
|
39473
|
+
static{
|
|
39474
|
+
this.HEX_CHUNK_SIZE = 2;
|
|
39475
|
+
}
|
|
39476
|
+
static{
|
|
39477
|
+
this.VERSION_BYTES = [
|
|
39478
|
+
119,
|
|
39479
|
+
104,
|
|
39480
|
+
96,
|
|
39481
|
+
41
|
|
39482
|
+
];
|
|
39483
|
+
}
|
|
39484
|
+
static{
|
|
39485
|
+
this.SEQUENCE_VALUE_MIN = 15;
|
|
39486
|
+
}
|
|
39487
|
+
static{
|
|
39488
|
+
this.SEQUENCE_VALUE_MAX = 50;
|
|
39489
|
+
}
|
|
39490
|
+
static{
|
|
39491
|
+
this.WINDOW_PROPS_LENGTH_MIN = 900;
|
|
39492
|
+
}
|
|
39493
|
+
static{
|
|
39494
|
+
this.WINDOW_PROPS_LENGTH_MAX = 1200;
|
|
39495
|
+
}
|
|
39496
|
+
static{
|
|
39497
|
+
this.CHECKSUM_VERSION = 1;
|
|
39498
|
+
}
|
|
39499
|
+
static{
|
|
39500
|
+
this.CHECKSUM_XOR_KEY = 115;
|
|
39501
|
+
}
|
|
39502
|
+
static{
|
|
39503
|
+
this.CHECKSUM_FIXED_TAIL = [
|
|
39504
|
+
249,
|
|
39505
|
+
65,
|
|
39506
|
+
103,
|
|
39507
|
+
103,
|
|
39508
|
+
201,
|
|
39509
|
+
181,
|
|
39510
|
+
131,
|
|
39511
|
+
99,
|
|
39512
|
+
94,
|
|
39513
|
+
7,
|
|
39514
|
+
68,
|
|
39515
|
+
250,
|
|
39516
|
+
132,
|
|
39517
|
+
21
|
|
39518
|
+
];
|
|
39519
|
+
}
|
|
39520
|
+
static{
|
|
39521
|
+
this.ENV_FINGERPRINT_XOR_KEY = 41;
|
|
39522
|
+
}
|
|
39523
|
+
static{
|
|
39524
|
+
this.ENV_FINGERPRINT_TIME_OFFSET_MIN = 10;
|
|
39525
|
+
}
|
|
39526
|
+
static{
|
|
39527
|
+
this.ENV_FINGERPRINT_TIME_OFFSET_MAX = 50;
|
|
39528
|
+
}
|
|
39529
|
+
static{
|
|
39530
|
+
this.SIGNATURE_DATA_TEMPLATE = {
|
|
39531
|
+
x0: "4.2.6",
|
|
39532
|
+
x1: "xhs-pc-web",
|
|
39533
|
+
x2: "Windows",
|
|
39534
|
+
x3: "",
|
|
39535
|
+
x4: ""
|
|
39536
|
+
};
|
|
39537
|
+
}
|
|
39538
|
+
static{
|
|
39539
|
+
this.X3_PREFIX = "mns0301_";
|
|
39540
|
+
}
|
|
39541
|
+
static{
|
|
39542
|
+
this.XYS_PREFIX = "XYS_";
|
|
39543
|
+
}
|
|
39544
|
+
static{
|
|
39545
|
+
this.HEX_CHARS = "abcdef0123456789";
|
|
39546
|
+
}
|
|
39547
|
+
static{
|
|
39548
|
+
this.XRAY_TRACE_ID_SEQ_MAX = 8388607;
|
|
39549
|
+
}
|
|
39550
|
+
static{
|
|
39551
|
+
this.XRAY_TRACE_ID_TIMESTAMP_SHIFT = 23;
|
|
39552
|
+
}
|
|
39553
|
+
static{
|
|
39554
|
+
this.B3_TRACE_ID_LENGTH = 16;
|
|
39555
|
+
}
|
|
39556
|
+
static{
|
|
39557
|
+
this.PUBLIC_USERAGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0";
|
|
39558
|
+
}
|
|
39559
|
+
static{
|
|
39560
|
+
this.SIGNATURE_XSCOMMON_TEMPLATE = {
|
|
39561
|
+
s0: 5,
|
|
39562
|
+
s1: "",
|
|
39563
|
+
x0: "1",
|
|
39564
|
+
x1: "4.2.6",
|
|
39565
|
+
x2: "Windows",
|
|
39566
|
+
x3: "xhs-pc-web",
|
|
39567
|
+
x4: "4.86.0",
|
|
39568
|
+
x5: "",
|
|
39569
|
+
x6: "",
|
|
39570
|
+
x7: "",
|
|
39571
|
+
x8: "",
|
|
39572
|
+
x9: -596800761,
|
|
39573
|
+
x10: 0,
|
|
39574
|
+
x11: "normal"
|
|
39575
|
+
};
|
|
39576
|
+
}
|
|
39577
|
+
}
|
|
39578
|
+
class BitOperations {
|
|
39579
|
+
normalizeTo32bit(value) {
|
|
39580
|
+
return value & this.config.MAX_32BIT;
|
|
39581
|
+
}
|
|
39582
|
+
xorTransformArray(inputArray) {
|
|
39583
|
+
const keyBytes = this.hexStringToBytes(this.config.HEX_KEY);
|
|
39584
|
+
const result = new Uint8Array(inputArray.length);
|
|
39585
|
+
for(let i = 0; i < inputArray.length; i++)result[i] = inputArray[i] ^ keyBytes[i % keyBytes.length];
|
|
39586
|
+
return result;
|
|
39587
|
+
}
|
|
39588
|
+
hexStringToBytes(hexString) {
|
|
39589
|
+
const bytes = [];
|
|
39590
|
+
for(let i = 0; i < hexString.length; i += 2)bytes.push(parseInt(hexString.substr(i, 2), 16));
|
|
39591
|
+
return bytes;
|
|
39592
|
+
}
|
|
39593
|
+
constructor(){
|
|
39594
|
+
this.config = CryptoConfig;
|
|
39595
|
+
}
|
|
39596
|
+
}
|
|
39597
|
+
class RandomGenerator {
|
|
39598
|
+
generateRandomBytes(byteCount) {
|
|
39599
|
+
const result = [];
|
|
39600
|
+
for(let i = 0; i < byteCount; i++)result.push(Math.floor(Math.random() * (this.config.MAX_BYTE + 1)));
|
|
39601
|
+
return result;
|
|
39602
|
+
}
|
|
39603
|
+
generateRandomByteInRange(minVal, maxVal) {
|
|
39604
|
+
return Math.floor(Math.random() * (maxVal - minVal + 1)) + minVal;
|
|
39605
|
+
}
|
|
39606
|
+
generateRandomInt() {
|
|
39607
|
+
return Math.floor(Math.random() * (this.config.MAX_32BIT + 1));
|
|
39608
|
+
}
|
|
39609
|
+
generateB3TraceId() {
|
|
39610
|
+
let result = '';
|
|
39611
|
+
for(let i = 0; i < this.config.B3_TRACE_ID_LENGTH; i++)result += this.config.HEX_CHARS[Math.floor(Math.random() * this.config.HEX_CHARS.length)];
|
|
39612
|
+
return result;
|
|
39613
|
+
}
|
|
39614
|
+
generateXrayTraceId(timestamp, seq) {
|
|
39615
|
+
if (void 0 === timestamp) timestamp = Date.now();
|
|
39616
|
+
if (void 0 === seq) seq = Math.floor(Math.random() * (this.config.XRAY_TRACE_ID_SEQ_MAX + 1));
|
|
39617
|
+
const part1 = (timestamp << this.config.XRAY_TRACE_ID_TIMESTAMP_SHIFT | seq).toString(16).padStart(16, '0');
|
|
39618
|
+
let part2 = '';
|
|
39619
|
+
for(let i = 0; i < 16; i++)part2 += this.config.HEX_CHARS[Math.floor(Math.random() * this.config.HEX_CHARS.length)];
|
|
39620
|
+
return part1 + part2;
|
|
39621
|
+
}
|
|
39622
|
+
constructor(){
|
|
39623
|
+
this.config = CryptoConfig;
|
|
39624
|
+
}
|
|
39625
|
+
}
|
|
39626
|
+
class Base64Encoder {
|
|
39627
|
+
encode(dataToEncode) {
|
|
39628
|
+
const dataBytes = Buffer.from(dataToEncode, 'utf-8');
|
|
39629
|
+
const standardEncodedString = dataBytes.toString('base64');
|
|
39630
|
+
let result = '';
|
|
39631
|
+
for (const char of standardEncodedString){
|
|
39632
|
+
const index = this.config.STANDARD_BASE64_ALPHABET.indexOf(char);
|
|
39633
|
+
if (-1 !== index) result += this.config.CUSTOM_BASE64_ALPHABET[index];
|
|
39634
|
+
else result += char;
|
|
39635
|
+
}
|
|
39636
|
+
return result;
|
|
39637
|
+
}
|
|
39638
|
+
decode(encodedString) {
|
|
39639
|
+
let standardString = '';
|
|
39640
|
+
for (const char of encodedString){
|
|
39641
|
+
const index = this.config.CUSTOM_BASE64_ALPHABET.indexOf(char);
|
|
39642
|
+
if (-1 !== index) standardString += this.config.STANDARD_BASE64_ALPHABET[index];
|
|
39643
|
+
else standardString += char;
|
|
39644
|
+
}
|
|
39645
|
+
return Buffer.from(standardString, 'base64').toString('utf-8');
|
|
39646
|
+
}
|
|
39647
|
+
encodeX3(dataBytes) {
|
|
39648
|
+
const base64String = Buffer.from(dataBytes).toString('base64');
|
|
39649
|
+
let result = '';
|
|
39650
|
+
for (const char of base64String){
|
|
39651
|
+
const index = this.config.STANDARD_BASE64_ALPHABET.indexOf(char);
|
|
39652
|
+
if (-1 !== index) result += this.config.X3_BASE64_ALPHABET[index];
|
|
39653
|
+
else result += char;
|
|
39654
|
+
}
|
|
39655
|
+
return result;
|
|
39656
|
+
}
|
|
39657
|
+
decodeX3(encodedString) {
|
|
39658
|
+
let standardString = '';
|
|
39659
|
+
for (const char of encodedString){
|
|
39660
|
+
const index = this.config.X3_BASE64_ALPHABET.indexOf(char);
|
|
39661
|
+
if (-1 !== index) standardString += this.config.STANDARD_BASE64_ALPHABET[index];
|
|
39662
|
+
else standardString += char;
|
|
39663
|
+
}
|
|
39664
|
+
return new Uint8Array(Buffer.from(standardString, 'base64'));
|
|
39665
|
+
}
|
|
39666
|
+
constructor(){
|
|
39667
|
+
this.config = CryptoConfig;
|
|
39668
|
+
}
|
|
39669
|
+
}
|
|
39670
|
+
class RequestSignatureValidator {
|
|
39671
|
+
static validateMethod(method) {
|
|
39672
|
+
if ('string' != typeof method) throw new TypeError(`method must be str, got ${typeof method}`);
|
|
39673
|
+
const normalizedMethod = method.trim().toUpperCase();
|
|
39674
|
+
if (![
|
|
39675
|
+
'GET',
|
|
39676
|
+
'POST'
|
|
39677
|
+
].includes(normalizedMethod)) throw new Error(`method must be 'GET' or 'POST', got '${method}'`);
|
|
39678
|
+
return normalizedMethod;
|
|
39679
|
+
}
|
|
39680
|
+
static validateUri(uri) {
|
|
39681
|
+
if ('string' != typeof uri) throw new TypeError(`uri must be str, got ${typeof uri}`);
|
|
39682
|
+
if (!uri.trim()) throw new Error('uri cannot be empty');
|
|
39683
|
+
return uri.trim();
|
|
39684
|
+
}
|
|
39685
|
+
static validateA1Value(a1Value) {
|
|
39686
|
+
if ('string' != typeof a1Value) throw new TypeError(`a1_value must be str, got ${typeof a1Value}`);
|
|
39687
|
+
if (!a1Value.trim()) throw new Error('a1_value cannot be empty');
|
|
39688
|
+
return a1Value.trim();
|
|
39689
|
+
}
|
|
39690
|
+
static validateXsecAppid(xsecAppid) {
|
|
39691
|
+
if ('string' != typeof xsecAppid) throw new TypeError(`xsec_appid must be str, got ${typeof xsecAppid}`);
|
|
39692
|
+
if (!xsecAppid.trim()) throw new Error('xsec_appid cannot be empty');
|
|
39693
|
+
return xsecAppid.trim();
|
|
39694
|
+
}
|
|
39695
|
+
static validatePayload(payload) {
|
|
39696
|
+
if (null !== payload && ('object' != typeof payload || Array.isArray(payload))) throw new TypeError(`payload must be dict or None, got ${typeof payload}`);
|
|
39697
|
+
if (null !== payload) {
|
|
39698
|
+
for(const key in payload)if ('string' != typeof key) throw new TypeError(`payload keys must be str, got ${typeof key} for key '${key}'`);
|
|
39699
|
+
}
|
|
39700
|
+
return payload;
|
|
39701
|
+
}
|
|
39702
|
+
}
|
|
39703
|
+
class CryptoProcessor {
|
|
39704
|
+
intToLeBytes(val, length = 4) {
|
|
39705
|
+
const arr = [];
|
|
39706
|
+
for(let i = 0; i < length; i++){
|
|
39707
|
+
arr.push(0xFF & val);
|
|
39708
|
+
val >>>= 8;
|
|
39709
|
+
}
|
|
39710
|
+
return arr;
|
|
39711
|
+
}
|
|
39712
|
+
envFingerprintA(ts, xorKey) {
|
|
39713
|
+
const data = [];
|
|
39714
|
+
for(let i = 0; i < 8; i++)data.push(ts >>> 8 * i & 0xFF);
|
|
39715
|
+
const sum1 = data.slice(1, 5).reduce((a, b)=>a + b, 0);
|
|
39716
|
+
const sum2 = data.slice(5, 8).reduce((a, b)=>a + b, 0);
|
|
39717
|
+
const mark = (0xFF & sum1) + sum2 & 0xFF;
|
|
39718
|
+
data[0] = mark;
|
|
39719
|
+
return data.map((b)=>b ^ xorKey);
|
|
39720
|
+
}
|
|
39721
|
+
envFingerprintB(ts) {
|
|
39722
|
+
const data = [];
|
|
39723
|
+
for(let i = 0; i < 8; i++)data.push(ts >>> 8 * i & 0xFF);
|
|
39724
|
+
return data;
|
|
39725
|
+
}
|
|
39726
|
+
buildPayloadArray(hexParameter, a1Value, appIdentifier = "xhs-pc-web", stringParam = "", timestamp) {
|
|
39727
|
+
const payload = [];
|
|
39728
|
+
payload.push(...this.config.VERSION_BYTES);
|
|
39729
|
+
const seed = this.randomGen.generateRandomInt();
|
|
39730
|
+
const seedBytes = this.intToLeBytes(seed, 4);
|
|
39731
|
+
payload.push(...seedBytes);
|
|
39732
|
+
const seedByte0 = seedBytes[0];
|
|
39733
|
+
if (void 0 === timestamp) timestamp = Date.now() / 1000;
|
|
39734
|
+
const tsMs = Math.floor(1000 * timestamp);
|
|
39735
|
+
payload.push(...this.envFingerprintA(tsMs, this.config.ENV_FINGERPRINT_XOR_KEY));
|
|
39736
|
+
const timeOffset = this.randomGen.generateRandomByteInRange(this.config.ENV_FINGERPRINT_TIME_OFFSET_MIN, this.config.ENV_FINGERPRINT_TIME_OFFSET_MAX);
|
|
39737
|
+
payload.push(...this.envFingerprintB(tsMs - 1000 * timeOffset));
|
|
39738
|
+
const sequenceValue = this.randomGen.generateRandomByteInRange(this.config.SEQUENCE_VALUE_MIN, this.config.SEQUENCE_VALUE_MAX);
|
|
39739
|
+
payload.push(...this.intToLeBytes(sequenceValue, 4));
|
|
39740
|
+
const windowPropsLength = this.randomGen.generateRandomByteInRange(this.config.WINDOW_PROPS_LENGTH_MIN, this.config.WINDOW_PROPS_LENGTH_MAX);
|
|
39741
|
+
payload.push(...this.intToLeBytes(windowPropsLength, 4));
|
|
39742
|
+
const uriLength = Buffer.from(stringParam, 'utf-8').length;
|
|
39743
|
+
payload.push(...this.intToLeBytes(uriLength, 4));
|
|
39744
|
+
const md5Bytes = Buffer.from(hexParameter, 'hex');
|
|
39745
|
+
for(let i = 0; i < 8; i++)payload.push(md5Bytes[i] ^ seedByte0);
|
|
39746
|
+
payload.push(52);
|
|
39747
|
+
const a1Bytes = Buffer.from(a1Value, 'utf-8');
|
|
39748
|
+
for(let i = 0; i < 52; i++)payload.push(i < a1Bytes.length ? a1Bytes[i] : 0);
|
|
39749
|
+
payload.push(10);
|
|
39750
|
+
const sourceBytes = Buffer.from(appIdentifier, 'utf-8');
|
|
39751
|
+
for(let i = 0; i < 10; i++)payload.push(i < sourceBytes.length ? sourceBytes[i] : 0);
|
|
39752
|
+
payload.push(1);
|
|
39753
|
+
payload.push(this.config.CHECKSUM_VERSION);
|
|
39754
|
+
payload.push(seedByte0 ^ this.config.CHECKSUM_XOR_KEY);
|
|
39755
|
+
payload.push(...this.config.CHECKSUM_FIXED_TAIL);
|
|
39756
|
+
return payload;
|
|
39757
|
+
}
|
|
39758
|
+
constructor(){
|
|
39759
|
+
this.config = CryptoConfig;
|
|
39760
|
+
this.bitOps = new BitOperations();
|
|
39761
|
+
this.b64encoder = new Base64Encoder();
|
|
39762
|
+
this.randomGen = new RandomGenerator();
|
|
39763
|
+
}
|
|
39764
|
+
}
|
|
39765
|
+
class CRC32 {
|
|
39766
|
+
static{
|
|
39767
|
+
this.CRC32_TABLE = (()=>{
|
|
39768
|
+
const table = [];
|
|
39769
|
+
for(let i = 0; i < 256; i++){
|
|
39770
|
+
let crc = i;
|
|
39771
|
+
for(let j = 0; j < 8; j++)crc = 1 & crc ? 0xEDB88320 ^ crc >>> 1 : crc >>> 1;
|
|
39772
|
+
table.push(crc >>> 0);
|
|
39773
|
+
}
|
|
39774
|
+
return table;
|
|
39775
|
+
})();
|
|
39776
|
+
}
|
|
39777
|
+
static crc32JsInt(input, signed = true) {
|
|
39778
|
+
let crc = 0xFFFFFFFF;
|
|
39779
|
+
const data = 'string' == typeof input ? this.stringToBytes(input) : input;
|
|
39780
|
+
for (const byte of data){
|
|
39781
|
+
const index = (crc ^ byte) & 0xFF;
|
|
39782
|
+
crc = (this.CRC32_TABLE[index] ^ crc >>> 8) >>> 0;
|
|
39783
|
+
}
|
|
39784
|
+
crc = (0xFFFFFFFF ^ crc) >>> 0;
|
|
39785
|
+
if (signed) return crc > 0x7FFFFFFF ? crc - 0x100000000 : crc;
|
|
39786
|
+
return crc;
|
|
39787
|
+
}
|
|
39788
|
+
static stringToBytes(str) {
|
|
39789
|
+
const bytes = [];
|
|
39790
|
+
for(let i = 0; i < str.length; i++){
|
|
39791
|
+
const code = str.charCodeAt(i);
|
|
39792
|
+
if (code <= 0xFF) bytes.push(code);
|
|
39793
|
+
else bytes.push(0xFF & code);
|
|
39794
|
+
}
|
|
39795
|
+
return bytes;
|
|
39796
|
+
}
|
|
39797
|
+
}
|
|
39798
|
+
class FingerprintData {
|
|
39799
|
+
static{
|
|
39800
|
+
this.GPU_VENDORS = [
|
|
39801
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) HD Graphics 400 (0x00000166) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39802
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) HD Graphics 4400 (0x00001112) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39803
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) HD Graphics 4600 (0x00000412) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39804
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) HD Graphics 520 (0x1912) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39805
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) HD Graphics 530 (0x00001912) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39806
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) HD Graphics 550 (0x00001512) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39807
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) HD Graphics 6000 (0x1606) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39808
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) Iris(TM) Graphics 540 (0x1912) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39809
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) Iris(TM) Graphics 550 (0x1913) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39810
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) Iris(TM) Plus Graphics 640 (0x161C) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39811
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) UHD Graphics 600 (0x3E80) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39812
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) UHD Graphics 620 (0x00003EA0) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39813
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) UHD Graphics 630 (0x00003E9B) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39814
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) UHD Graphics 655 (0x00009BC8) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39815
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) Iris(R) Xe Graphics (0x000046A8) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39816
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) Iris(R) Xe Graphics (0x00009A49) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39817
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) Iris(R) Xe MAX Graphics (0x00009BC0) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39818
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel Arc A370M (0x0000AF51) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39819
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel Arc A380 (0x0000AF41) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39820
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel Arc A380M (0x0000AF5E) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39821
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel Arc A550 (0x0000AF42) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39822
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel Arc A770 (0x0000AF43) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39823
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel Arc A770M (0x0000AF50) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39824
|
+
"Google Inc. (Intel)|ANGLE (Intel, Mesa Intel(R) Graphics (RPL‑P GT1) (0x0000A702) OpenGL 4.6)",
|
|
39825
|
+
"Google Inc. (Intel)|ANGLE (Intel, Mesa Intel(R) UHD Graphics 770 (0x00004680) OpenGL 4.6)",
|
|
39826
|
+
"Google Inc. (Intel)|ANGLE (Intel, Mesa Intel(R) HD Graphics 4400 (0x00001122) OpenGL 4.6)",
|
|
39827
|
+
"Google Inc. (Intel)|ANGLE (Intel, Mesa Intel(R) Graphics (ADL‑S GT1) (0x0000A0A1) OpenGL 4.6)",
|
|
39828
|
+
"Google Inc. (Intel)|ANGLE (Intel, Mesa Intel(R) Graphics (RKL GT1) (0x0000A9A1) OpenGL 4.6)",
|
|
39829
|
+
"Google Inc. (Intel)|ANGLE (Intel, Mesa Intel(R) UHD Graphics (CML GT2) (0x00009A14) OpenGL 4.6)",
|
|
39830
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) HD Graphics 3000 (0x00001022) Direct3D9Ex vs_3_0 ps_3_0, igdumd64.dll)",
|
|
39831
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) HD Graphics Family (0x00000A16) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39832
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) Iris Pro OpenGL Engine, OpenGL 4.1)",
|
|
39833
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) Iris(TM) Plus Graphics 645 (0x1616) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39834
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) Iris(TM) Plus Graphics 655 (0x161E) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39835
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) UHD Graphics 730 (0x0000A100) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39836
|
+
"Google Inc. (Intel)|ANGLE (Intel, Intel(R) UHD Graphics 805 (0x0000B0A0) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39837
|
+
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon Vega 3 Graphics (0x000015E0) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39838
|
+
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon Vega 8 Graphics (0x000015D8) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39839
|
+
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon Vega 11 Graphics (0x000015DD) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39840
|
+
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon Graphics (0x00001636) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39841
|
+
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 5500 XT Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39842
|
+
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 560 (0x000067EF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39843
|
+
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 570 (0x000067DF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39844
|
+
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 580 2048SP (0x00006FDF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39845
|
+
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 590 (0x000067FF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39846
|
+
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 6600 (0x000073FF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39847
|
+
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 6600 XT (0x000073FF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39848
|
+
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 6650 XT Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39849
|
+
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 6700 XT (0x000073DF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39850
|
+
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 6800 (0x000073BF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39851
|
+
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 6900 XT (0x000073C2) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39852
|
+
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 7700 XT Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39853
|
+
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon Pro 5300M OpenGL Engine, OpenGL 4.1)",
|
|
39854
|
+
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon Pro 5500 XT OpenGL Engine, OpenGL 4.1)",
|
|
39855
|
+
"Google Inc. (AMD)|ANGLE (AMD, AMD Radeon R7 370 Series (0x00006811) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39856
|
+
"Google Inc. (AMD)|ANGLE (AMD, ATI Technologies Inc. AMD Radeon RX Vega 64 OpenGL Engine, OpenGL 4.1)",
|
|
39857
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce GTX 1050 (0x00001C81) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39858
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce GTX 1050 Ti (0x00001C8C) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39859
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce GTX 1060 6GB (0x000010DE) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39860
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce GTX 1070 (0x00001B81) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39861
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce GTX 1080 (0x00001B80) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39862
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 2060 (0x00001F06) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39863
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 2060 SUPER (0x00001F06) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39864
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 2070 (0x00001F10) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39865
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 2070 SUPER (0x00001F10) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39866
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 3060 (0x0000250F) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39867
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 3060 Ti (0x00002489) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39868
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 3070 (0x00002488) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39869
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 3070 Ti (0x000028A5) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39870
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 3080 (0x00002206) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39871
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 3080 Ti (0x00002208) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39872
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 3090 (0x00002204) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39873
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 4060 (0x00002882) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39874
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 4060 Ti (0x00002803) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39875
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 4070 (0x00002786) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39876
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 4070 Ti (0x00002857) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39877
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 4080 (0x00002819) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39878
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 4090 (0x00002684) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39879
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA Quadro RTX 5000 Ada Generation (0x000026B2) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39880
|
+
"Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA Quadro P400 (0x00001CB3) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
39881
|
+
"Google Inc. (Google)|ANGLE (Google, Vulkan 1.3.0 (SwiftShader Device (Subzero) (0x0000C0DE)), SwiftShader driver)",
|
|
39882
|
+
"Google Inc. (Google)|ANGLE (Google, Vulkan 1.3.0 (SwiftShader Device (Subzero)), SwiftShader driver)",
|
|
39883
|
+
"Google Inc. (Google)|ANGLE (Google, Vulkan 1.3.0 (SwiftShader Device), SwiftShader driver)"
|
|
39884
|
+
];
|
|
39885
|
+
}
|
|
39886
|
+
static{
|
|
39887
|
+
this.SCREEN_RESOLUTIONS = {
|
|
39888
|
+
resolutions: [
|
|
39889
|
+
"1366;768",
|
|
39890
|
+
"1600;900",
|
|
39891
|
+
"1920;1080",
|
|
39892
|
+
"2560;1440",
|
|
39893
|
+
"3840;2160",
|
|
39894
|
+
"7680;4320"
|
|
39895
|
+
],
|
|
39896
|
+
weights: [
|
|
39897
|
+
0.25,
|
|
39898
|
+
0.15,
|
|
39899
|
+
0.35,
|
|
39900
|
+
0.15,
|
|
39901
|
+
0.08,
|
|
39902
|
+
0.02
|
|
39903
|
+
]
|
|
39904
|
+
};
|
|
39905
|
+
}
|
|
39906
|
+
static{
|
|
39907
|
+
this.COLOR_DEPTH_OPTIONS = {
|
|
39908
|
+
values: [
|
|
39909
|
+
16,
|
|
39910
|
+
24,
|
|
39911
|
+
30,
|
|
39912
|
+
32
|
|
39913
|
+
],
|
|
39914
|
+
weights: [
|
|
39915
|
+
0.05,
|
|
39916
|
+
0.6,
|
|
39917
|
+
0.05,
|
|
39918
|
+
0.3
|
|
39919
|
+
]
|
|
39920
|
+
};
|
|
39921
|
+
}
|
|
39922
|
+
static{
|
|
39923
|
+
this.DEVICE_MEMORY_OPTIONS = {
|
|
39924
|
+
values: [
|
|
39925
|
+
1,
|
|
39926
|
+
2,
|
|
39927
|
+
4,
|
|
39928
|
+
8,
|
|
39929
|
+
12,
|
|
39930
|
+
16
|
|
39931
|
+
],
|
|
39932
|
+
weights: [
|
|
39933
|
+
0.10,
|
|
39934
|
+
0.25,
|
|
39935
|
+
0.4,
|
|
39936
|
+
0.2,
|
|
39937
|
+
0.03,
|
|
39938
|
+
0.01
|
|
39939
|
+
]
|
|
39940
|
+
};
|
|
39941
|
+
}
|
|
39942
|
+
static{
|
|
39943
|
+
this.CORE_OPTIONS = {
|
|
39944
|
+
values: [
|
|
39945
|
+
2,
|
|
39946
|
+
4,
|
|
39947
|
+
6,
|
|
39948
|
+
8,
|
|
39949
|
+
12,
|
|
39950
|
+
16,
|
|
39951
|
+
24,
|
|
39952
|
+
32
|
|
39953
|
+
],
|
|
39954
|
+
weights: [
|
|
39955
|
+
0.1,
|
|
39956
|
+
0.4,
|
|
39957
|
+
0.2,
|
|
39958
|
+
0.15,
|
|
39959
|
+
0.08,
|
|
39960
|
+
0.04,
|
|
39961
|
+
0.02,
|
|
39962
|
+
0.01
|
|
39963
|
+
]
|
|
39964
|
+
};
|
|
39965
|
+
}
|
|
39966
|
+
static{
|
|
39967
|
+
this.BROWSER_PLUGINS = "PDF Viewer,Chrome PDF Viewer,Chromium PDF Viewer,Microsoft Edge PDF Viewer,WebKit built-in PDF";
|
|
39968
|
+
}
|
|
39969
|
+
static{
|
|
39970
|
+
this.CANVAS_HASH = "742cc32c";
|
|
39971
|
+
}
|
|
39972
|
+
static{
|
|
39973
|
+
this.VOICE_HASH_OPTIONS = "10311144241322244122";
|
|
39974
|
+
}
|
|
39975
|
+
static{
|
|
39976
|
+
this.FONTS = 'system-ui, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, BlinkMacSystemFont, "Helvetica Neue", Arial, "PingFang SC", "PingFang TC", "PingFang HK", "Microsoft Yahei", "Microsoft JhengHei"';
|
|
39977
|
+
}
|
|
39978
|
+
}
|
|
39979
|
+
class FingerprintHelpers {
|
|
39980
|
+
static weightedRandomChoice(options, weights) {
|
|
39981
|
+
const totalWeight = weights.reduce((sum, weight)=>sum + weight, 0);
|
|
39982
|
+
let random = Math.random() * totalWeight;
|
|
39983
|
+
for(let i = 0; i < options.length; i++){
|
|
39984
|
+
random -= weights[i];
|
|
39985
|
+
if (random <= 0) return options[i];
|
|
39986
|
+
}
|
|
39987
|
+
return options[options.length - 1];
|
|
39988
|
+
}
|
|
39989
|
+
static getRendererInfo() {
|
|
39990
|
+
const rendererStr = FingerprintData.GPU_VENDORS[Math.floor(Math.random() * FingerprintData.GPU_VENDORS.length)];
|
|
39991
|
+
const [vendor, renderer] = rendererStr.split('|');
|
|
39992
|
+
return {
|
|
39993
|
+
vendor,
|
|
39994
|
+
renderer
|
|
39995
|
+
};
|
|
39996
|
+
}
|
|
39997
|
+
static getScreenConfig() {
|
|
39998
|
+
const resolutionStr = this.weightedRandomChoice(FingerprintData.SCREEN_RESOLUTIONS.resolutions, FingerprintData.SCREEN_RESOLUTIONS.weights);
|
|
39999
|
+
const [widthStr, heightStr] = resolutionStr.split(';');
|
|
40000
|
+
const width = parseInt(widthStr);
|
|
40001
|
+
const height = parseInt(heightStr);
|
|
40002
|
+
let availWidth, availHeight;
|
|
40003
|
+
if (Math.random() > 0.5) {
|
|
40004
|
+
availWidth = width - parseInt(String(this.weightedRandomChoice([
|
|
40005
|
+
0,
|
|
40006
|
+
30,
|
|
40007
|
+
60,
|
|
40008
|
+
80
|
|
40009
|
+
], [
|
|
40010
|
+
0.1,
|
|
40011
|
+
0.4,
|
|
40012
|
+
0.3,
|
|
40013
|
+
0.2
|
|
40014
|
+
])));
|
|
40015
|
+
availHeight = height;
|
|
40016
|
+
} else {
|
|
40017
|
+
availWidth = width;
|
|
40018
|
+
availHeight = height - parseInt(String(this.weightedRandomChoice([
|
|
40019
|
+
30,
|
|
40020
|
+
60,
|
|
40021
|
+
80,
|
|
40022
|
+
100
|
|
40023
|
+
], [
|
|
40024
|
+
0.2,
|
|
40025
|
+
0.5,
|
|
40026
|
+
0.2,
|
|
40027
|
+
0.1
|
|
40028
|
+
])));
|
|
40029
|
+
}
|
|
40030
|
+
return {
|
|
40031
|
+
width,
|
|
40032
|
+
height,
|
|
40033
|
+
availWidth,
|
|
40034
|
+
availHeight
|
|
40035
|
+
};
|
|
40036
|
+
}
|
|
40037
|
+
static generateCanvasHash() {
|
|
40038
|
+
return FingerprintData.CANVAS_HASH;
|
|
40039
|
+
}
|
|
40040
|
+
static generateWebglHash() {
|
|
40041
|
+
return external_node_crypto_namespaceObject.createHash('md5').update(external_node_crypto_namespaceObject.randomBytes(32)).digest('hex');
|
|
40042
|
+
}
|
|
40043
|
+
}
|
|
40044
|
+
class ARC4 {
|
|
40045
|
+
constructor(key){
|
|
40046
|
+
this.s = [];
|
|
40047
|
+
for(let i = 0; i < 256; i++)this.s[i] = i;
|
|
40048
|
+
let j = 0;
|
|
40049
|
+
for(let i = 0; i < 256; i++){
|
|
40050
|
+
j = (j + this.s[i] + key[i % key.length]) % 256;
|
|
40051
|
+
[this.s[i], this.s[j]] = [
|
|
40052
|
+
this.s[j],
|
|
40053
|
+
this.s[i]
|
|
40054
|
+
];
|
|
40339
40055
|
}
|
|
40340
|
-
}
|
|
40341
|
-
|
|
40342
|
-
|
|
40343
|
-
|
|
40344
|
-
|
|
40345
|
-
|
|
40346
|
-
|
|
40347
|
-
|
|
40348
|
-
|
|
40056
|
+
}
|
|
40057
|
+
encrypt(data) {
|
|
40058
|
+
const result = new Uint8Array(data.length);
|
|
40059
|
+
let i = 0, j = 0;
|
|
40060
|
+
for(let k = 0; k < data.length; k++){
|
|
40061
|
+
i = (i + 1) % 256;
|
|
40062
|
+
j = (j + this.s[i]) % 256;
|
|
40063
|
+
[this.s[i], this.s[j]] = [
|
|
40064
|
+
this.s[j],
|
|
40065
|
+
this.s[i]
|
|
40066
|
+
];
|
|
40067
|
+
const keyByte = this.s[(this.s[i] + this.s[j]) % 256];
|
|
40068
|
+
result[k] = data[k] ^ keyByte;
|
|
40349
40069
|
}
|
|
40350
|
-
|
|
40351
|
-
|
|
40352
|
-
|
|
40353
|
-
|
|
40354
|
-
|
|
40355
|
-
|
|
40356
|
-
|
|
40357
|
-
|
|
40358
|
-
|
|
40359
|
-
|
|
40360
|
-
|
|
40361
|
-
|
|
40362
|
-
|
|
40363
|
-
|
|
40070
|
+
return result;
|
|
40071
|
+
}
|
|
40072
|
+
}
|
|
40073
|
+
class FingerprintGenerator {
|
|
40074
|
+
constructor(){
|
|
40075
|
+
this.config = CryptoConfig;
|
|
40076
|
+
this.b1Key = new TextEncoder().encode("xhswebmplfbt");
|
|
40077
|
+
this.encoder = new Base64Encoder();
|
|
40078
|
+
}
|
|
40079
|
+
generate(cookies, userAgent) {
|
|
40080
|
+
const cookieString = Object.entries(cookies).map(([k, v])=>`${k}=${v}`).join('; ');
|
|
40081
|
+
const screenConfig = FingerprintHelpers.getScreenConfig();
|
|
40082
|
+
const isIncognitoMode = FingerprintHelpers.weightedRandomChoice([
|
|
40083
|
+
"true",
|
|
40084
|
+
"false"
|
|
40085
|
+
], [
|
|
40086
|
+
0.95,
|
|
40087
|
+
0.05
|
|
40088
|
+
]);
|
|
40089
|
+
const { vendor, renderer } = FingerprintHelpers.getRendererInfo();
|
|
40090
|
+
const x78Y = Math.floor(101 * Math.random()) + 2350;
|
|
40091
|
+
const fp = {
|
|
40092
|
+
x1: userAgent,
|
|
40093
|
+
x2: "false",
|
|
40094
|
+
x3: "zh-CN",
|
|
40095
|
+
x4: String(FingerprintHelpers.weightedRandomChoice(FingerprintData.COLOR_DEPTH_OPTIONS.values, FingerprintData.COLOR_DEPTH_OPTIONS.weights)),
|
|
40096
|
+
x5: String(FingerprintHelpers.weightedRandomChoice(FingerprintData.DEVICE_MEMORY_OPTIONS.values, FingerprintData.DEVICE_MEMORY_OPTIONS.weights)),
|
|
40097
|
+
x6: "24",
|
|
40098
|
+
x7: `${vendor},${renderer}`,
|
|
40099
|
+
x8: String(FingerprintHelpers.weightedRandomChoice(FingerprintData.CORE_OPTIONS.values, FingerprintData.CORE_OPTIONS.weights)),
|
|
40100
|
+
x9: `${screenConfig.width};${screenConfig.height}`,
|
|
40101
|
+
x10: `${screenConfig.availWidth};${screenConfig.availHeight}`,
|
|
40102
|
+
x11: "-480",
|
|
40103
|
+
x12: "Asia/Shanghai",
|
|
40104
|
+
x13: isIncognitoMode,
|
|
40105
|
+
x14: isIncognitoMode,
|
|
40106
|
+
x15: isIncognitoMode,
|
|
40107
|
+
x16: "false",
|
|
40108
|
+
x17: "false",
|
|
40109
|
+
x18: "un",
|
|
40110
|
+
x19: "Win32",
|
|
40111
|
+
x20: "",
|
|
40112
|
+
x21: FingerprintData.BROWSER_PLUGINS,
|
|
40113
|
+
x22: FingerprintHelpers.generateWebglHash(),
|
|
40114
|
+
x23: "false",
|
|
40115
|
+
x24: "false",
|
|
40116
|
+
x25: "false",
|
|
40117
|
+
x26: "false",
|
|
40118
|
+
x27: "false",
|
|
40119
|
+
x28: "0,false,false",
|
|
40120
|
+
x29: "4,7,8",
|
|
40121
|
+
x30: "swf object not loaded",
|
|
40122
|
+
x33: "0",
|
|
40123
|
+
x34: "0",
|
|
40124
|
+
x35: "0",
|
|
40125
|
+
x36: String(Math.floor(20 * Math.random()) + 1),
|
|
40126
|
+
x37: "0|0|0|0|0|0|0|0|0|1|0|0|0|0|0|0|0|0|1|0|0|0|0|0",
|
|
40127
|
+
x38: "0|0|1|0|1|0|0|0|0|0|1|0|1|0|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0",
|
|
40128
|
+
x39: 0,
|
|
40129
|
+
x40: "0",
|
|
40130
|
+
x41: "0",
|
|
40131
|
+
x42: "3.4.4",
|
|
40132
|
+
x43: FingerprintHelpers.generateCanvasHash(),
|
|
40133
|
+
x44: String(Math.floor(Date.now())),
|
|
40134
|
+
x45: "__SEC_CAV__1-1-1-1-1|__SEC_WSA__|",
|
|
40135
|
+
x46: "false",
|
|
40136
|
+
x47: "1|0|0|0|0|0",
|
|
40137
|
+
x48: "",
|
|
40138
|
+
x49: "{list:[],type:}",
|
|
40139
|
+
x50: "",
|
|
40140
|
+
x51: "",
|
|
40141
|
+
x52: "",
|
|
40142
|
+
x53: external_node_crypto_namespaceObject.createHash('md5').update(external_node_crypto_namespaceObject.randomBytes(32)).digest('hex'),
|
|
40143
|
+
x54: FingerprintData.VOICE_HASH_OPTIONS,
|
|
40144
|
+
x55: "380,380,360,400,380,400,420,380,400,400,360,360,440,420",
|
|
40145
|
+
x56: `${vendor}|${renderer}|${FingerprintHelpers.generateWebglHash()}|35`,
|
|
40146
|
+
x57: cookieString,
|
|
40147
|
+
x58: "180",
|
|
40148
|
+
x59: "2",
|
|
40149
|
+
x60: "63",
|
|
40150
|
+
x61: "1291",
|
|
40151
|
+
x62: "2047",
|
|
40152
|
+
x63: "0",
|
|
40153
|
+
x64: "0",
|
|
40154
|
+
x65: "0",
|
|
40155
|
+
x66: {
|
|
40156
|
+
referer: "",
|
|
40157
|
+
location: "https://www.xiaohongshu.com/explore",
|
|
40158
|
+
frame: 0
|
|
40159
|
+
},
|
|
40160
|
+
x67: "1|0",
|
|
40161
|
+
x68: "0",
|
|
40162
|
+
x69: "326|1292|30",
|
|
40163
|
+
x70: [
|
|
40164
|
+
"location"
|
|
40165
|
+
],
|
|
40166
|
+
x71: "true",
|
|
40167
|
+
x72: "complete",
|
|
40168
|
+
x73: "1191",
|
|
40169
|
+
x74: "0|0|0",
|
|
40170
|
+
x75: "Google Inc.",
|
|
40171
|
+
x76: "true",
|
|
40172
|
+
x77: "1|1|1|1|1|1|1|1|1|1",
|
|
40173
|
+
x78: {
|
|
40174
|
+
x: 0,
|
|
40175
|
+
y: x78Y,
|
|
40176
|
+
left: 0,
|
|
40177
|
+
right: 290.828125,
|
|
40178
|
+
bottom: x78Y + 18,
|
|
40179
|
+
height: 18,
|
|
40180
|
+
top: x78Y,
|
|
40181
|
+
width: 290.828125,
|
|
40182
|
+
font: FingerprintData.FONTS
|
|
40183
|
+
},
|
|
40184
|
+
x79: "144|599565058866",
|
|
40185
|
+
x80: "1|[object FileSystemDirectoryHandle]",
|
|
40186
|
+
x31: "124.04347527516074",
|
|
40187
|
+
x82: "_0x17a2|_0x1954"
|
|
40188
|
+
};
|
|
40189
|
+
return fp;
|
|
40190
|
+
}
|
|
40191
|
+
generateB1(fp) {
|
|
40192
|
+
const b1Fp = {
|
|
40193
|
+
x33: fp.x33,
|
|
40194
|
+
x34: fp.x34,
|
|
40195
|
+
x35: fp.x35,
|
|
40196
|
+
x36: fp.x36,
|
|
40197
|
+
x37: fp.x37,
|
|
40198
|
+
x38: fp.x38,
|
|
40199
|
+
x39: fp.x39,
|
|
40200
|
+
x42: fp.x42,
|
|
40201
|
+
x43: fp.x43,
|
|
40202
|
+
x44: fp.x44,
|
|
40203
|
+
x45: fp.x45,
|
|
40204
|
+
x46: fp.x46,
|
|
40205
|
+
x48: fp.x48,
|
|
40206
|
+
x49: fp.x49,
|
|
40207
|
+
x50: fp.x50,
|
|
40208
|
+
x51: fp.x51,
|
|
40209
|
+
x52: fp.x52,
|
|
40210
|
+
x82: fp.x82
|
|
40211
|
+
};
|
|
40212
|
+
const b1Json = JSON.stringify(b1Fp, null, 0).replace(/\s+/g, '');
|
|
40213
|
+
const cipher = new ARC4(this.b1Key);
|
|
40214
|
+
const ciphertext = cipher.encrypt(new TextEncoder().encode(b1Json));
|
|
40215
|
+
let latin1String = '';
|
|
40216
|
+
for(let i = 0; i < ciphertext.length; i++)latin1String += String.fromCharCode(ciphertext[i]);
|
|
40217
|
+
const encodedUrl = encodeURIComponent(latin1String).replace(/[!'()*~_-]/g, (c)=>c);
|
|
40218
|
+
const b = [];
|
|
40219
|
+
const parts = encodedUrl.split('%').slice(1);
|
|
40220
|
+
for (const part of parts){
|
|
40221
|
+
const chars = part.split('');
|
|
40222
|
+
if (chars.length >= 2) {
|
|
40223
|
+
b.push(parseInt(chars.slice(0, 2).join(''), 16));
|
|
40224
|
+
for(let i = 2; i < chars.length; i++)b.push(chars[i].charCodeAt(0));
|
|
40225
|
+
}
|
|
40364
40226
|
}
|
|
40365
|
-
|
|
40366
|
-
|
|
40367
|
-
|
|
40368
|
-
|
|
40369
|
-
|
|
40370
|
-
|
|
40227
|
+
const b1 = this.encoder.encode(JSON.stringify(b));
|
|
40228
|
+
return b1;
|
|
40229
|
+
}
|
|
40230
|
+
update(fp, cookies, url) {
|
|
40231
|
+
const cookieString = Object.entries(cookies).map(([k, v])=>`${k}=${v}`).join('; ');
|
|
40232
|
+
fp.x39 = 0;
|
|
40233
|
+
fp.x44 = String(Math.floor(Date.now()));
|
|
40234
|
+
fp.x57 = cookieString;
|
|
40235
|
+
fp.x66 = {
|
|
40236
|
+
referer: "https://www.xiaohongshu.com/explore",
|
|
40237
|
+
location: url,
|
|
40238
|
+
frame: 0
|
|
40239
|
+
};
|
|
40240
|
+
}
|
|
40241
|
+
}
|
|
40242
|
+
class XsCommonSigner {
|
|
40243
|
+
constructor(){
|
|
40244
|
+
this.config = CryptoConfig;
|
|
40245
|
+
this.fpGenerator = new FingerprintGenerator();
|
|
40246
|
+
this.encoder = new Base64Encoder();
|
|
40247
|
+
}
|
|
40248
|
+
sign(cookieDict) {
|
|
40249
|
+
if (!cookieDict.a1) throw new Error("Missing 'a1' in cookies");
|
|
40250
|
+
const a1Value = cookieDict.a1;
|
|
40251
|
+
const fingerprint = this.fpGenerator.generate(cookieDict, this.config.PUBLIC_USERAGENT);
|
|
40252
|
+
const b1 = this.fpGenerator.generateB1(fingerprint);
|
|
40253
|
+
const x9 = CRC32.crc32JsInt(b1, true);
|
|
40254
|
+
const signStruct = {
|
|
40255
|
+
s0: 5,
|
|
40256
|
+
s1: "",
|
|
40257
|
+
x0: "1",
|
|
40258
|
+
x1: "4.2.6",
|
|
40259
|
+
x2: "Windows",
|
|
40260
|
+
x3: "xhs-pc-web",
|
|
40261
|
+
x4: "4.86.0",
|
|
40262
|
+
x5: a1Value,
|
|
40263
|
+
x6: "",
|
|
40264
|
+
x7: "",
|
|
40265
|
+
x8: b1,
|
|
40266
|
+
x9: x9,
|
|
40267
|
+
x10: 0,
|
|
40268
|
+
x11: "normal"
|
|
40269
|
+
};
|
|
40270
|
+
const signJson = JSON.stringify(signStruct);
|
|
40271
|
+
return this.encoder.encode(signJson);
|
|
40272
|
+
}
|
|
40273
|
+
}
|
|
40274
|
+
class Xhshow {
|
|
40275
|
+
buildContentString(method, uri, payload = null) {
|
|
40276
|
+
payload = payload || {};
|
|
40277
|
+
if ('POST' === method.toUpperCase()) return uri + JSON.stringify(payload);
|
|
40278
|
+
if (0 === Object.keys(payload).length) return uri;
|
|
40279
|
+
{
|
|
40280
|
+
const params = Object.entries(payload).map(([key, value])=>{
|
|
40281
|
+
let valueStr;
|
|
40282
|
+
valueStr = Array.isArray(value) ? value.map((v)=>String(v)).join(',') : null !== value ? String(value) : '';
|
|
40283
|
+
valueStr = valueStr.replace(/=/g, '%3D');
|
|
40284
|
+
return `${key}=${valueStr}`;
|
|
40371
40285
|
});
|
|
40372
|
-
return
|
|
40373
|
-
} catch (_error) {
|
|
40374
|
-
return null;
|
|
40286
|
+
return `${uri}?${params.join('&')}`;
|
|
40375
40287
|
}
|
|
40376
|
-
}
|
|
40377
|
-
|
|
40378
|
-
|
|
40379
|
-
|
|
40380
|
-
|
|
40381
|
-
|
|
40288
|
+
}
|
|
40289
|
+
generateDValue(content) {
|
|
40290
|
+
return external_node_crypto_namespaceObject.createHash('md5').update(content, 'utf-8').digest('hex');
|
|
40291
|
+
}
|
|
40292
|
+
buildSignature(dValue, a1Value, xsecAppid = "xhs-pc-web", stringParam = "", timestamp) {
|
|
40293
|
+
const payloadArray = this.cryptoProcessor.buildPayloadArray(dValue, a1Value, xsecAppid, stringParam, timestamp);
|
|
40294
|
+
const xorResult = this.cryptoProcessor.bitOps.xorTransformArray(payloadArray);
|
|
40295
|
+
return this.cryptoProcessor.b64encoder.encodeX3(xorResult.slice(0, 124));
|
|
40296
|
+
}
|
|
40297
|
+
signXs(method, uri, a1Value, xsecAppid = "xhs-pc-web", payload = null, timestamp) {
|
|
40298
|
+
const validatedMethod = RequestSignatureValidator.validateMethod(method);
|
|
40299
|
+
const validatedUri = RequestSignatureValidator.validateUri(uri);
|
|
40300
|
+
const validatedA1Value = RequestSignatureValidator.validateA1Value(a1Value);
|
|
40301
|
+
const validatedXsecAppid = RequestSignatureValidator.validateXsecAppid(xsecAppid);
|
|
40302
|
+
const validatedPayload = RequestSignatureValidator.validatePayload(payload);
|
|
40303
|
+
const signatureData = JSON.parse(JSON.stringify(this.cryptoProcessor.config.SIGNATURE_DATA_TEMPLATE));
|
|
40304
|
+
const content = this.buildContentString(validatedMethod, validatedUri, validatedPayload);
|
|
40305
|
+
const dValue = this.generateDValue(content);
|
|
40306
|
+
signatureData.x3 = this.cryptoProcessor.config.X3_PREFIX + this.buildSignature(dValue, validatedA1Value, validatedXsecAppid, content, timestamp);
|
|
40307
|
+
const signatureJson = JSON.stringify(signatureData);
|
|
40308
|
+
return this.cryptoProcessor.config.XYS_PREFIX + this.cryptoProcessor.b64encoder.encode(signatureJson);
|
|
40309
|
+
}
|
|
40310
|
+
signXsGet(uri, a1Value, xsecAppid = "xhs-pc-web", params = null, timestamp) {
|
|
40311
|
+
return this.signXs('GET', uri, a1Value, xsecAppid, params, timestamp);
|
|
40312
|
+
}
|
|
40313
|
+
signXsPost(uri, a1Value, xsecAppid = "xhs-pc-web", payload = null, timestamp) {
|
|
40314
|
+
return this.signXs('POST', uri, a1Value, xsecAppid, payload, timestamp);
|
|
40315
|
+
}
|
|
40316
|
+
signXsCommon(cookieDict) {
|
|
40317
|
+
const cookies = this.parseCookies(cookieDict);
|
|
40318
|
+
return this.xsCommonSigner.sign(cookies);
|
|
40319
|
+
}
|
|
40320
|
+
signXsc(cookieDict) {
|
|
40321
|
+
return this.signXsCommon(cookieDict);
|
|
40322
|
+
}
|
|
40323
|
+
parseCookies(cookies) {
|
|
40324
|
+
if ('string' == typeof cookies) {
|
|
40325
|
+
const cookieObj = {};
|
|
40326
|
+
cookies.split(';').forEach((item)=>{
|
|
40327
|
+
const [key, value] = item.trim().split('=');
|
|
40328
|
+
if (key && value) cookieObj[key] = value;
|
|
40382
40329
|
});
|
|
40383
|
-
return
|
|
40384
|
-
} catch (_error) {
|
|
40385
|
-
return [];
|
|
40386
|
-
}
|
|
40387
|
-
};
|
|
40388
|
-
const [suggestWords, cityDistrict, userRights] = await Promise.all([
|
|
40389
|
-
getSuggestWords(),
|
|
40390
|
-
getCityDistrict(),
|
|
40391
|
-
getUserRights()
|
|
40392
|
-
]);
|
|
40393
|
-
return success({
|
|
40394
|
-
suggestWords,
|
|
40395
|
-
cityDistrict,
|
|
40396
|
-
userRights
|
|
40397
|
-
});
|
|
40398
|
-
};
|
|
40399
|
-
const getWeixinCollection = async (_task, params)=>{
|
|
40400
|
-
const http = new Http({
|
|
40401
|
-
headers: {
|
|
40402
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
40403
|
-
}
|
|
40404
|
-
});
|
|
40405
|
-
const fingerprint = "4695500bc93ab4ce8fb2692da6564e04";
|
|
40406
|
-
const res = await http.api({
|
|
40407
|
-
method: "get",
|
|
40408
|
-
url: "https://mp.weixin.qq.com/cgi-bin/appmsgalbummgr",
|
|
40409
|
-
params: {
|
|
40410
|
-
action: "list",
|
|
40411
|
-
begin: 0,
|
|
40412
|
-
count: 100,
|
|
40413
|
-
sub_title: "",
|
|
40414
|
-
type: 0,
|
|
40415
|
-
latest: 1,
|
|
40416
|
-
need_pay: 0,
|
|
40417
|
-
fingerprint,
|
|
40418
|
-
token: params.token,
|
|
40419
|
-
lang: "zh_CN",
|
|
40420
|
-
f: "json",
|
|
40421
|
-
ajax: 1
|
|
40422
|
-
}
|
|
40423
|
-
});
|
|
40424
|
-
return success(res.list_resp?.items ?? [], 0 === res.base_resp.ret ? "微信合计信息获取成功!" : "微信合集信息获取失败!");
|
|
40425
|
-
};
|
|
40426
|
-
const getWeixinConfig = async (_task, params)=>{
|
|
40427
|
-
const http = new Http({
|
|
40428
|
-
headers: {
|
|
40429
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
40330
|
+
return cookieObj;
|
|
40430
40331
|
}
|
|
40431
|
-
|
|
40432
|
-
|
|
40433
|
-
|
|
40434
|
-
|
|
40435
|
-
|
|
40436
|
-
|
|
40437
|
-
|
|
40438
|
-
|
|
40439
|
-
|
|
40440
|
-
|
|
40441
|
-
|
|
40442
|
-
|
|
40332
|
+
return cookies;
|
|
40333
|
+
}
|
|
40334
|
+
signHeaders(method, uri, cookies, xsecAppid = "xhs-pc-web", params, payload, timestamp) {
|
|
40335
|
+
if (void 0 === timestamp) timestamp = Date.now() / 1000;
|
|
40336
|
+
const methodUpper = method.toUpperCase();
|
|
40337
|
+
let requestData = null;
|
|
40338
|
+
if ('GET' === methodUpper) {
|
|
40339
|
+
if (null != payload) throw new Error("GET requests must use 'params', not 'payload'");
|
|
40340
|
+
requestData = params || null;
|
|
40341
|
+
} else if ('POST' === methodUpper) {
|
|
40342
|
+
if (null != params) throw new Error("POST requests must use 'payload', not 'params'");
|
|
40343
|
+
requestData = payload || null;
|
|
40344
|
+
} else throw new Error(`Unsupported method: ${method}`);
|
|
40345
|
+
const cookieDict = this.parseCookies(cookies);
|
|
40346
|
+
const a1Value = cookieDict.a1;
|
|
40347
|
+
if (!a1Value) throw new Error("Missing 'a1' in cookies");
|
|
40348
|
+
const xS = this.signXs(methodUpper, uri, a1Value, xsecAppid, requestData, timestamp);
|
|
40349
|
+
const xSCommon = this.signXsCommon(cookieDict);
|
|
40350
|
+
const xT = this.getXT(timestamp);
|
|
40351
|
+
const xB3Traceid = this.getB3TraceId();
|
|
40352
|
+
const xXrayTraceid = this.getXrayTraceId(Math.floor(1000 * timestamp));
|
|
40353
|
+
return {
|
|
40354
|
+
'x-s': xS,
|
|
40355
|
+
'x-s-common': xSCommon,
|
|
40356
|
+
'x-t': xT.toString(),
|
|
40357
|
+
'x-b3-traceid': xB3Traceid,
|
|
40358
|
+
'x-xray-traceid': xXrayTraceid
|
|
40359
|
+
};
|
|
40360
|
+
}
|
|
40361
|
+
signHeadersGet(uri, cookies, xsecAppid = "xhs-pc-web", params, timestamp) {
|
|
40362
|
+
return this.signHeaders('GET', uri, cookies, xsecAppid, params, void 0, timestamp);
|
|
40363
|
+
}
|
|
40364
|
+
signHeadersPost(uri, cookies, xsecAppid = "xhs-pc-web", payload, timestamp) {
|
|
40365
|
+
return this.signHeaders('POST', uri, cookies, xsecAppid, void 0, payload, timestamp);
|
|
40366
|
+
}
|
|
40367
|
+
decodeX3(x3Signature) {
|
|
40368
|
+
if (x3Signature.startsWith(this.cryptoProcessor.config.X3_PREFIX)) x3Signature = x3Signature.substring(this.cryptoProcessor.config.X3_PREFIX.length);
|
|
40369
|
+
const decodedBytes = this.cryptoProcessor.b64encoder.decodeX3(x3Signature);
|
|
40370
|
+
return this.cryptoProcessor.bitOps.xorTransformArray(Array.from(decodedBytes));
|
|
40371
|
+
}
|
|
40372
|
+
decodeXs(xsSignature) {
|
|
40373
|
+
if (xsSignature.startsWith(this.cryptoProcessor.config.XYS_PREFIX)) xsSignature = xsSignature.substring(this.cryptoProcessor.config.XYS_PREFIX.length);
|
|
40374
|
+
const jsonString = this.cryptoProcessor.b64encoder.decode(xsSignature);
|
|
40375
|
+
try {
|
|
40376
|
+
return JSON.parse(jsonString);
|
|
40377
|
+
} catch (e) {
|
|
40378
|
+
throw new Error(`Invalid signature: JSON decode failed - ${e}`);
|
|
40443
40379
|
}
|
|
40444
|
-
}
|
|
40445
|
-
|
|
40446
|
-
|
|
40447
|
-
}
|
|
40448
|
-
|
|
40449
|
-
|
|
40380
|
+
}
|
|
40381
|
+
getB3TraceId() {
|
|
40382
|
+
return this.cryptoProcessor.randomGen.generateB3TraceId();
|
|
40383
|
+
}
|
|
40384
|
+
getXrayTraceId(timestamp, seq) {
|
|
40385
|
+
return this.cryptoProcessor.randomGen.generateXrayTraceId(timestamp, seq);
|
|
40386
|
+
}
|
|
40387
|
+
getXT(timestamp) {
|
|
40388
|
+
if (void 0 === timestamp) timestamp = Date.now() / 1000;
|
|
40389
|
+
return Math.floor(1000 * timestamp);
|
|
40390
|
+
}
|
|
40391
|
+
buildUrl(baseUrl, params) {
|
|
40392
|
+
if (!params || 0 === Object.keys(params).length) return baseUrl;
|
|
40393
|
+
const queryString = Object.entries(params).map(([key, value])=>{
|
|
40394
|
+
const valueStr = Array.isArray(value) ? value.join(',') : String(value);
|
|
40395
|
+
return `${key}=${encodeURIComponent(valueStr)}`;
|
|
40396
|
+
}).join('&');
|
|
40397
|
+
return `${baseUrl}?${queryString}`;
|
|
40398
|
+
}
|
|
40399
|
+
buildJsonBody(payload) {
|
|
40400
|
+
return JSON.stringify(payload);
|
|
40401
|
+
}
|
|
40402
|
+
constructor(){
|
|
40403
|
+
this.cryptoProcessor = new CryptoProcessor();
|
|
40404
|
+
this.xsCommonSigner = new XsCommonSigner();
|
|
40405
|
+
}
|
|
40406
|
+
}
|
|
40407
|
+
new Xhshow();
|
|
40450
40408
|
const getXhsCollection_xsEncrypt = new Xhshow();
|
|
40451
40409
|
const CollectionDetailSchema = classic_schemas_object({
|
|
40452
40410
|
id: classic_schemas_string(),
|
|
@@ -42016,9 +41974,10 @@ var __webpack_exports__ = {};
|
|
|
42016
41974
|
timeout: 3000
|
|
42017
41975
|
});
|
|
42018
41976
|
}
|
|
41977
|
+
const isPublished = (note)=>!note.schedule_post_time;
|
|
42019
41978
|
const articleInfo = await fetchArticles(pageNum, onlySuccess);
|
|
42020
41979
|
let hasNextpage = -1 !== articleInfo.data.page;
|
|
42021
|
-
const filtered = articleInfo.data.notes;
|
|
41980
|
+
const filtered = articleInfo.data.notes.filter(isPublished);
|
|
42022
41981
|
let currentPage = pageNum + 1;
|
|
42023
41982
|
const usedPages = new Set();
|
|
42024
41983
|
while(filtered.length < pageSize && hasNextpage){
|
|
@@ -42028,7 +41987,7 @@ var __webpack_exports__ = {};
|
|
|
42028
41987
|
}
|
|
42029
41988
|
const res = await fetchArticles(currentPage, onlySuccess);
|
|
42030
41989
|
usedPages.add(currentPage);
|
|
42031
|
-
const validItems = res.data.notes;
|
|
41990
|
+
const validItems = res.data.notes.filter(isPublished);
|
|
42032
41991
|
filtered.push(...validItems);
|
|
42033
41992
|
currentPage++;
|
|
42034
41993
|
hasNextpage = -1 !== res.data.page;
|
|
@@ -52555,4 +52514,4 @@ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_targe
|
|
|
52555
52514
|
});
|
|
52556
52515
|
|
|
52557
52516
|
//# sourceMappingURL=bundle.js.map
|
|
52558
|
-
//# debugId=
|
|
52517
|
+
//# debugId=fdd0923e-73a8-549c-a3d0-16e8b052096c
|