@ikenxuan/amagi 6.1.3 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/default/index.cjs +355 -157
- package/dist/default/index.d.ts +810 -300
- package/dist/default/index.mjs +350 -152
- package/dist/exports/axios.cjs +2 -2
- package/dist/exports/express.cjs +2 -2
- package/package.json +21 -21
- /package/dist/{chunk-CKQMccvm.cjs → rolldown-runtime-D6vf50IK.cjs} +0 -0
package/dist/default/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import URL$1 from "node:url";
|
|
2
2
|
import { EventEmitter } from "node:events";
|
|
3
3
|
import zod from "zod";
|
|
4
|
-
import { Xhshow } from "@ikenxuan/xhshow-ts";
|
|
5
|
-
import crypto from "node:crypto";
|
|
4
|
+
import { CryptoConfig, FingerprintGenerator, Xhshow } from "@ikenxuan/xhshow-ts";
|
|
5
|
+
import crypto, { createCipheriv, createHash, randomBytes, randomUUID } from "node:crypto";
|
|
6
6
|
import axios, { AxiosError } from "axios";
|
|
7
7
|
import { Chalk } from "chalk";
|
|
8
8
|
import protobuf from "protobufjs";
|
|
@@ -1338,12 +1338,194 @@ const KuaishouMethodRoutes = {
|
|
|
1338
1338
|
emojiList: "/fetch_emoji_list"
|
|
1339
1339
|
};
|
|
1340
1340
|
//#endregion
|
|
1341
|
+
//#region src/platform/xiaohongshu/sign/config.ts
|
|
1342
|
+
/** 初始化签名配置。 */
|
|
1343
|
+
const createXiaohongshuCryptoConfig = () => new CryptoConfig().withOverrides({
|
|
1344
|
+
DATA_WEB_BUILD: "6.12.3",
|
|
1345
|
+
SIGNATURE_DATA_TEMPLATE: {
|
|
1346
|
+
x0: "4.3.5",
|
|
1347
|
+
x1: "xhs-pc-web",
|
|
1348
|
+
x2: "Windows",
|
|
1349
|
+
x3: "",
|
|
1350
|
+
x4: ""
|
|
1351
|
+
},
|
|
1352
|
+
SIGNATURE_XSCOMMON_TEMPLATE: {
|
|
1353
|
+
s0: 5,
|
|
1354
|
+
s1: "",
|
|
1355
|
+
x0: "1",
|
|
1356
|
+
x1: "4.3.5",
|
|
1357
|
+
x2: "Windows",
|
|
1358
|
+
x3: "xhs-pc-web",
|
|
1359
|
+
x4: "6.12.3",
|
|
1360
|
+
x5: "",
|
|
1361
|
+
x6: "",
|
|
1362
|
+
x7: "",
|
|
1363
|
+
x8: "",
|
|
1364
|
+
x9: -596800761,
|
|
1365
|
+
x10: 0,
|
|
1366
|
+
x11: "normal"
|
|
1367
|
+
}
|
|
1368
|
+
});
|
|
1369
|
+
//#endregion
|
|
1370
|
+
//#region src/platform/xiaohongshu/sign/guestCookie.ts
|
|
1371
|
+
/** @see https://github.com/Cialle/RedCrack */
|
|
1372
|
+
/** 小红书 Web 端游客会话初始化使用的浏览器请求头。 */
|
|
1373
|
+
const GUEST_HEADERS = {
|
|
1374
|
+
accept: "application/json, text/plain, */*",
|
|
1375
|
+
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
|
|
1376
|
+
"content-type": "application/json;charset=UTF-8",
|
|
1377
|
+
origin: "https://www.xiaohongshu.com",
|
|
1378
|
+
priority: "u=1, i",
|
|
1379
|
+
referer: "https://www.xiaohongshu.com/",
|
|
1380
|
+
"sec-ch-ua": "\"Microsoft Edge\";v=\"141\", \"Not?A_Brand\";v=\"8\", \"Chromium\";v=\"141\"",
|
|
1381
|
+
"sec-ch-ua-mobile": "?0",
|
|
1382
|
+
"sec-ch-ua-platform": "\"Windows\"",
|
|
1383
|
+
"sec-fetch-dest": "empty",
|
|
1384
|
+
"sec-fetch-mode": "cors",
|
|
1385
|
+
"sec-fetch-site": "same-site",
|
|
1386
|
+
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36 Edg/141.0.0.0"
|
|
1387
|
+
};
|
|
1388
|
+
/** 生成 a1 随机段时使用的 Web 端字符集。 */
|
|
1389
|
+
const COOKIE_RANDOM_CHARS = "abcdefghijklmnopqrstuvwxyz1234567890";
|
|
1390
|
+
/** 将 Cookie Jar 序列化为可直接写入 HTTP Cookie 请求头的字符串。 */
|
|
1391
|
+
const toCookieString = (cookies) => Object.entries(cookies).map(([key, value]) => `${key}=${value}`).join("; ");
|
|
1392
|
+
/** 将响应头中的 Set-Cookie 字段合并到当前游客会话的 Cookie Jar。 */
|
|
1393
|
+
const updateCookiesFromResponse = (cookies, setCookie) => {
|
|
1394
|
+
const headers = Array.isArray(setCookie) ? setCookie : setCookie ? [setCookie] : [];
|
|
1395
|
+
for (const header of headers) {
|
|
1396
|
+
const [nameValue] = header.split(";", 1);
|
|
1397
|
+
const separatorIndex = nameValue.indexOf("=");
|
|
1398
|
+
if (separatorIndex > 0) cookies[nameValue.slice(0, separatorIndex).trim()] = nameValue.slice(separatorIndex + 1).trim();
|
|
1399
|
+
}
|
|
1400
|
+
};
|
|
1401
|
+
/** 按小红书 Web 端规则生成 a1,以及由 a1 派生的 webId。 */
|
|
1402
|
+
const generateA1AndWebId = () => {
|
|
1403
|
+
const source = `${Date.now().toString(16)}${Array.from(randomBytes(30), (byte) => COOKIE_RANDOM_CHARS[byte % 36]).join("")}5000`;
|
|
1404
|
+
const a1 = `${source}${crc32(source)}`.slice(0, 52);
|
|
1405
|
+
return {
|
|
1406
|
+
a1,
|
|
1407
|
+
webId: createHash("md5").update(a1).digest("hex")
|
|
1408
|
+
};
|
|
1409
|
+
};
|
|
1410
|
+
/** 计算与浏览器端实现兼容的无符号 CRC32 校验值。 */
|
|
1411
|
+
const crc32 = (input) => {
|
|
1412
|
+
let value = 4294967295;
|
|
1413
|
+
for (const byte of Buffer.from(input)) {
|
|
1414
|
+
value ^= byte;
|
|
1415
|
+
for (let bit = 0; bit < 8; bit += 1) value = value & 1 ? value >>> 1 ^ 3988292384 : value >>> 1;
|
|
1416
|
+
}
|
|
1417
|
+
return (value ^ 4294967295) >>> 0;
|
|
1418
|
+
};
|
|
1419
|
+
/** 从 scripting 接口返回的 VMP 数据中解码 websectiga Cookie。 */
|
|
1420
|
+
const generateWebsectiga = (payload) => {
|
|
1421
|
+
const bMatch = payload.match(/"b":"(.*?)",/);
|
|
1422
|
+
const dMatch = payload.match(/"d":(.*?)\}\)/);
|
|
1423
|
+
if (!bMatch || !dMatch) throw new Error("小红书 scripting 响应格式异常,无法生成 websectiga");
|
|
1424
|
+
const decoderData = JSON.parse(dMatch[1]);
|
|
1425
|
+
const encoded = Buffer.from(bMatch[1], "base64").toString("utf8");
|
|
1426
|
+
const logicList = [];
|
|
1427
|
+
for (let index = 0; index < encoded.length; index += 5) logicList.push(Array.from(encoded.slice(index, index + 5), (char) => char.charCodeAt(0) - 1));
|
|
1428
|
+
const start = decoderData[92];
|
|
1429
|
+
const end = decoderData[93];
|
|
1430
|
+
const target = logicList.slice(start, end + 1);
|
|
1431
|
+
const key = Array.from({ length: 64 }, (_, index) => {
|
|
1432
|
+
const item = target[675 + index * 2];
|
|
1433
|
+
if (!item) throw new Error("小红书 scripting 响应缺少 websectiga 解码数据");
|
|
1434
|
+
return decoderData[item[2]];
|
|
1435
|
+
});
|
|
1436
|
+
return Array.from({ length: 8 }, (_, group) => {
|
|
1437
|
+
const offset = 56 - group * 8;
|
|
1438
|
+
return String.fromCharCode(...key.slice(offset, offset + 8));
|
|
1439
|
+
}).join("");
|
|
1440
|
+
};
|
|
1441
|
+
/** 将浏览器指纹编码为 webprofile 接口要求的 DES-ECB profileData。 */
|
|
1442
|
+
const encryptProfileData = (fingerprint, desKey) => {
|
|
1443
|
+
const encoded = Buffer.from(JSON.stringify(fingerprint)).toString("base64");
|
|
1444
|
+
const blockSize = 8;
|
|
1445
|
+
const padding = blockSize - encoded.length % blockSize;
|
|
1446
|
+
const plaintext = Buffer.concat([Buffer.from(encoded), Buffer.alloc(padding)]);
|
|
1447
|
+
const cipher = createCipheriv("des-ede3", Buffer.from(desKey.repeat(3)), null);
|
|
1448
|
+
cipher.setAutoPadding(false);
|
|
1449
|
+
return Buffer.concat([cipher.update(plaintext), cipher.final()]).toString("hex");
|
|
1450
|
+
};
|
|
1451
|
+
/** 将 scripting 的 JSON 或 JSONP 响应统一还原为结构化数据。 */
|
|
1452
|
+
const unwrapScriptingResponse = (data) => {
|
|
1453
|
+
if (typeof data === "string") {
|
|
1454
|
+
const json = data.match(/^[^(]+\((.*)\)$/s)?.[1];
|
|
1455
|
+
return JSON.parse(json ?? data);
|
|
1456
|
+
}
|
|
1457
|
+
return data;
|
|
1458
|
+
};
|
|
1459
|
+
/**
|
|
1460
|
+
* 创建小红书 Web 端游客会话 Cookie。
|
|
1461
|
+
*
|
|
1462
|
+
* 该流程对应 Web 端首次访问时的 Cookie 初始化:生成 a1/webId,完成
|
|
1463
|
+
* scripting、webprofile 与 activate 三个会话请求,并返回最终 Cookie 字符串。
|
|
1464
|
+
*/
|
|
1465
|
+
const createXiaohongshuGuestCookie = async (requestConfig) => {
|
|
1466
|
+
const cryptoConfig = createXiaohongshuCryptoConfig();
|
|
1467
|
+
const signer = new Xhshow(cryptoConfig);
|
|
1468
|
+
const cookies = {
|
|
1469
|
+
...generateA1AndWebId(),
|
|
1470
|
+
webBuild: cryptoConfig.DATA_WEB_BUILD,
|
|
1471
|
+
xsecappid: "xhs-pc-web",
|
|
1472
|
+
loadts: String(Date.now()),
|
|
1473
|
+
abRequestId: randomUUID()
|
|
1474
|
+
};
|
|
1475
|
+
const { headers: requestHeaders, params: _params, ...transportConfig } = requestConfig ?? {};
|
|
1476
|
+
/** 发送会话初始化请求,并将响应中的 Set-Cookie 合并回当前 Cookie Jar。 */
|
|
1477
|
+
const request = async (url, data, signed = false) => {
|
|
1478
|
+
const signatureHeaders = signed ? signer.signHeadersPost(new URL(url).pathname, cookies, "xhs-pc-web", data) : {};
|
|
1479
|
+
const response = await axios({
|
|
1480
|
+
...transportConfig,
|
|
1481
|
+
method: "POST",
|
|
1482
|
+
url,
|
|
1483
|
+
data,
|
|
1484
|
+
validateStatus: () => true,
|
|
1485
|
+
headers: {
|
|
1486
|
+
...GUEST_HEADERS,
|
|
1487
|
+
...requestHeaders,
|
|
1488
|
+
...signatureHeaders,
|
|
1489
|
+
Cookie: toCookieString(cookies)
|
|
1490
|
+
}
|
|
1491
|
+
});
|
|
1492
|
+
updateCookiesFromResponse(cookies, response.headers["set-cookie"]);
|
|
1493
|
+
if (response.status < 200 || response.status >= 300) throw new Error(`小红书游客会话初始化失败:${url} 返回 HTTP ${response.status}`);
|
|
1494
|
+
return response.data;
|
|
1495
|
+
};
|
|
1496
|
+
const scriptingData = unwrapScriptingResponse(await request("https://as.xiaohongshu.com/api/sec/v1/scripting", {
|
|
1497
|
+
callFrom: "web",
|
|
1498
|
+
callback: "seccallback"
|
|
1499
|
+
})).data;
|
|
1500
|
+
if (!scriptingData?.data || !scriptingData.secPoisonId) throw new Error("小红书 scripting 响应缺少游客会话数据");
|
|
1501
|
+
cookies.websectiga = generateWebsectiga(scriptingData.data);
|
|
1502
|
+
cookies.sec_poison_id = scriptingData.secPoisonId;
|
|
1503
|
+
const fingerprint = new FingerprintGenerator(cryptoConfig).generate(cookies, GUEST_HEADERS["user-agent"]);
|
|
1504
|
+
await request(cryptoConfig.GID_URL, {
|
|
1505
|
+
platform: cryptoConfig.DATA_PLATFORM,
|
|
1506
|
+
profileData: encryptProfileData(fingerprint, cryptoConfig.DES_KEY),
|
|
1507
|
+
sdkVersion: cryptoConfig.DATA_SDK_VERSION,
|
|
1508
|
+
svn: cryptoConfig.DATA_SVN
|
|
1509
|
+
}, true);
|
|
1510
|
+
await request("https://edith.xiaohongshu.com/api/sns/web/v1/login/activate", {}, true);
|
|
1511
|
+
if (!cookies.web_session) throw new Error("小红书游客会话初始化失败:未获取到 web_session");
|
|
1512
|
+
return toCookieString(cookies);
|
|
1513
|
+
};
|
|
1514
|
+
//#endregion
|
|
1341
1515
|
//#region src/platform/xiaohongshu/sign/index.ts
|
|
1342
1516
|
/**
|
|
1343
1517
|
* 小红书签名算法类
|
|
1344
1518
|
*/
|
|
1345
1519
|
var xiaohongshuSign = class {
|
|
1346
|
-
static client = new Xhshow();
|
|
1520
|
+
static client = new Xhshow(createXiaohongshuCryptoConfig());
|
|
1521
|
+
/**
|
|
1522
|
+
* 创建包含 web_session 的小红书 Web 端游客 Cookie。
|
|
1523
|
+
*
|
|
1524
|
+
* `requestConfig` 会透传到游客会话初始化请求,可用于配置代理、超时等传输参数。
|
|
1525
|
+
*/
|
|
1526
|
+
static createGuestCookie(requestConfig) {
|
|
1527
|
+
return createXiaohongshuGuestCookie(requestConfig);
|
|
1528
|
+
}
|
|
1347
1529
|
/**
|
|
1348
1530
|
* 生成GET请求的X-S签名
|
|
1349
1531
|
* @param path - API路径
|
|
@@ -1556,7 +1738,7 @@ const xiaohongshuApiUrls = {
|
|
|
1556
1738
|
* @param data - 请求参数
|
|
1557
1739
|
* @returns 完整的接口URL
|
|
1558
1740
|
*/
|
|
1559
|
-
emojiList(
|
|
1741
|
+
emojiList(_data) {
|
|
1560
1742
|
return {
|
|
1561
1743
|
apiPath: "/api/im/redmoji/detail",
|
|
1562
1744
|
Url: "https://edith.xiaohongshu.com/api/im/redmoji/detail"
|
|
@@ -2462,7 +2644,7 @@ const generateSecChUa = (userAgent) => {
|
|
|
2462
2644
|
*/
|
|
2463
2645
|
const getDouyinDefaultConfig = (cookie, requestConfig) => {
|
|
2464
2646
|
let finalUserAgent = requestConfig?.headers?.["User-Agent"] ?? "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36";
|
|
2465
|
-
finalUserAgent = finalUserAgent.replace(/\s+Edg\/[\d
|
|
2647
|
+
finalUserAgent = finalUserAgent.replace(/\s+Edg\/[\d.]+/g, "");
|
|
2466
2648
|
const defHeaders = {
|
|
2467
2649
|
Accept: "application/json, text/plain, */*",
|
|
2468
2650
|
"Accept-Encoding": "gzip, deflate, br, zstd",
|
|
@@ -2637,7 +2819,8 @@ var SM3 = class {
|
|
|
2637
2819
|
this.chunk = this.chunk.concat(a.slice(0, f));
|
|
2638
2820
|
while (this.chunk.length >= 64) {
|
|
2639
2821
|
this._compress(this.chunk);
|
|
2640
|
-
f < a.length
|
|
2822
|
+
if (f < a.length) this.chunk = a.slice(f, Math.min(f + 64, a.length));
|
|
2823
|
+
else this.chunk = [];
|
|
2641
2824
|
f += 64;
|
|
2642
2825
|
}
|
|
2643
2826
|
}
|
|
@@ -2673,10 +2856,17 @@ var SM3 = class {
|
|
|
2673
2856
|
if (t.length < 64) console.error("compress error: not enough data");
|
|
2674
2857
|
else {
|
|
2675
2858
|
for (var f = ((e) => {
|
|
2676
|
-
for (var r = new Array(132), t = 0; t < 16; t++)
|
|
2859
|
+
for (var r = new Array(132), t = 0; t < 16; t++) {
|
|
2860
|
+
r[t] = e[4 * t] << 24;
|
|
2861
|
+
r[t] |= e[4 * t + 1] << 16;
|
|
2862
|
+
r[t] |= e[4 * t + 2] << 8;
|
|
2863
|
+
r[t] |= e[4 * t + 3];
|
|
2864
|
+
r[t] >>>= 0;
|
|
2865
|
+
}
|
|
2677
2866
|
for (var n = 16; n < 68; n++) {
|
|
2678
2867
|
let a = r[n - 16] ^ r[n - 9] ^ this.le(r[n - 3], 15);
|
|
2679
|
-
a = a ^ this.le(a, 15) ^ this.le(a, 23)
|
|
2868
|
+
a = a ^ this.le(a, 15) ^ this.le(a, 23);
|
|
2869
|
+
r[n] = (a ^ this.le(r[n - 13], 7) ^ r[n - 6]) >>> 0;
|
|
2680
2870
|
}
|
|
2681
2871
|
for (n = 0; n < 64; n++) r[n + 68] = (r[n] ^ r[n + 4]) >>> 0;
|
|
2682
2872
|
return r;
|
|
@@ -2686,7 +2876,15 @@ var SM3 = class {
|
|
|
2686
2876
|
let u = this.pe(c, i[0], i[1], i[2]);
|
|
2687
2877
|
u = (4294967295 & (u = u + i[3] + s + f[c + 68])) >>> 0;
|
|
2688
2878
|
let b = this.he(c, i[4], i[5], i[6]);
|
|
2689
|
-
b = (4294967295 & (b = b + i[7] + o + f[c])) >>> 0
|
|
2879
|
+
b = (4294967295 & (b = b + i[7] + o + f[c])) >>> 0;
|
|
2880
|
+
i[3] = i[2];
|
|
2881
|
+
i[2] = this.le(i[1], 9);
|
|
2882
|
+
i[1] = i[0];
|
|
2883
|
+
i[0] = u;
|
|
2884
|
+
i[7] = i[6];
|
|
2885
|
+
i[6] = this.le(i[5], 19);
|
|
2886
|
+
i[5] = i[4];
|
|
2887
|
+
i[4] = (b ^ this.le(b, 9) ^ this.le(b, 17)) >>> 0;
|
|
2690
2888
|
}
|
|
2691
2889
|
for (let l = 0; l < 8; l++) this.reg[l] = (this.reg[l] ^ i[l]) >>> 0;
|
|
2692
2890
|
}
|
|
@@ -2997,7 +3195,7 @@ function generate_random_str() {
|
|
|
2997
3195
|
* @returns 清理后的User-Agent字符串
|
|
2998
3196
|
*/
|
|
2999
3197
|
const cleanUserAgentForSigning = (userAgent) => {
|
|
3000
|
-
return userAgent.replace(/\s+Edg\/[\d
|
|
3198
|
+
return userAgent.replace(/\s+Edg\/[\d.]+/g, "");
|
|
3001
3199
|
};
|
|
3002
3200
|
/**
|
|
3003
3201
|
* 抖音a_bogus签名算法
|
|
@@ -3119,7 +3317,6 @@ var XBogus = class {
|
|
|
3119
3317
|
const array2 = this.md5StrToArray(this.md5(this.md5StrToArray("d41d8cd98f00b204e9800998ecf8427e")));
|
|
3120
3318
|
const urlEncryptedArray = this.md5Encrypt(urlPath);
|
|
3121
3319
|
const timestamp = Math.floor(Date.now() / 1e3);
|
|
3122
|
-
const ct = 536919696;
|
|
3123
3320
|
const newArray = [
|
|
3124
3321
|
64,
|
|
3125
3322
|
1,
|
|
@@ -3135,10 +3332,10 @@ var XBogus = class {
|
|
|
3135
3332
|
timestamp >> 16 & 255,
|
|
3136
3333
|
timestamp >> 8 & 255,
|
|
3137
3334
|
timestamp & 255,
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3335
|
+
32,
|
|
3336
|
+
0,
|
|
3337
|
+
190,
|
|
3338
|
+
144
|
|
3142
3339
|
];
|
|
3143
3340
|
let xorResult = newArray[0];
|
|
3144
3341
|
for (let i = 1; i < newArray.length; i++) xorResult ^= newArray[i];
|
|
@@ -4058,7 +4255,7 @@ const DouyinData = async (data, cookie, requestConfig) => {
|
|
|
4058
4255
|
if (isInvalidResponse) {
|
|
4059
4256
|
const desc = `抖音${typeStr}搜索返回无有效数据,疑似触发反爬机制,你的抖音Cookie可能已经失效!`;
|
|
4060
4257
|
const warningMessage = `
|
|
4061
|
-
获取响应数据失败!原因:${
|
|
4258
|
+
获取响应数据失败!原因:${typeStr}搜索返回无有效数据,疑似触发反爬机制
|
|
4062
4259
|
请求类型:「${data.methodType}」
|
|
4063
4260
|
搜索关键词:「${data.query}」
|
|
4064
4261
|
请求URL:${url}
|
|
@@ -4077,12 +4274,12 @@ const DouyinData = async (data, cookie, requestConfig) => {
|
|
|
4077
4274
|
if (!list || list.length === 0) {
|
|
4078
4275
|
const desc = `抖音${typeStr}搜索接口第一次请求就返回空数组,可能该关键词无搜索结果或触发风控限制,你的抖音Cookie可能已经失效!`;
|
|
4079
4276
|
const warningMessage = `
|
|
4080
|
-
获取响应数据失败!原因:${
|
|
4277
|
+
获取响应数据失败!原因:${typeStr}搜索接口第一次请求就返回空数组,你的抖音Cookie可能已经失效!
|
|
4081
4278
|
请求类型:「${data.methodType}」
|
|
4082
4279
|
搜索关键词:「${data.query}」
|
|
4083
4280
|
请求URL:${url}
|
|
4084
4281
|
`;
|
|
4085
|
-
|
|
4282
|
+
emitLogWarn(warningMessage);
|
|
4086
4283
|
return {
|
|
4087
4284
|
data: raw,
|
|
4088
4285
|
amagiError: {
|
|
@@ -4173,7 +4370,7 @@ const DouyinData = async (data, cookie, requestConfig) => {
|
|
|
4173
4370
|
});
|
|
4174
4371
|
currentStart = currentEnd;
|
|
4175
4372
|
}
|
|
4176
|
-
|
|
4373
|
+
emitLogDebug(`弹幕数据需要分${segments.length}段获取,总时长:${totalDuration}ms`);
|
|
4177
4374
|
const segmentPromises = segments.map(async (segment, index) => {
|
|
4178
4375
|
const url = douyinApiUrls.getDanmakuList({
|
|
4179
4376
|
aweme_id: data.aweme_id,
|
|
@@ -4186,10 +4383,10 @@ const DouyinData = async (data, cookie, requestConfig) => {
|
|
|
4186
4383
|
...baseRequestConfig,
|
|
4187
4384
|
url: buildSignedUrl(url, signType, userAgent)
|
|
4188
4385
|
});
|
|
4189
|
-
|
|
4386
|
+
emitLogDebug(`弹幕第${index + 1}段获取成功 (${segment.start}ms-${segment.end}ms)`);
|
|
4190
4387
|
return segmentData;
|
|
4191
4388
|
} catch (error) {
|
|
4192
|
-
|
|
4389
|
+
emitLogDebug(`弹幕第${index + 1}段获取失败 (${segment.start}ms-${segment.end}ms):`, error);
|
|
4193
4390
|
return null;
|
|
4194
4391
|
}
|
|
4195
4392
|
});
|
|
@@ -4218,7 +4415,7 @@ const DouyinData = async (data, cookie, requestConfig) => {
|
|
|
4218
4415
|
extra: finalExtra,
|
|
4219
4416
|
log_pb: finalLogPb
|
|
4220
4417
|
};
|
|
4221
|
-
|
|
4418
|
+
emitLogDebug(`弹幕数据合并完成,共获取${mergedDanmakuList.length}条弹幕`);
|
|
4222
4419
|
return finalDanmakuData;
|
|
4223
4420
|
}
|
|
4224
4421
|
default: {
|
|
@@ -4230,7 +4427,7 @@ const DouyinData = async (data, cookie, requestConfig) => {
|
|
|
4230
4427
|
url
|
|
4231
4428
|
});
|
|
4232
4429
|
}
|
|
4233
|
-
|
|
4430
|
+
emitLogWarn(`未知的抖音数据接口:「${data.methodType}」`);
|
|
4234
4431
|
return null;
|
|
4235
4432
|
}
|
|
4236
4433
|
}
|
|
@@ -4298,11 +4495,11 @@ const GlobalGetData$3 = async (type, config) => {
|
|
|
4298
4495
|
requestUrl: config.url
|
|
4299
4496
|
};
|
|
4300
4497
|
warningMessage = `
|
|
4301
|
-
|
|
4498
|
+
获取响应数据失败!原因:接口返回内容为空,你的抖音ck可能已经失效!
|
|
4302
4499
|
请求类型:「${type}」
|
|
4303
4500
|
请求URL:${config.url}
|
|
4304
4501
|
`;
|
|
4305
|
-
|
|
4502
|
+
emitLogWarn(warningMessage);
|
|
4306
4503
|
const cookieError = new Error(Err.errorDescription);
|
|
4307
4504
|
Object.assign(cookieError, {
|
|
4308
4505
|
code: "INVALID_COOKIE",
|
|
@@ -4319,11 +4516,11 @@ const GlobalGetData$3 = async (type, config) => {
|
|
|
4319
4516
|
requestUrl: config.url
|
|
4320
4517
|
};
|
|
4321
4518
|
warningMessage = `
|
|
4322
|
-
获取响应数据失败!原因:${
|
|
4519
|
+
获取响应数据失败!原因:${filterReason}
|
|
4323
4520
|
请求类型:「${type}」
|
|
4324
4521
|
请求URL:${config.url}
|
|
4325
4522
|
`;
|
|
4326
|
-
|
|
4523
|
+
emitLogWarn(warningMessage);
|
|
4327
4524
|
const filterError = new Error(Err.errorDescription);
|
|
4328
4525
|
Object.assign(filterError, {
|
|
4329
4526
|
code: "CONTENT_FILTERED",
|
|
@@ -5301,6 +5498,8 @@ const encodeBase64Url = (bytes) => {
|
|
|
5301
5498
|
* 数据流而最小化保留的局部算法。
|
|
5302
5499
|
*/
|
|
5303
5500
|
var KuaishouChaChaCipher = class {
|
|
5501
|
+
key;
|
|
5502
|
+
nonce;
|
|
5304
5503
|
wordIndex = 0;
|
|
5305
5504
|
state = new Array(16).fill(0);
|
|
5306
5505
|
constructor(key, nonce) {
|
|
@@ -6133,7 +6332,7 @@ const captureKuaishouEncodeStack = () => {
|
|
|
6133
6332
|
* @returns 用于 `SECS.s` 的栈尾字符串
|
|
6134
6333
|
*/
|
|
6135
6334
|
const deriveKuaishouSecsStackTail = (stack = captureKuaishouEncodeStack()) => {
|
|
6136
|
-
return stack.length > KUAISHOU_SECS_STACK_LIMIT ? stack.slice(-
|
|
6335
|
+
return stack.length > KUAISHOU_SECS_STACK_LIMIT ? stack.slice(-100) : stack;
|
|
6137
6336
|
};
|
|
6138
6337
|
/**
|
|
6139
6338
|
* 构造快手 `window.SECS` 的纯算法等价状态。
|
|
@@ -6986,7 +7185,7 @@ const KuaishouData = async (data, cookie, requestConfig) => {
|
|
|
6986
7185
|
}
|
|
6987
7186
|
case "emojiList": return fetchKuaishouGraphqlPayload(data.methodType, kuaishouApiUrls.emojiList());
|
|
6988
7187
|
default:
|
|
6989
|
-
|
|
7188
|
+
emitLogWarn(`Unknown Kuaishou API method: "${data.methodType}"`);
|
|
6990
7189
|
return null;
|
|
6991
7190
|
}
|
|
6992
7191
|
};
|
|
@@ -7025,12 +7224,12 @@ const GlobalGetData$2 = async (type, options, config) => {
|
|
|
7025
7224
|
requestBody: JSON.stringify(options.data)
|
|
7026
7225
|
};
|
|
7027
7226
|
warningMessage = `
|
|
7028
|
-
|
|
7227
|
+
获取响应数据失败!原因:接口返回内容为空,你的快手ck可能已经失效!
|
|
7029
7228
|
请求类型:「${type}」
|
|
7030
7229
|
请求URL:${options.url}
|
|
7031
7230
|
请求参数:${JSON.stringify(options.data, null, 2)}
|
|
7032
7231
|
`;
|
|
7033
|
-
|
|
7232
|
+
emitLogWarn(warningMessage);
|
|
7034
7233
|
const cookieError = new Error(Err.errorDescription);
|
|
7035
7234
|
Object.assign(cookieError, {
|
|
7036
7235
|
code: "INVALID_COOKIE",
|
|
@@ -7265,132 +7464,136 @@ function createBoundKuaishouFetcher(cookie, requestConfig) {
|
|
|
7265
7464
|
* @returns 返回小红书数据
|
|
7266
7465
|
*/
|
|
7267
7466
|
const XiaohongshuData = async (data, cookie, requestConfig) => {
|
|
7268
|
-
|
|
7269
|
-
const
|
|
7270
|
-
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
...
|
|
7275
|
-
...requestConfig?.headers ?? {}
|
|
7276
|
-
}
|
|
7277
|
-
};
|
|
7278
|
-
const xiaohongshuApiUrls = createXiaohongshuApiUrls();
|
|
7279
|
-
switch (data.methodType) {
|
|
7280
|
-
case "homeFeed": return await GlobalGetData$1(data.methodType, {
|
|
7281
|
-
...baseRequestConfig,
|
|
7282
|
-
url: xiaohongshuApiUrls.homeFeed(data).Url,
|
|
7283
|
-
data: JSON.stringify(xiaohongshuApiUrls.homeFeed(data).Body),
|
|
7284
|
-
headers: {
|
|
7285
|
-
...baseRequestConfig.headers,
|
|
7286
|
-
"x-s": xiaohongshuSign.generateXSPost(xiaohongshuApiUrls.homeFeed(data).apiPath, xiaohongshuSign.extractA1FromCookie(cookie ?? ""), "xhs-pc-web", xiaohongshuApiUrls.homeFeed(data).Body),
|
|
7287
|
-
"x-s-common": xiaohongshuSign.generateXSCommon(cookie ?? ""),
|
|
7288
|
-
"x-t": xiaohongshuSign.generateXT()
|
|
7289
|
-
}
|
|
7290
|
-
});
|
|
7291
|
-
case "noteDetail": return await GlobalGetData$1(data.methodType, {
|
|
7292
|
-
...baseRequestConfig,
|
|
7293
|
-
url: xiaohongshuApiUrls.noteDetail(data).Url,
|
|
7294
|
-
data: xiaohongshuApiUrls.noteDetail(data).Body,
|
|
7467
|
+
/** 使用指定 Cookie 构建一次完整的小红书 API 请求。 */
|
|
7468
|
+
const requestWithCookie = async (requestCookie) => {
|
|
7469
|
+
const defHeaders = getXiaohongshuDefaultConfig(requestCookie)["headers"];
|
|
7470
|
+
const baseRequestConfig = {
|
|
7471
|
+
method: "POST",
|
|
7472
|
+
timeout: 1e4,
|
|
7473
|
+
...requestConfig,
|
|
7295
7474
|
headers: {
|
|
7296
|
-
...
|
|
7297
|
-
|
|
7298
|
-
"x-s-common": xiaohongshuSign.generateXSCommon(cookie ?? ""),
|
|
7299
|
-
"x-t": xiaohongshuSign.generateXT()
|
|
7475
|
+
...defHeaders,
|
|
7476
|
+
...requestConfig?.headers ?? {}
|
|
7300
7477
|
}
|
|
7301
|
-
}
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
timeout: 1e4,
|
|
7306
|
-
...requestConfig,
|
|
7307
|
-
headers: {
|
|
7308
|
-
...defHeaders,
|
|
7309
|
-
...requestConfig?.headers ?? {}
|
|
7310
|
-
}
|
|
7311
|
-
};
|
|
7312
|
-
return await GlobalGetData$1(data.methodType, {
|
|
7478
|
+
};
|
|
7479
|
+
const xiaohongshuApiUrls = createXiaohongshuApiUrls();
|
|
7480
|
+
switch (data.methodType) {
|
|
7481
|
+
case "homeFeed": return await GlobalGetData$1(data.methodType, {
|
|
7313
7482
|
...baseRequestConfig,
|
|
7314
|
-
url: xiaohongshuApiUrls.
|
|
7483
|
+
url: xiaohongshuApiUrls.homeFeed(data).Url,
|
|
7484
|
+
data: JSON.stringify(xiaohongshuApiUrls.homeFeed(data).Body),
|
|
7315
7485
|
headers: {
|
|
7316
7486
|
...baseRequestConfig.headers,
|
|
7317
|
-
"x-s": xiaohongshuSign.
|
|
7318
|
-
"x-s-common": xiaohongshuSign.generateXSCommon(
|
|
7487
|
+
"x-s": xiaohongshuSign.generateXSPost(xiaohongshuApiUrls.homeFeed(data).apiPath, xiaohongshuSign.extractA1FromCookie(requestCookie), "xhs-pc-web", xiaohongshuApiUrls.homeFeed(data).Body),
|
|
7488
|
+
"x-s-common": xiaohongshuSign.generateXSCommon(requestCookie),
|
|
7319
7489
|
"x-t": xiaohongshuSign.generateXT()
|
|
7320
7490
|
}
|
|
7321
7491
|
});
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
timeout: 1e4,
|
|
7327
|
-
...requestConfig,
|
|
7492
|
+
case "noteDetail": return await GlobalGetData$1(data.methodType, {
|
|
7493
|
+
...baseRequestConfig,
|
|
7494
|
+
url: xiaohongshuApiUrls.noteDetail(data).Url,
|
|
7495
|
+
data: xiaohongshuApiUrls.noteDetail(data).Body,
|
|
7328
7496
|
headers: {
|
|
7329
|
-
...
|
|
7330
|
-
|
|
7497
|
+
...baseRequestConfig.headers,
|
|
7498
|
+
"x-s": xiaohongshuSign.generateXSPost(xiaohongshuApiUrls.noteDetail(data).apiPath, xiaohongshuSign.extractA1FromCookie(requestCookie), "xhs-pc-web", xiaohongshuApiUrls.noteDetail(data).Body),
|
|
7499
|
+
"x-s-common": xiaohongshuSign.generateXSCommon(requestCookie),
|
|
7500
|
+
"x-t": xiaohongshuSign.generateXT()
|
|
7331
7501
|
}
|
|
7332
|
-
};
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7502
|
+
});
|
|
7503
|
+
case "noteComments": {
|
|
7504
|
+
const baseRequestConfig = {
|
|
7505
|
+
method: "GET",
|
|
7506
|
+
timeout: 1e4,
|
|
7507
|
+
...requestConfig,
|
|
7508
|
+
headers: {
|
|
7509
|
+
...defHeaders,
|
|
7510
|
+
...requestConfig?.headers ?? {}
|
|
7511
|
+
}
|
|
7512
|
+
};
|
|
7513
|
+
return await GlobalGetData$1(data.methodType, {
|
|
7336
7514
|
...baseRequestConfig,
|
|
7337
|
-
url: xiaohongshuApiUrls.
|
|
7515
|
+
url: xiaohongshuApiUrls.noteComments(data).Url,
|
|
7338
7516
|
headers: {
|
|
7339
7517
|
...baseRequestConfig.headers,
|
|
7340
|
-
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls.
|
|
7341
|
-
"x-s-common": xiaohongshuSign.generateXSCommon(
|
|
7518
|
+
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls.noteComments(data).apiPath, xiaohongshuSign.extractA1FromCookie(requestCookie), "xhs-pc-web"),
|
|
7519
|
+
"x-s-common": xiaohongshuSign.generateXSCommon(requestCookie),
|
|
7342
7520
|
"x-t": xiaohongshuSign.generateXT()
|
|
7343
7521
|
}
|
|
7344
|
-
})
|
|
7345
|
-
msg: "success"
|
|
7346
|
-
};
|
|
7347
|
-
}
|
|
7348
|
-
case "userNoteList": return await GlobalGetData$1(data.methodType, {
|
|
7349
|
-
...baseRequestConfig,
|
|
7350
|
-
method: "GET",
|
|
7351
|
-
url: xiaohongshuApiUrls.userNoteList(data).Url,
|
|
7352
|
-
headers: {
|
|
7353
|
-
...baseRequestConfig.headers,
|
|
7354
|
-
"x-b3-traceid": xiaohongshuSign.generateXB3Traceid(),
|
|
7355
|
-
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls.userNoteList(data).apiPath, xiaohongshuSign.extractA1FromCookie(cookie ?? ""), "xhs-pc-web"),
|
|
7356
|
-
"x-s-common": xiaohongshuSign.generateXSCommon(cookie ?? ""),
|
|
7357
|
-
"x-t": xiaohongshuSign.generateXT()
|
|
7522
|
+
});
|
|
7358
7523
|
}
|
|
7359
|
-
|
|
7360
|
-
|
|
7361
|
-
|
|
7524
|
+
case "userProfile": {
|
|
7525
|
+
const baseRequestConfig = {
|
|
7526
|
+
method: "GET",
|
|
7527
|
+
timeout: 1e4,
|
|
7528
|
+
...requestConfig,
|
|
7529
|
+
headers: {
|
|
7530
|
+
...defHeaders,
|
|
7531
|
+
...requestConfig?.headers ?? {}
|
|
7532
|
+
}
|
|
7533
|
+
};
|
|
7534
|
+
return {
|
|
7535
|
+
code: 0,
|
|
7536
|
+
data: extractCreatorInfoFromHtml(await GlobalGetData$1(data.methodType, {
|
|
7537
|
+
...baseRequestConfig,
|
|
7538
|
+
url: xiaohongshuApiUrls.userProfile(data).Url,
|
|
7539
|
+
headers: {
|
|
7540
|
+
...baseRequestConfig.headers,
|
|
7541
|
+
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls.userProfile(data).apiPath, xiaohongshuSign.extractA1FromCookie(requestCookie), "xhs-pc-web"),
|
|
7542
|
+
"x-s-common": xiaohongshuSign.generateXSCommon(requestCookie),
|
|
7543
|
+
"x-t": xiaohongshuSign.generateXT()
|
|
7544
|
+
}
|
|
7545
|
+
})),
|
|
7546
|
+
msg: "success"
|
|
7547
|
+
};
|
|
7548
|
+
}
|
|
7549
|
+
case "userNoteList": return await GlobalGetData$1(data.methodType, {
|
|
7550
|
+
...baseRequestConfig,
|
|
7362
7551
|
method: "GET",
|
|
7363
|
-
|
|
7364
|
-
...requestConfig,
|
|
7552
|
+
url: xiaohongshuApiUrls.userNoteList(data).Url,
|
|
7365
7553
|
headers: {
|
|
7366
|
-
...
|
|
7367
|
-
|
|
7554
|
+
...baseRequestConfig.headers,
|
|
7555
|
+
"x-b3-traceid": xiaohongshuSign.generateXB3Traceid(),
|
|
7556
|
+
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls.userNoteList(data).apiPath, xiaohongshuSign.extractA1FromCookie(requestCookie), "xhs-pc-web"),
|
|
7557
|
+
"x-s-common": xiaohongshuSign.generateXSCommon(requestCookie),
|
|
7558
|
+
"x-t": xiaohongshuSign.generateXT()
|
|
7368
7559
|
}
|
|
7369
|
-
};
|
|
7370
|
-
|
|
7560
|
+
});
|
|
7561
|
+
case "emojiList": {
|
|
7562
|
+
const baseRequestConfig = {
|
|
7563
|
+
method: "GET",
|
|
7564
|
+
timeout: 1e4,
|
|
7565
|
+
...requestConfig,
|
|
7566
|
+
headers: {
|
|
7567
|
+
...defHeaders,
|
|
7568
|
+
...requestConfig?.headers ?? {}
|
|
7569
|
+
}
|
|
7570
|
+
};
|
|
7571
|
+
return await GlobalGetData$1(data.methodType, {
|
|
7572
|
+
...baseRequestConfig,
|
|
7573
|
+
url: xiaohongshuApiUrls.emojiList(data).Url,
|
|
7574
|
+
headers: {
|
|
7575
|
+
...baseRequestConfig.headers,
|
|
7576
|
+
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls.emojiList(data).apiPath, xiaohongshuSign.extractA1FromCookie(requestCookie), "xhs-pc-web"),
|
|
7577
|
+
"x-s-common": xiaohongshuSign.generateXSCommon(requestCookie),
|
|
7578
|
+
"x-t": xiaohongshuSign.generateXT()
|
|
7579
|
+
}
|
|
7580
|
+
});
|
|
7581
|
+
}
|
|
7582
|
+
case "searchNotes": return await GlobalGetData$1(data.methodType, {
|
|
7371
7583
|
...baseRequestConfig,
|
|
7372
|
-
url: xiaohongshuApiUrls.
|
|
7584
|
+
url: xiaohongshuApiUrls.searchNotes(data).Url,
|
|
7585
|
+
data: xiaohongshuApiUrls.searchNotes(data).Body,
|
|
7373
7586
|
headers: {
|
|
7374
7587
|
...baseRequestConfig.headers,
|
|
7375
|
-
"x-s": xiaohongshuSign.
|
|
7376
|
-
"x-s-common": xiaohongshuSign.generateXSCommon(
|
|
7588
|
+
"x-s": xiaohongshuSign.generateXSPost(xiaohongshuApiUrls.searchNotes(data).apiPath, xiaohongshuSign.extractA1FromCookie(requestCookie), "xhs-pc-web"),
|
|
7589
|
+
"x-s-common": xiaohongshuSign.generateXSCommon(requestCookie),
|
|
7377
7590
|
"x-t": xiaohongshuSign.generateXT()
|
|
7378
7591
|
}
|
|
7379
7592
|
});
|
|
7593
|
+
default: throw new Error(`Unknown Xiaohongshu API method: "${data.methodType}"`);
|
|
7380
7594
|
}
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
url: xiaohongshuApiUrls.searchNotes(data).Url,
|
|
7384
|
-
data: xiaohongshuApiUrls.searchNotes(data).Body,
|
|
7385
|
-
headers: {
|
|
7386
|
-
...baseRequestConfig.headers,
|
|
7387
|
-
"x-s": xiaohongshuSign.generateXSPost(xiaohongshuApiUrls.searchNotes(data).apiPath, xiaohongshuSign.extractA1FromCookie(cookie ?? ""), "xhs-pc-web"),
|
|
7388
|
-
"x-s-common": xiaohongshuSign.generateXSCommon(cookie ?? ""),
|
|
7389
|
-
"x-t": xiaohongshuSign.generateXT()
|
|
7390
|
-
}
|
|
7391
|
-
});
|
|
7392
|
-
default: throw new Error(`Unknown Xiaohongshu API method: "${logger.red(data.methodType)}"`);
|
|
7393
|
-
}
|
|
7595
|
+
};
|
|
7596
|
+
return requestWithCookie(cookie?.trim() ?? "");
|
|
7394
7597
|
};
|
|
7395
7598
|
/**
|
|
7396
7599
|
* 全局数据获取函数
|
|
@@ -7414,7 +7617,7 @@ const GlobalGetData$1 = async (methodType, config) => {
|
|
|
7414
7617
|
if (response.code !== 0) throw new Error(`API request failed: ${response.data?.msg ?? response.msg ?? "Unknown error"}, code: ${response.code}`);
|
|
7415
7618
|
return response;
|
|
7416
7619
|
} catch (error) {
|
|
7417
|
-
|
|
7620
|
+
emitLogError(`Xiaohongshu API request failed [${methodType}]:`, error.message);
|
|
7418
7621
|
return {
|
|
7419
7622
|
code: 500,
|
|
7420
7623
|
message: "error",
|
|
@@ -7755,7 +7958,7 @@ const createNetworkErrorResult = (error, retries) => {
|
|
|
7755
7958
|
* @returns 清理后的User-Agent字符串
|
|
7756
7959
|
*/
|
|
7757
7960
|
const cleanUserAgent = (userAgent) => {
|
|
7758
|
-
return userAgent.replace(/\s+Edg\/[\d
|
|
7961
|
+
return userAgent.replace(/\s+Edg\/[\d.]+/g, "");
|
|
7759
7962
|
};
|
|
7760
7963
|
/**
|
|
7761
7964
|
* 执行网络请求并返回数据(带自动重试)
|
|
@@ -8007,8 +8210,7 @@ const qtparam = async (BASEURL, cookie) => {
|
|
|
8007
8210
|
126,
|
|
8008
8211
|
127
|
|
8009
8212
|
];
|
|
8010
|
-
|
|
8011
|
-
logininfo.data.vipStatus === 1 ? isvip = true : isvip = false;
|
|
8213
|
+
const isvip = logininfo.data.vipStatus === 1;
|
|
8012
8214
|
if (isvip) return {
|
|
8013
8215
|
QUERY: `&fnval=4048&fourk=1&${sign}`,
|
|
8014
8216
|
STATUS: "isLogin",
|
|
@@ -8343,7 +8545,7 @@ const fetchBilibili = async (data, cookie, requestConfig) => {
|
|
|
8343
8545
|
...baseRequestConfig,
|
|
8344
8546
|
url: checkStatusUrl
|
|
8345
8547
|
})).data === null) {
|
|
8346
|
-
|
|
8548
|
+
emitLogError("评论区未开放");
|
|
8347
8549
|
return {
|
|
8348
8550
|
code: 404,
|
|
8349
8551
|
message: "评论区未开放",
|
|
@@ -8374,7 +8576,7 @@ const fetchBilibili = async (data, cookie, requestConfig) => {
|
|
|
8374
8576
|
} else isEnd = true;
|
|
8375
8577
|
requestCount++;
|
|
8376
8578
|
if (isEnd || currentComments.length === 0 || !nextPaginationStr) {
|
|
8377
|
-
|
|
8579
|
+
emitLogInfo("已到达评论末尾或无更多评论");
|
|
8378
8580
|
break;
|
|
8379
8581
|
}
|
|
8380
8582
|
}
|
|
@@ -8613,7 +8815,7 @@ const fetchBilibili = async (data, cookie, requestConfig) => {
|
|
|
8613
8815
|
}
|
|
8614
8816
|
}
|
|
8615
8817
|
default:
|
|
8616
|
-
|
|
8818
|
+
emitLogWarn(`未知的B站数据接口:「${data.methodType}」`);
|
|
8617
8819
|
return null;
|
|
8618
8820
|
}
|
|
8619
8821
|
};
|
|
@@ -8649,11 +8851,11 @@ const GlobalGetData = async (type, options, retryCount = 0) => {
|
|
|
8649
8851
|
requestUrl: options.url
|
|
8650
8852
|
};
|
|
8651
8853
|
warningMessage = `
|
|
8652
|
-
|
|
8854
|
+
获取响应数据失败!原因:接口返回内容为空,你的B站ck可能已经失效!
|
|
8653
8855
|
请求类型:「${type}」
|
|
8654
8856
|
请求URL:${options.url}
|
|
8655
8857
|
`;
|
|
8656
|
-
|
|
8858
|
+
emitLogWarn(warningMessage);
|
|
8657
8859
|
const riskError = new Error(Err.errorDescription);
|
|
8658
8860
|
Object.assign(riskError, {
|
|
8659
8861
|
code: "-352",
|
|
@@ -8675,12 +8877,12 @@ const GlobalGetData = async (type, options, retryCount = 0) => {
|
|
|
8675
8877
|
responseCode: result.code
|
|
8676
8878
|
};
|
|
8677
8879
|
warningMessage = `
|
|
8678
|
-
获取响应数据失败!原因:${
|
|
8880
|
+
获取响应数据失败!原因:${errorMessage}
|
|
8679
8881
|
错误代码:${result.code}
|
|
8680
8882
|
请求类型:「${type}」
|
|
8681
8883
|
请求URL:${options.url}
|
|
8682
8884
|
`;
|
|
8683
|
-
|
|
8885
|
+
emitLogWarn(warningMessage);
|
|
8684
8886
|
const apiError = new Error(Err.errorDescription);
|
|
8685
8887
|
Object.assign(apiError, {
|
|
8686
8888
|
code: result.code,
|
|
@@ -9164,15 +9366,6 @@ const kuaishouUtils = {
|
|
|
9164
9366
|
//#endregion
|
|
9165
9367
|
//#region src/platform/xiaohongshu/XiaohongshuApi.ts
|
|
9166
9368
|
/**
|
|
9167
|
-
* 小红书 API 模块 (已废弃)
|
|
9168
|
-
*
|
|
9169
|
-
* 此模块中的 API 已在 v6 版本废弃
|
|
9170
|
-
* 请使用 xiaohongshuFetcher 或 client.xiaohongshu.fetcher 替代
|
|
9171
|
-
*
|
|
9172
|
-
* @module platform/xiaohongshu/XiaohongshuApi
|
|
9173
|
-
* @deprecated v6 已废弃,请使用 fetcher API 替代
|
|
9174
|
-
*/
|
|
9175
|
-
/**
|
|
9176
9369
|
* 创建废弃的 API 存根函数
|
|
9177
9370
|
*/
|
|
9178
9371
|
const createDeprecatedStub = (methodName) => {
|
|
@@ -9975,7 +10168,7 @@ function getApiRoute(platform, methodType) {
|
|
|
9975
10168
|
* 构建后使用 __VERSION__,开发环境从 package.json 读取
|
|
9976
10169
|
*/
|
|
9977
10170
|
const getVersion = () => {
|
|
9978
|
-
return "6.
|
|
10171
|
+
return "6.2.0";
|
|
9979
10172
|
};
|
|
9980
10173
|
const VERSION = getVersion();
|
|
9981
10174
|
/**
|
|
@@ -10022,6 +10215,11 @@ const CreateApp = CreateAmagiApp;
|
|
|
10022
10215
|
/** After instantiation, it can interact with the specified platform API to quickly obtain data. */
|
|
10023
10216
|
const Client = CreateApp;
|
|
10024
10217
|
const amagi = Client;
|
|
10218
|
+
/*!
|
|
10219
|
+
* @ikenxuan/amagi
|
|
10220
|
+
* Copyright(c) 2023 ikenxuan
|
|
10221
|
+
* GPL-3.0 Licensed
|
|
10222
|
+
*/
|
|
10025
10223
|
//#endregion
|
|
10026
10224
|
export { AdditionalType, ApiError, BilibiliApiRoutes, BilibiliApplyCaptchaParamsSchema, BilibiliArticleCardParamsSchema, BilibiliArticleInfoParamsSchema, BilibiliArticleParamsSchema, BilibiliAv2BvParamsSchema, BilibiliBangumiInfoParamsSchema, BilibiliBangumiStreamParamsSchema, BilibiliBv2AvParamsSchema, BilibiliColumnInfoParamsSchema, BilibiliCommentParamsSchema, BilibiliCommentReplyParamsSchema, BilibiliDanmakuParamsSchema, BilibiliDynamicParamsSchema, BilibiliEmojiParamsSchema, BilibiliFetcherMethods, BilibiliInternalMethods, BilibiliLiveParamsSchema, BilibiliLoginParamsSchema, BilibiliMethodMapping, BilibiliMethodRoutes, BilibiliMethodToFetcher, BilibiliQrcodeParamsSchema, BilibiliQrcodeStatusParamsSchema, BilibiliUserParamsSchema, BilibiliValidateCaptchaParamsSchema, BilibiliValidationSchemas, BilibiliVideoDownloadParamsSchema, BilibiliVideoParamsSchema, CommentType, CreateApp, DouyinApiRoutes, DouyinCommentParamsSchema, DouyinCommentReplyParamsSchema, DouyinDanmakuParamsSchema, DouyinEmojiListParamsSchema, DouyinEmojiProParamsSchema, DouyinFetcherMethods, DouyinHotWordsParamsSchema, DouyinInternalMethods, DouyinLiveRoomParamsSchema, DouyinMethodMapping, DouyinMethodRoutes, DouyinMethodToFetcher, DouyinMusicParamsSchema, DouyinQrcodeParamsSchema, DouyinSearchParamsSchema, DouyinUserListParamsSchema, DouyinUserParamsSchema, DouyinValidationSchemas, DouyinWorkParamsSchema, DynamicType, KuaishouApiRoutes, KuaishouCommentParamsSchema, KuaishouEmojiParamsSchema, KuaishouFetcherMethods, KuaishouInternalMethods, KuaishouLiveRoomInfoParamsSchema, KuaishouMethodMapping, KuaishouMethodRoutes, KuaishouMethodToFetcher, KuaishouUserProfileParamsSchema, KuaishouUserWorkListParamsSchema, KuaishouValidationSchemas, KuaishouVideoParamsSchema, MajorType, MethodMaps, ValidationError, XiaohongshuApiRoutes, XiaohongshuFetcherMethods, XiaohongshuInternalMethods, XiaohongshuMethodMapping, XiaohongshuMethodRoutes, XiaohongshuMethodToFetcher, XiaohongshuValidationSchemas, amagi, amagiClient, amagiEvents, av2bv, bilibili, bilibiliApiUrls, bilibiliErrorCodeMap, bilibiliFetcher, bilibiliUtils, bv2av, createAmagiClient, createBilibiliRoutes, createBilibiliRoutes as registerBilibiliRoutes, createBoundBilibiliApi, createBoundBilibiliFetcher, createBoundDouyinApi, createBoundDouyinFetcher, createBoundKuaishouApi, createBoundKuaishouFetcher, createBoundXiaohongshuApi, createBoundXiaohongshuFetcher, createDouyinRoutes, createDouyinRoutes as registerDouyinRoutes, createErrorResponse, createKuaishouRoutes, createKuaishouRoutes as registerKuaishouRoutes, createSuccessResponse, createXiaohongshuRoutes, createXiaohongshuRoutes as registerXiaohongshuRoutes, Client as default, douyin, douyinApiUrls, douyinFetcher, douyinSign, douyinUtils, emitApiError, emitApiSuccess, emitHttpRequest, emitHttpResponse, emitLog, emitLogDebug, emitLogError, emitLogInfo, emitLogMark, emitLogWarn, emitNetworkError, emitNetworkRetry, fetchData, fetchResponse, getApiRoute, getBilibiliData, getDouyinData, getEnglishMethodName, getHeadersAndData, getKuaishouData, handleError, httpLogger, initLogger, isNetworkErrorResult, kuaishou, kuaishouApiUrls, kuaishouFetcher, kuaishouSign, kuaishouUtils, logMiddleware, logger, parseDmSegMobileReply, qtparam, toFetcherMethod, validateBilibiliParams, validateDouyinParams, validateKuaishouParams, validateXiaohongshuParams, wbi_sign, xiaohongshu, xiaohongshuApiUrls, xiaohongshuFetcher, xiaohongshuSign, xiaohongshuUtils };
|
|
10027
10225
|
|