@ikenxuan/amagi 6.1.2 → 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 +1073 -971
- package/dist/default/index.d.ts +17601 -16590
- package/dist/default/index.mjs +1063 -963
- package/dist/exports/axios.cjs +9 -8
- package/dist/exports/axios.mjs +2 -4
- package/dist/exports/chalk.cjs +7 -7
- package/dist/exports/chalk.mjs +2 -3
- package/dist/exports/express.cjs +3 -4
- package/dist/exports/express.mjs +1 -2
- package/dist/{chunk-CbDLau6x.cjs → rolldown-runtime-D6vf50IK.cjs} +13 -19
- package/package.json +21 -21
package/dist/default/index.mjs
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
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";
|
|
9
9
|
import express from "express";
|
|
10
|
-
|
|
11
10
|
//#region src/utils/deprecation.ts
|
|
12
11
|
/**
|
|
13
12
|
* 废弃 API 注册表
|
|
@@ -66,7 +65,9 @@ function checkDeprecation(apiName) {
|
|
|
66
65
|
* @returns 格式化的废弃提示消息字符串
|
|
67
66
|
*/
|
|
68
67
|
function buildDeprecationMessage(config) {
|
|
69
|
-
const lines = [`[DEPRECATED] "${config.name}" 已在 v${config.deprecatedIn}
|
|
68
|
+
const lines = [`[DEPRECATED] "${config.name}" 已在 v${config.deprecatedIn} 版本废弃。`];
|
|
69
|
+
if (config.replacement) lines.push(`请使用 "${config.replacement}" 替代。`);
|
|
70
|
+
else lines.push("此接口已被上游删除,无法继续使用,无可用替代方案。");
|
|
70
71
|
if (config.removedIn) lines.push(`此 API 将在 v${config.removedIn} 版本移除。`);
|
|
71
72
|
if (config.migrationGuide) lines.push(`迁移指南: ${config.migrationGuide}`);
|
|
72
73
|
return lines.join("\n");
|
|
@@ -174,10 +175,6 @@ registerDeprecatedApi({
|
|
|
174
175
|
name: "动态详情数据",
|
|
175
176
|
replacement: "fetchDynamicDetail"
|
|
176
177
|
},
|
|
177
|
-
{
|
|
178
|
-
name: "动态卡片数据",
|
|
179
|
-
replacement: "fetchDynamicCard"
|
|
180
|
-
},
|
|
181
178
|
{
|
|
182
179
|
name: "直播间信息",
|
|
183
180
|
replacement: "fetchLiveRoomInfo"
|
|
@@ -327,7 +324,20 @@ registerDeprecatedApi({
|
|
|
327
324
|
throwError: true
|
|
328
325
|
});
|
|
329
326
|
});
|
|
330
|
-
|
|
327
|
+
registerDeprecatedApi({
|
|
328
|
+
name: `methodType: '动态卡片数据'`,
|
|
329
|
+
deprecatedIn: "6.0.0",
|
|
330
|
+
removedIn: "7.0.0",
|
|
331
|
+
migrationGuide: "https://amagi-docs.vercel.app/docs/changelog/6.1.3",
|
|
332
|
+
throwError: false
|
|
333
|
+
});
|
|
334
|
+
registerDeprecatedApi({
|
|
335
|
+
name: "fetchDynamicCard",
|
|
336
|
+
deprecatedIn: "6.1.3",
|
|
337
|
+
removedIn: "7.0.0",
|
|
338
|
+
migrationGuide: "https://amagi-docs.vercel.app/docs/changelog/6.1.3",
|
|
339
|
+
throwError: false
|
|
340
|
+
});
|
|
331
341
|
//#endregion
|
|
332
342
|
//#region src/model/DataFetchers.ts
|
|
333
343
|
/**
|
|
@@ -435,7 +445,6 @@ function getXiaohongshuData(..._args) {
|
|
|
435
445
|
checkDeprecation("getXiaohongshuData");
|
|
436
446
|
throw new Error("getXiaohongshuData 已废弃");
|
|
437
447
|
}
|
|
438
|
-
|
|
439
448
|
//#endregion
|
|
440
449
|
//#region src/platform/bilibili/API.ts
|
|
441
450
|
/**
|
|
@@ -449,133 +458,138 @@ var BilibiliAPI = class {
|
|
|
449
458
|
return "https://api.bilibili.com/x/web-interface/nav";
|
|
450
459
|
}
|
|
451
460
|
/** 获取视频详细信息 */
|
|
452
|
-
getVideoInfo(data
|
|
453
|
-
return `https://api.bilibili.com/x/web-interface/view?bvid=${data
|
|
461
|
+
getVideoInfo(data) {
|
|
462
|
+
return `https://api.bilibili.com/x/web-interface/view?bvid=${data.bvid}`;
|
|
454
463
|
}
|
|
455
464
|
/** 获取视频流信息 */
|
|
456
|
-
getVideoStream(data
|
|
457
|
-
return `https://api.bilibili.com/x/player/playurl?avid=${data
|
|
465
|
+
getVideoStream(data) {
|
|
466
|
+
return `https://api.bilibili.com/x/player/playurl?avid=${data.avid}&cid=${data.cid}`;
|
|
458
467
|
}
|
|
459
468
|
/**
|
|
460
469
|
* 获取评论区明细
|
|
461
470
|
* @see https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/comment/readme.md#评论区类型代码
|
|
462
471
|
*/
|
|
463
|
-
getComments(data
|
|
472
|
+
getComments(data) {
|
|
464
473
|
const params = new URLSearchParams({
|
|
465
|
-
oid: data
|
|
466
|
-
type: data
|
|
467
|
-
mode: (data
|
|
474
|
+
oid: data.oid.toString(),
|
|
475
|
+
type: data.type.toString(),
|
|
476
|
+
mode: (data.mode ?? 3).toString(),
|
|
468
477
|
plat: "1",
|
|
469
478
|
seek_rpid: "",
|
|
470
479
|
web_location: "1315875"
|
|
471
480
|
});
|
|
472
|
-
if (data
|
|
481
|
+
if (data.pagination_str) params.append("pagination_str", JSON.stringify({ offset: data.pagination_str }));
|
|
473
482
|
else params.append("pagination_str", JSON.stringify({ offset: "" }));
|
|
474
483
|
return `https://api.bilibili.com/x/v2/reply/wbi/main?${params.toString()}`;
|
|
475
484
|
}
|
|
476
485
|
/** 获取评论区状态 */
|
|
477
|
-
getCommentStatus(data
|
|
478
|
-
return `https://api.bilibili.com/x/v2/reply/subject/description?type=${data
|
|
486
|
+
getCommentStatus(data) {
|
|
487
|
+
return `https://api.bilibili.com/x/v2/reply/subject/description?type=${data.type}&oid=${data.oid}`;
|
|
479
488
|
}
|
|
480
489
|
/** 获取指定评论的回复 */
|
|
481
|
-
getCommentReplies(data
|
|
482
|
-
return `https://api.bilibili.com/x/v2/reply/reply?type=${data
|
|
490
|
+
getCommentReplies(data) {
|
|
491
|
+
return `https://api.bilibili.com/x/v2/reply/reply?type=${data.type}&oid=${data.oid}&root=${data.root}&ps=${data.number}`;
|
|
483
492
|
}
|
|
484
493
|
/** 获取表情列表 */
|
|
485
494
|
getEmojiList() {
|
|
486
495
|
return "https://api.bilibili.com/x/emote/user/panel/web?business=reply&web_location=0.0";
|
|
487
496
|
}
|
|
488
497
|
/** 获取番剧明细 */
|
|
489
|
-
getBangumiInfo(data
|
|
490
|
-
if (data
|
|
491
|
-
else if (data
|
|
498
|
+
getBangumiInfo(data) {
|
|
499
|
+
if (data.ep_id) return `https://api.bilibili.com/pgc/view/web/season?ep_id=${data.ep_id}`;
|
|
500
|
+
else if (data.season_id) return `https://api.bilibili.com/pgc/view/web/season?season_id=${data.season_id}`;
|
|
492
501
|
else throw new Error("Missing required parameter: ep_id or season_id");
|
|
493
502
|
}
|
|
494
503
|
/** 获取番剧视频流信息 */
|
|
495
|
-
getBangumiStream(data
|
|
496
|
-
return `https://api.bilibili.com/pgc/player/web/playurl?cid=${data
|
|
504
|
+
getBangumiStream(data) {
|
|
505
|
+
return `https://api.bilibili.com/pgc/player/web/playurl?cid=${data.cid}&ep_id=${data.ep_id}`;
|
|
497
506
|
}
|
|
498
507
|
/** 获取用户空间动态 */
|
|
499
|
-
getUserDynamicList(data
|
|
508
|
+
getUserDynamicList(data) {
|
|
500
509
|
return `https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/space?${new URLSearchParams({
|
|
501
|
-
host_mid: data
|
|
510
|
+
host_mid: data.host_mid.toString(),
|
|
502
511
|
offset: "",
|
|
503
512
|
platform: "web",
|
|
504
513
|
features: "itemOpusStyle,listOnlyfans,opusBigCover,onlyfansVote,forwardListHidden,decorationCard,commentsNewVersion,onlyfansAssetsV2,ugcDelete,onlyfansQaCard,avatarAutoTheme,sunflowerStyle,eva3CardOpus,eva3CardVideo,eva3CardComment"
|
|
505
514
|
}).toString()}`;
|
|
506
515
|
}
|
|
507
516
|
/** 获取动态详情 */
|
|
508
|
-
getDynamicDetail(data
|
|
509
|
-
return `https://api.bilibili.com/x/polymer/web-dynamic/v1/detail?id=${data
|
|
517
|
+
getDynamicDetail(data) {
|
|
518
|
+
return `https://api.bilibili.com/x/polymer/web-dynamic/v1/detail?id=${data.dynamic_id}&features=itemOpusStyle,opusBigCover,onlyfansVote,endFooterHidden,decorationCard,onlyfansAssetsV2,ugcDelete,onlyfansQaCard,editable,opusPrivateVisible,avatarAutoTheme`;
|
|
510
519
|
}
|
|
511
|
-
/**
|
|
512
|
-
|
|
513
|
-
|
|
520
|
+
/**
|
|
521
|
+
* 获取动态卡片信息
|
|
522
|
+
*
|
|
523
|
+
* @deprecated B站官方已于 `2025-08-09` 删除原 `dynamic_svr` 接口,该接口已停用。
|
|
524
|
+
* 调用将返回错误信息,请使用 {@link getDynamicDetail} 替代。
|
|
525
|
+
*/
|
|
526
|
+
getDynamicCard(data) {
|
|
527
|
+
return this.getDynamicDetail(data);
|
|
514
528
|
}
|
|
515
529
|
/** 获取用户名片信息 */
|
|
516
|
-
getUserCard(data
|
|
517
|
-
return `https://api.bilibili.com/x/web-interface/card?mid=${data
|
|
530
|
+
getUserCard(data) {
|
|
531
|
+
return `https://api.bilibili.com/x/web-interface/card?mid=${data.host_mid}&photo=true`;
|
|
518
532
|
}
|
|
519
533
|
/** 获取直播间信息 */
|
|
520
|
-
getLiveRoomInfo(data
|
|
521
|
-
return `https://api.live.bilibili.com/room/v1/Room/get_info?room_id=${data
|
|
534
|
+
getLiveRoomInfo(data) {
|
|
535
|
+
return `https://api.live.bilibili.com/room/v1/Room/get_info?room_id=${data.room_id}`;
|
|
522
536
|
}
|
|
523
537
|
/** 获取直播间初始化信息 */
|
|
524
|
-
getLiveRoomInit(data
|
|
525
|
-
return `https://api.live.bilibili.com/room/v1/Room/room_init?id=${data
|
|
538
|
+
getLiveRoomInit(data) {
|
|
539
|
+
return `https://api.live.bilibili.com/room/v1/Room/room_init?id=${data.room_id}`;
|
|
526
540
|
}
|
|
527
541
|
/** 申请登录二维码 */
|
|
528
542
|
getLoginQrcode() {
|
|
529
543
|
return "https://passport.bilibili.com/x/passport-login/web/qrcode/generate";
|
|
530
544
|
}
|
|
531
545
|
/** 查询二维码状态 */
|
|
532
|
-
getQrcodeStatus(data
|
|
533
|
-
return `https://passport.bilibili.com/x/passport-login/web/qrcode/poll?qrcode_key=${data
|
|
546
|
+
getQrcodeStatus(data) {
|
|
547
|
+
return `https://passport.bilibili.com/x/passport-login/web/qrcode/poll?qrcode_key=${data.qrcode_key}`;
|
|
534
548
|
}
|
|
535
549
|
/** 获取UP主总播放量 */
|
|
536
|
-
getUploaderTotalViews(data
|
|
537
|
-
return `https://api.bilibili.com/x/space/upstat?mid=${data
|
|
550
|
+
getUploaderTotalViews(data) {
|
|
551
|
+
return `https://api.bilibili.com/x/space/upstat?mid=${data.host_mid}`;
|
|
538
552
|
}
|
|
539
553
|
/** 获取专栏正文内容 */
|
|
540
|
-
getArticleContent(data
|
|
541
|
-
return `https://api.bilibili.com/x/article/view?id=${data
|
|
554
|
+
getArticleContent(data) {
|
|
555
|
+
return `https://api.bilibili.com/x/article/view?id=${data.id}`;
|
|
542
556
|
}
|
|
543
557
|
/** 获取专栏显示卡片信息 */
|
|
544
|
-
getArticleCards(data
|
|
545
|
-
return `https://api.bilibili.com/x/article/cards?ids=${Array.isArray(data
|
|
558
|
+
getArticleCards(data) {
|
|
559
|
+
return `https://api.bilibili.com/x/article/cards?ids=${Array.isArray(data.ids) ? data.ids.join(",") : data.ids}`;
|
|
546
560
|
}
|
|
547
561
|
/** 获取专栏文章基本信息 */
|
|
548
|
-
getArticleInfo(data
|
|
549
|
-
return `https://api.bilibili.com/x/article/viewinfo?id=${data
|
|
562
|
+
getArticleInfo(data) {
|
|
563
|
+
return `https://api.bilibili.com/x/article/viewinfo?id=${data.id}`;
|
|
550
564
|
}
|
|
551
565
|
/** 获取文集基本信息 */
|
|
552
|
-
getArticleListInfo(data
|
|
553
|
-
return `https://api.bilibili.com/x/article/list/web/articles?id=${data
|
|
566
|
+
getArticleListInfo(data) {
|
|
567
|
+
return `https://api.bilibili.com/x/article/list/web/articles?id=${data.id}`;
|
|
554
568
|
}
|
|
555
569
|
/** 获取用户空间详细信息 */
|
|
556
|
-
getUserSpaceInfo(data
|
|
557
|
-
return `https://api.bilibili.com/x/space/wbi/acc/info?mid=${data
|
|
570
|
+
getUserSpaceInfo(data) {
|
|
571
|
+
return `https://api.bilibili.com/x/space/wbi/acc/info?mid=${data.host_mid}`;
|
|
558
572
|
}
|
|
559
573
|
/** 从 v_voucher 申请验证码 */
|
|
560
|
-
getCaptchaFromVoucher(data
|
|
574
|
+
getCaptchaFromVoucher(data) {
|
|
561
575
|
return {
|
|
562
576
|
Url: "https://api.bilibili.com/x/gaia-vgate/v1/register",
|
|
563
577
|
Body: {
|
|
564
|
-
...data
|
|
565
|
-
v_voucher: data
|
|
578
|
+
...data.csrf !== void 0 && { csrf: data.csrf },
|
|
579
|
+
v_voucher: data.v_voucher
|
|
566
580
|
}
|
|
567
581
|
};
|
|
568
582
|
}
|
|
569
583
|
/** 验证验证码结果 */
|
|
570
|
-
validateCaptcha(data
|
|
584
|
+
validateCaptcha(data) {
|
|
571
585
|
return {
|
|
572
586
|
Url: "https://api.bilibili.com/x/gaia-vgate/v1/validate",
|
|
573
587
|
Body: {
|
|
574
|
-
challenge: data
|
|
575
|
-
token: data
|
|
576
|
-
validate: data
|
|
577
|
-
seccode: data
|
|
578
|
-
...data
|
|
588
|
+
challenge: data.challenge,
|
|
589
|
+
token: data.token,
|
|
590
|
+
validate: data.validate,
|
|
591
|
+
seccode: data.seccode,
|
|
592
|
+
...data.csrf !== void 0 && { csrf: data.csrf }
|
|
579
593
|
}
|
|
580
594
|
};
|
|
581
595
|
}
|
|
@@ -583,17 +597,16 @@ var BilibiliAPI = class {
|
|
|
583
597
|
* 获取实时弹幕(web端 protobuf 接口)
|
|
584
598
|
* @see https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/danmaku/danmaku_proto.md
|
|
585
599
|
*/
|
|
586
|
-
getVideoDanmaku(data
|
|
600
|
+
getVideoDanmaku(data) {
|
|
587
601
|
return `https://api.bilibili.com/x/v2/dm/web/seg.so?${new URLSearchParams({
|
|
588
602
|
type: "1",
|
|
589
|
-
oid: data
|
|
590
|
-
segment_index: (data
|
|
603
|
+
oid: data.cid.toString(),
|
|
604
|
+
segment_index: (data.segment_index ?? 1).toString()
|
|
591
605
|
}).toString()}`;
|
|
592
606
|
}
|
|
593
607
|
};
|
|
594
608
|
/** B站 API URL 构建器实例 */
|
|
595
609
|
const bilibiliApiUrls = new BilibiliAPI();
|
|
596
|
-
|
|
597
610
|
//#endregion
|
|
598
611
|
//#region src/platform/bilibili/BilibiliApi.ts
|
|
599
612
|
/**
|
|
@@ -611,32 +624,59 @@ const createDeprecatedStub$3 = (methodName) => {
|
|
|
611
624
|
* @deprecated v6 已废弃,请使用 bilibiliFetcher 或 client.bilibili.fetcher 替代
|
|
612
625
|
*/
|
|
613
626
|
const bilibili = {
|
|
627
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchVideoInfo 替代 */
|
|
614
628
|
getVideoInfo: createDeprecatedStub$3("getVideoInfo"),
|
|
629
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchVideoStreamUrl 替代 */
|
|
615
630
|
getVideoStream: createDeprecatedStub$3("getVideoStream"),
|
|
631
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchComments 替代 */
|
|
616
632
|
getComments: createDeprecatedStub$3("getComments"),
|
|
633
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchCommentReplies 替代 */
|
|
617
634
|
getCommentReply: createDeprecatedStub$3("getCommentReply"),
|
|
635
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchUserCard 替代 */
|
|
618
636
|
getUserProfile: createDeprecatedStub$3("getUserProfile"),
|
|
637
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchUserDynamicList 替代 */
|
|
619
638
|
getUserDynamic: createDeprecatedStub$3("getUserDynamic"),
|
|
639
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchEmojiList 替代 */
|
|
620
640
|
getEmojiList: createDeprecatedStub$3("getEmojiList"),
|
|
641
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchBangumiInfo 替代 */
|
|
621
642
|
getBangumiInfo: createDeprecatedStub$3("getBangumiInfo"),
|
|
643
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchBangumiStreamUrl 替代 */
|
|
622
644
|
getBangumiStream: createDeprecatedStub$3("getBangumiStream"),
|
|
645
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchDynamicDetail 替代 */
|
|
623
646
|
getDynamicInfo: createDeprecatedStub$3("getDynamicInfo"),
|
|
647
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchDynamicCard 替代 */
|
|
624
648
|
getDynamicCard: createDeprecatedStub$3("getDynamicCard"),
|
|
649
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchLiveRoomInfo 替代 */
|
|
625
650
|
getLiveRoomDetail: createDeprecatedStub$3("getLiveRoomDetail"),
|
|
651
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchLiveRoomInitInfo 替代 */
|
|
626
652
|
getLiveRoomInitInfo: createDeprecatedStub$3("getLiveRoomInitInfo"),
|
|
653
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchLoginStatus 替代 */
|
|
627
654
|
getLoginBasicInfo: createDeprecatedStub$3("getLoginBasicInfo"),
|
|
655
|
+
/** @deprecated 请使用 bilibiliFetcher.requestLoginQrcode 替代 */
|
|
628
656
|
getLoginQrcode: createDeprecatedStub$3("getLoginQrcode"),
|
|
657
|
+
/** @deprecated 请使用 bilibiliFetcher.checkQrcodeStatus 替代 */
|
|
629
658
|
checkQrcodeStatus: createDeprecatedStub$3("checkQrcodeStatus"),
|
|
659
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchUploaderTotalViews 替代 */
|
|
630
660
|
getUserTotalPlayCount: createDeprecatedStub$3("getUserTotalPlayCount"),
|
|
661
|
+
/** @deprecated 请使用 bilibiliFetcher.convertAvToBv 替代 */
|
|
631
662
|
convertAvToBv: createDeprecatedStub$3("convertAvToBv"),
|
|
663
|
+
/** @deprecated 请使用 bilibiliFetcher.convertBvToAv 替代 */
|
|
632
664
|
convertBvToAv: createDeprecatedStub$3("convertBvToAv"),
|
|
665
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchArticleContent 替代 */
|
|
633
666
|
getArticleContent: createDeprecatedStub$3("getArticleContent"),
|
|
667
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchArticleCards 替代 */
|
|
634
668
|
getArticleCard: createDeprecatedStub$3("getArticleCard"),
|
|
669
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchArticleInfo 替代 */
|
|
635
670
|
getArticleInfo: createDeprecatedStub$3("getArticleInfo"),
|
|
671
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchArticleListInfo 替代 */
|
|
636
672
|
getColumnInfo: createDeprecatedStub$3("getColumnInfo"),
|
|
673
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchUserSpaceInfo 替代 */
|
|
637
674
|
getUserProfileDetail: createDeprecatedStub$3("getUserProfileDetail"),
|
|
675
|
+
/** @deprecated 请使用 bilibiliFetcher.requestCaptchaFromVoucher 替代 */
|
|
638
676
|
applyVoucherCaptcha: createDeprecatedStub$3("applyVoucherCaptcha"),
|
|
677
|
+
/** @deprecated 请使用 bilibiliFetcher.validateCaptchaResult 替代 */
|
|
639
678
|
validateCaptcha: createDeprecatedStub$3("validateCaptcha"),
|
|
679
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchVideoDanmaku 替代 */
|
|
640
680
|
getDanmaku: createDeprecatedStub$3("getDanmaku")
|
|
641
681
|
};
|
|
642
682
|
/**
|
|
@@ -647,7 +687,6 @@ const bilibili = {
|
|
|
647
687
|
const createBoundBilibiliApi = (_cookie, _requestConfig) => {
|
|
648
688
|
return { ...bilibili };
|
|
649
689
|
};
|
|
650
|
-
|
|
651
690
|
//#endregion
|
|
652
691
|
//#region src/model/events.ts
|
|
653
692
|
/**
|
|
@@ -666,8 +705,8 @@ var TypedEventEmitter = class extends EventEmitter {
|
|
|
666
705
|
* @param data - 事件数据
|
|
667
706
|
* @returns 是否有监听器处理了该事件
|
|
668
707
|
*/
|
|
669
|
-
emit(event, data
|
|
670
|
-
return super.emit(event, data
|
|
708
|
+
emit(event, data) {
|
|
709
|
+
return super.emit(event, data);
|
|
671
710
|
}
|
|
672
711
|
/**
|
|
673
712
|
* 注册事件监听器
|
|
@@ -729,9 +768,9 @@ const emitLog = (level, message, ...args) => {
|
|
|
729
768
|
* 发射 HTTP 请求事件
|
|
730
769
|
* @param data - 请求数据 (不含 timestamp)
|
|
731
770
|
*/
|
|
732
|
-
const emitHttpRequest = (data
|
|
771
|
+
const emitHttpRequest = (data) => {
|
|
733
772
|
amagiEvents.emit("http:request", {
|
|
734
|
-
...data
|
|
773
|
+
...data,
|
|
735
774
|
timestamp: /* @__PURE__ */ new Date()
|
|
736
775
|
});
|
|
737
776
|
};
|
|
@@ -739,9 +778,9 @@ const emitHttpRequest = (data$1) => {
|
|
|
739
778
|
* 发射 HTTP 响应事件
|
|
740
779
|
* @param data - 响应数据 (不含 timestamp)
|
|
741
780
|
*/
|
|
742
|
-
const emitHttpResponse = (data
|
|
781
|
+
const emitHttpResponse = (data) => {
|
|
743
782
|
amagiEvents.emit("http:response", {
|
|
744
|
-
...data
|
|
783
|
+
...data,
|
|
745
784
|
timestamp: /* @__PURE__ */ new Date()
|
|
746
785
|
});
|
|
747
786
|
};
|
|
@@ -749,9 +788,9 @@ const emitHttpResponse = (data$1) => {
|
|
|
749
788
|
* 发射网络重试事件
|
|
750
789
|
* @param data - 重试数据 (不含 timestamp)
|
|
751
790
|
*/
|
|
752
|
-
const emitNetworkRetry = (data
|
|
791
|
+
const emitNetworkRetry = (data) => {
|
|
753
792
|
amagiEvents.emit("network:retry", {
|
|
754
|
-
...data
|
|
793
|
+
...data,
|
|
755
794
|
timestamp: /* @__PURE__ */ new Date()
|
|
756
795
|
});
|
|
757
796
|
};
|
|
@@ -759,9 +798,9 @@ const emitNetworkRetry = (data$1) => {
|
|
|
759
798
|
* 发射网络错误事件
|
|
760
799
|
* @param data - 错误数据 (不含 timestamp)
|
|
761
800
|
*/
|
|
762
|
-
const emitNetworkError = (data
|
|
801
|
+
const emitNetworkError = (data) => {
|
|
763
802
|
amagiEvents.emit("network:error", {
|
|
764
|
-
...data
|
|
803
|
+
...data,
|
|
765
804
|
timestamp: /* @__PURE__ */ new Date()
|
|
766
805
|
});
|
|
767
806
|
};
|
|
@@ -769,9 +808,9 @@ const emitNetworkError = (data$1) => {
|
|
|
769
808
|
* 发射 API 成功事件
|
|
770
809
|
* @param data - 成功数据 (不含 timestamp)
|
|
771
810
|
*/
|
|
772
|
-
const emitApiSuccess = (data
|
|
811
|
+
const emitApiSuccess = (data) => {
|
|
773
812
|
amagiEvents.emit("api:success", {
|
|
774
|
-
...data
|
|
813
|
+
...data,
|
|
775
814
|
timestamp: /* @__PURE__ */ new Date()
|
|
776
815
|
});
|
|
777
816
|
};
|
|
@@ -779,9 +818,9 @@ const emitApiSuccess = (data$1) => {
|
|
|
779
818
|
* 发射 API 错误事件
|
|
780
819
|
* @param data - 错误数据 (不含 timestamp)
|
|
781
820
|
*/
|
|
782
|
-
const emitApiError = (data
|
|
821
|
+
const emitApiError = (data) => {
|
|
783
822
|
amagiEvents.emit("api:error", {
|
|
784
|
-
...data
|
|
823
|
+
...data,
|
|
785
824
|
timestamp: /* @__PURE__ */ new Date()
|
|
786
825
|
});
|
|
787
826
|
};
|
|
@@ -825,7 +864,6 @@ const emitLogDebug = (message, ...args) => {
|
|
|
825
864
|
const emitLogMark = (message, ...args) => {
|
|
826
865
|
emitLog("mark", message, ...args);
|
|
827
866
|
};
|
|
828
|
-
|
|
829
867
|
//#endregion
|
|
830
868
|
//#region src/validation/utils.ts
|
|
831
869
|
function smartNumber(errorMessage, minValue = 1, isInteger = false) {
|
|
@@ -856,7 +894,6 @@ const extractCreatorInfoFromHtml = (html) => {
|
|
|
856
894
|
return null;
|
|
857
895
|
}
|
|
858
896
|
};
|
|
859
|
-
|
|
860
897
|
//#endregion
|
|
861
898
|
//#region src/validation/bilibili.ts
|
|
862
899
|
/** 视频信息参数验证 */
|
|
@@ -950,7 +987,7 @@ const BilibiliBangumiInfoParamsSchema = zod.object({
|
|
|
950
987
|
methodType: zod.literal("bangumiInfo", { error: "方法类型必须是\"bangumiInfo\"" }),
|
|
951
988
|
ep_id: zod.string({ error: "番剧EP ID必须是字符串" }).min(1, { error: "番剧EP ID不能为空" }).optional(),
|
|
952
989
|
season_id: zod.string({ error: "番剧季度ID必须是字符串" }).optional()
|
|
953
|
-
}).refine((data
|
|
990
|
+
}).refine((data) => data.ep_id ?? data.season_id, {
|
|
954
991
|
error: "ep_id 和 season_id 至少需要提供一个",
|
|
955
992
|
path: ["ep_id"]
|
|
956
993
|
});
|
|
@@ -1090,7 +1127,6 @@ const BilibiliMethodRoutes = {
|
|
|
1090
1127
|
validateCaptcha: "/validate_captcha",
|
|
1091
1128
|
videoDanmaku: "/fetch_danmaku"
|
|
1092
1129
|
};
|
|
1093
|
-
|
|
1094
1130
|
//#endregion
|
|
1095
1131
|
//#region src/validation/douyin.ts
|
|
1096
1132
|
/** 作品参数验证 */
|
|
@@ -1179,14 +1215,14 @@ const DouyinDanmakuParamsSchema = zod.object({
|
|
|
1179
1215
|
start_time: zod.coerce.number({ error: "开始时间必须是数字" }).int({ error: "开始时间必须是整数" }).min(0, { error: "开始时间不能小于0" }).optional(),
|
|
1180
1216
|
end_time: zod.coerce.number({ error: "结束时间必须是数字" }).int({ error: "结束时间必须是整数" }).min(0, { error: "结束时间不能小于0" }).optional(),
|
|
1181
1217
|
duration: zod.coerce.number({ error: "视频时长必须是数字" }).int({ error: "视频时长必须是整数" }).min(0, { error: "视频时长不能小于0" })
|
|
1182
|
-
}).refine((data
|
|
1183
|
-
if (data
|
|
1218
|
+
}).refine((data) => {
|
|
1219
|
+
if (data.end_time !== void 0) return data.end_time <= data.duration;
|
|
1184
1220
|
return true;
|
|
1185
1221
|
}, {
|
|
1186
1222
|
error: "获取弹幕区间的结束时间不能超过视频总时长",
|
|
1187
1223
|
path: ["end_time"]
|
|
1188
|
-
}).refine((data
|
|
1189
|
-
if (data
|
|
1224
|
+
}).refine((data) => {
|
|
1225
|
+
if (data.start_time !== void 0 && data.end_time !== void 0) return data.start_time < data.end_time;
|
|
1190
1226
|
return true;
|
|
1191
1227
|
}, {
|
|
1192
1228
|
error: "获取弹幕区间的开始时间必须小于结束时间",
|
|
@@ -1236,7 +1272,6 @@ const DouyinMethodRoutes = {
|
|
|
1236
1272
|
danmakuList: "/fetch_work_danmaku",
|
|
1237
1273
|
loginQrcode: "/fetch_login_qrcode"
|
|
1238
1274
|
};
|
|
1239
|
-
|
|
1240
1275
|
//#endregion
|
|
1241
1276
|
//#region src/validation/kuaishou.ts
|
|
1242
1277
|
/**
|
|
@@ -1302,14 +1337,195 @@ const KuaishouMethodRoutes = {
|
|
|
1302
1337
|
liveRoomInfo: "/fetch_live_room_info",
|
|
1303
1338
|
emojiList: "/fetch_emoji_list"
|
|
1304
1339
|
};
|
|
1305
|
-
|
|
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
|
+
};
|
|
1306
1514
|
//#endregion
|
|
1307
1515
|
//#region src/platform/xiaohongshu/sign/index.ts
|
|
1308
1516
|
/**
|
|
1309
1517
|
* 小红书签名算法类
|
|
1310
1518
|
*/
|
|
1311
1519
|
var xiaohongshuSign = class {
|
|
1312
|
-
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
|
+
}
|
|
1313
1529
|
/**
|
|
1314
1530
|
* 生成GET请求的X-S签名
|
|
1315
1531
|
* @param path - API路径
|
|
@@ -1369,44 +1585,43 @@ var xiaohongshuSign = class {
|
|
|
1369
1585
|
*/
|
|
1370
1586
|
static getSearchId = () => (BigInt(Date.now()) << 64n) + BigInt(Math.floor(Math.random() * 2147483646)).toString(36);
|
|
1371
1587
|
};
|
|
1372
|
-
|
|
1373
1588
|
//#endregion
|
|
1374
1589
|
//#region src/platform/xiaohongshu/API.ts
|
|
1375
1590
|
/**
|
|
1376
1591
|
* 搜索排序类型枚举
|
|
1377
1592
|
*/
|
|
1378
|
-
let SearchSortType = /* @__PURE__ */ function(SearchSortType
|
|
1593
|
+
let SearchSortType = /* @__PURE__ */ function(SearchSortType) {
|
|
1379
1594
|
/**
|
|
1380
1595
|
* 默认排序
|
|
1381
1596
|
*/
|
|
1382
|
-
SearchSortType
|
|
1597
|
+
SearchSortType["GENERAL"] = "general";
|
|
1383
1598
|
/**
|
|
1384
1599
|
* 最受欢迎(按热度降序)
|
|
1385
1600
|
*/
|
|
1386
|
-
SearchSortType
|
|
1601
|
+
SearchSortType["MOST_POPULAR"] = "popularity_descending";
|
|
1387
1602
|
/**
|
|
1388
1603
|
* 最新发布(按时间降序)
|
|
1389
1604
|
*/
|
|
1390
|
-
SearchSortType
|
|
1391
|
-
return SearchSortType
|
|
1605
|
+
SearchSortType["LATEST"] = "time_descending";
|
|
1606
|
+
return SearchSortType;
|
|
1392
1607
|
}({});
|
|
1393
1608
|
/**
|
|
1394
1609
|
* 搜索笔记类型枚举
|
|
1395
1610
|
*/
|
|
1396
|
-
let SearchNoteType = /* @__PURE__ */ function(SearchNoteType
|
|
1611
|
+
let SearchNoteType = /* @__PURE__ */ function(SearchNoteType) {
|
|
1397
1612
|
/**
|
|
1398
1613
|
* 默认(全部类型)
|
|
1399
1614
|
*/
|
|
1400
|
-
SearchNoteType
|
|
1615
|
+
SearchNoteType[SearchNoteType["ALL"] = 0] = "ALL";
|
|
1401
1616
|
/**
|
|
1402
1617
|
* 仅视频
|
|
1403
1618
|
*/
|
|
1404
|
-
SearchNoteType
|
|
1619
|
+
SearchNoteType[SearchNoteType["VIDEO"] = 1] = "VIDEO";
|
|
1405
1620
|
/**
|
|
1406
1621
|
* 仅图片
|
|
1407
1622
|
*/
|
|
1408
|
-
SearchNoteType
|
|
1409
|
-
return SearchNoteType
|
|
1623
|
+
SearchNoteType[SearchNoteType["IMAGE"] = 2] = "IMAGE";
|
|
1624
|
+
return SearchNoteType;
|
|
1410
1625
|
}({});
|
|
1411
1626
|
/**
|
|
1412
1627
|
* 构建查询字符串
|
|
@@ -1420,17 +1635,22 @@ const buildQueryString$1 = (params) => {
|
|
|
1420
1635
|
* 小红书API地址配置
|
|
1421
1636
|
*/
|
|
1422
1637
|
const xiaohongshuApiUrls = {
|
|
1423
|
-
|
|
1638
|
+
/**
|
|
1639
|
+
* 获取首页推荐数据的接口地址
|
|
1640
|
+
* @param data - 请求参数
|
|
1641
|
+
* @returns 完整的接口URL
|
|
1642
|
+
*/
|
|
1643
|
+
homeFeed(data = {}) {
|
|
1424
1644
|
return {
|
|
1425
1645
|
apiPath: "/api/sns/web/v1/homefeed",
|
|
1426
1646
|
Url: "https://edith.xiaohongshu.com/api/sns/web/v1/homefeed",
|
|
1427
1647
|
Body: {
|
|
1428
|
-
cursor_score: data
|
|
1429
|
-
num: data
|
|
1430
|
-
refresh_type: data
|
|
1431
|
-
note_index: data
|
|
1432
|
-
category: data
|
|
1433
|
-
search_key: data
|
|
1648
|
+
cursor_score: data.cursor_score ?? "1.7599348899670024E9",
|
|
1649
|
+
num: data.num ?? 33,
|
|
1650
|
+
refresh_type: data.refresh_type ?? 3,
|
|
1651
|
+
note_index: data.note_index ?? 33,
|
|
1652
|
+
category: data.category ?? "homefeed_recommend",
|
|
1653
|
+
search_key: data.search_key ?? "",
|
|
1434
1654
|
image_formats: [
|
|
1435
1655
|
"jpg",
|
|
1436
1656
|
"webp",
|
|
@@ -1439,12 +1659,17 @@ const xiaohongshuApiUrls = {
|
|
|
1439
1659
|
}
|
|
1440
1660
|
};
|
|
1441
1661
|
},
|
|
1442
|
-
|
|
1662
|
+
/**
|
|
1663
|
+
* 获取单个笔记数据的接口地址
|
|
1664
|
+
* @param data - 请求参数
|
|
1665
|
+
* @returns 完整的接口URL
|
|
1666
|
+
*/
|
|
1667
|
+
noteDetail(data) {
|
|
1443
1668
|
return {
|
|
1444
1669
|
apiPath: "/api/sns/web/v1/feed",
|
|
1445
1670
|
Url: "https://edith.xiaohongshu.com/api/sns/web/v1/feed",
|
|
1446
1671
|
Body: {
|
|
1447
|
-
source_note_id: data
|
|
1672
|
+
source_note_id: data.note_id,
|
|
1448
1673
|
image_formats: [
|
|
1449
1674
|
"jpg",
|
|
1450
1675
|
"webp",
|
|
@@ -1452,38 +1677,53 @@ const xiaohongshuApiUrls = {
|
|
|
1452
1677
|
],
|
|
1453
1678
|
extra: { need_body_topic: "1" },
|
|
1454
1679
|
xsec_source: "pc_feed",
|
|
1455
|
-
xsec_token: data
|
|
1680
|
+
xsec_token: data.xsec_token
|
|
1456
1681
|
}
|
|
1457
1682
|
};
|
|
1458
1683
|
},
|
|
1459
|
-
|
|
1684
|
+
/**
|
|
1685
|
+
* 获取评论数据的接口地址
|
|
1686
|
+
* @param data - 请求参数
|
|
1687
|
+
* @returns 完整的接口URL
|
|
1688
|
+
*/
|
|
1689
|
+
noteComments(data) {
|
|
1460
1690
|
return {
|
|
1461
1691
|
apiPath: "/api/sns/web/v2/comment/page",
|
|
1462
1692
|
Url: `https://edith.xiaohongshu.com/api/sns/web/v2/comment/page?${buildQueryString$1({
|
|
1463
|
-
note_id: data
|
|
1464
|
-
cursor: data
|
|
1693
|
+
note_id: data.note_id,
|
|
1694
|
+
cursor: data.cursor ?? "",
|
|
1465
1695
|
image_formats: [
|
|
1466
1696
|
"jpg",
|
|
1467
1697
|
"webp",
|
|
1468
1698
|
"avif"
|
|
1469
1699
|
].join(","),
|
|
1470
|
-
xsec_token: data
|
|
1700
|
+
xsec_token: data.xsec_token
|
|
1471
1701
|
})}`
|
|
1472
1702
|
};
|
|
1473
1703
|
},
|
|
1474
|
-
|
|
1704
|
+
/**
|
|
1705
|
+
* 获取用户数据的接口地址
|
|
1706
|
+
* @param data - 请求参数
|
|
1707
|
+
* @returns 完整的接口URL
|
|
1708
|
+
*/
|
|
1709
|
+
userProfile(data) {
|
|
1475
1710
|
return {
|
|
1476
1711
|
apiPath: "/api/sns/web/v1/user/otherinfo",
|
|
1477
|
-
Url: `https://www.xiaohongshu.com/user/profile/${data
|
|
1712
|
+
Url: `https://www.xiaohongshu.com/user/profile/${data.user_id}`
|
|
1478
1713
|
};
|
|
1479
1714
|
},
|
|
1480
|
-
|
|
1715
|
+
/**
|
|
1716
|
+
* 获取用户笔记数据的接口地址
|
|
1717
|
+
* @param data - 请求参数
|
|
1718
|
+
* @returns 完整的接口URL
|
|
1719
|
+
*/
|
|
1720
|
+
userNoteList(data) {
|
|
1481
1721
|
return {
|
|
1482
1722
|
apiPath: "/api/sns/web/v1/user_posted",
|
|
1483
1723
|
Url: `https://edith.xiaohongshu.com/api/sns/web/v1/user_posted?${buildQueryString$1({
|
|
1484
|
-
user_id: data
|
|
1485
|
-
cursor: data
|
|
1486
|
-
num: data
|
|
1724
|
+
user_id: data.user_id,
|
|
1725
|
+
cursor: data.cursor ?? "",
|
|
1726
|
+
num: data.num ?? 30,
|
|
1487
1727
|
image_formats: [
|
|
1488
1728
|
"jpg",
|
|
1489
1729
|
"webp",
|
|
@@ -1493,21 +1733,31 @@ const xiaohongshuApiUrls = {
|
|
|
1493
1733
|
})}`
|
|
1494
1734
|
};
|
|
1495
1735
|
},
|
|
1496
|
-
|
|
1736
|
+
/**
|
|
1737
|
+
* 获取笔记表情列表的接口地址
|
|
1738
|
+
* @param data - 请求参数
|
|
1739
|
+
* @returns 完整的接口URL
|
|
1740
|
+
*/
|
|
1741
|
+
emojiList(_data) {
|
|
1497
1742
|
return {
|
|
1498
1743
|
apiPath: "/api/im/redmoji/detail",
|
|
1499
1744
|
Url: "https://edith.xiaohongshu.com/api/im/redmoji/detail"
|
|
1500
1745
|
};
|
|
1501
1746
|
},
|
|
1502
|
-
|
|
1747
|
+
/**
|
|
1748
|
+
* 搜索笔记的接口地址
|
|
1749
|
+
* @param data - 请求参数
|
|
1750
|
+
* @returns 完整的接口URL
|
|
1751
|
+
*/
|
|
1752
|
+
searchNotes(data) {
|
|
1503
1753
|
return {
|
|
1504
1754
|
apiPath: "/api/sns/web/v1/search/notes",
|
|
1505
1755
|
Body: {
|
|
1506
|
-
keyword: data
|
|
1507
|
-
page: data
|
|
1508
|
-
page_size: data
|
|
1509
|
-
sort:
|
|
1510
|
-
note_type:
|
|
1756
|
+
keyword: data.keyword,
|
|
1757
|
+
page: data.page ?? 1,
|
|
1758
|
+
page_size: data.page_size ?? 20,
|
|
1759
|
+
sort: "general",
|
|
1760
|
+
note_type: 0,
|
|
1511
1761
|
search_id: xiaohongshuSign.getSearchId(),
|
|
1512
1762
|
image_formats: [
|
|
1513
1763
|
"jpg",
|
|
@@ -1526,82 +1776,53 @@ const xiaohongshuApiUrls = {
|
|
|
1526
1776
|
const createXiaohongshuApiUrls = () => {
|
|
1527
1777
|
return xiaohongshuApiUrls;
|
|
1528
1778
|
};
|
|
1529
|
-
|
|
1530
1779
|
//#endregion
|
|
1531
1780
|
//#region src/validation/xiaohongshu.ts
|
|
1532
1781
|
const SearchSortTypeValues = Object.values(SearchSortType).filter((v) => typeof v === "string");
|
|
1533
1782
|
const SearchNoteTypeValues = Object.values(SearchNoteType).filter((v) => typeof v === "number");
|
|
1534
1783
|
/**
|
|
1535
|
-
* 小红书首页推荐数据参数验证模式
|
|
1536
|
-
*/
|
|
1537
|
-
const HomeFeedParamsSchema = zod.object({
|
|
1538
|
-
methodType: zod.literal("homeFeed", { error: "methodType must be \"homeFeed\"" }),
|
|
1539
|
-
cursor_score: zod.string({ error: "cursor_score must be a string" }).optional(),
|
|
1540
|
-
num: zod.coerce.number({ error: "num must be a number" }).int({ error: "num must be an integer" }).min(1, { error: "num cannot be less than 1" }).max(100, { error: "num cannot be greater than 100" }).optional(),
|
|
1541
|
-
refresh_type: zod.coerce.number({ error: "refresh_type must be a number" }).int({ error: "refresh_type must be an integer" }).optional(),
|
|
1542
|
-
note_index: zod.coerce.number({ error: "note_index must be a number" }).int({ error: "note_index must be an integer" }).optional(),
|
|
1543
|
-
category: zod.string({ error: "category must be a string" }).optional(),
|
|
1544
|
-
search_key: zod.string({ error: "search_key must be a string" }).optional()
|
|
1545
|
-
});
|
|
1546
|
-
/**
|
|
1547
|
-
* 小红书单个笔记数据参数验证模式
|
|
1548
|
-
*/
|
|
1549
|
-
const NoteParamsSchema = zod.object({
|
|
1550
|
-
methodType: zod.literal("noteDetail", { error: "methodType must be \"noteDetail\"" }),
|
|
1551
|
-
note_id: zod.string({ error: "note_id must be a string" }),
|
|
1552
|
-
xsec_token: zod.string({ error: "xsec_token must be a string" })
|
|
1553
|
-
});
|
|
1554
|
-
/**
|
|
1555
|
-
* 小红书评论数据参数验证模式
|
|
1556
|
-
*/
|
|
1557
|
-
const CommentParamsSchema = zod.object({
|
|
1558
|
-
methodType: zod.literal("noteComments", { error: "methodType must be \"noteComments\"" }),
|
|
1559
|
-
note_id: zod.string({ error: "note_id must be a string" }),
|
|
1560
|
-
cursor: zod.string({ error: "cursor must be a string" }).optional(),
|
|
1561
|
-
xsec_token: zod.string({ error: "xsec_token must be a string" })
|
|
1562
|
-
});
|
|
1563
|
-
/**
|
|
1564
|
-
* 小红书用户数据参数验证模式
|
|
1565
|
-
*/
|
|
1566
|
-
const UserParamsSchema = zod.object({
|
|
1567
|
-
methodType: zod.literal("userProfile", { error: "methodType must be \"userProfile\"" }),
|
|
1568
|
-
user_id: zod.string({ error: "user_id must be a string" })
|
|
1569
|
-
});
|
|
1570
|
-
/**
|
|
1571
|
-
* 小红书用户笔记数据参数验证模式
|
|
1572
|
-
*/
|
|
1573
|
-
const UserNoteParamsSchema = zod.object({
|
|
1574
|
-
methodType: zod.literal("userNoteList", { error: "methodType must be \"userNoteList\"" }),
|
|
1575
|
-
user_id: zod.string({ error: "user_id must be a string" }),
|
|
1576
|
-
cursor: zod.string({ error: "cursor must be a string" }).optional(),
|
|
1577
|
-
num: zod.coerce.number({ error: "num must be a number" }).int({ error: "num must be an integer" }).min(1, { error: "num cannot be less than 1" }).max(100, { error: "num cannot be greater than 100" }).optional()
|
|
1578
|
-
});
|
|
1579
|
-
/**
|
|
1580
|
-
* 小红书表情列表参数验证模式
|
|
1581
|
-
*/
|
|
1582
|
-
const EmojiListParamsSchema = zod.object({ methodType: zod.literal("emojiList", { error: "methodType must be \"emojiList\"" }) });
|
|
1583
|
-
/**
|
|
1584
|
-
* 小红书搜索笔记参数验证模式
|
|
1585
|
-
*/
|
|
1586
|
-
const SearchNoteParamsSchema = zod.object({
|
|
1587
|
-
methodType: zod.literal("searchNotes", { error: "methodType must be \"searchNotes\"" }),
|
|
1588
|
-
keyword: zod.string({ error: "keyword must be a string" }),
|
|
1589
|
-
page: zod.coerce.number({ error: "page must be a number" }).int({ error: "page must be an integer" }).min(1, { error: "page cannot be less than 1" }).optional(),
|
|
1590
|
-
page_size: zod.coerce.number({ error: "page_size must be a number" }).int({ error: "page_size must be an integer" }).min(1, { error: "page_size cannot be less than 1" }).max(100, { error: "page_size cannot be greater than 100" }).optional(),
|
|
1591
|
-
sort: zod.enum(SearchSortTypeValues, { error: "Invalid sort type" }).optional(),
|
|
1592
|
-
note_type: zod.coerce.number({ error: "note_type must be a number" }).int({ error: "note_type must be an integer" }).refine((val) => SearchNoteTypeValues.includes(val), { message: "Invalid note type" }).optional()
|
|
1593
|
-
});
|
|
1594
|
-
/**
|
|
1595
1784
|
* 小红书验证模式映射
|
|
1596
1785
|
*/
|
|
1597
1786
|
const XiaohongshuValidationSchemas = {
|
|
1598
|
-
homeFeed:
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1787
|
+
homeFeed: zod.object({
|
|
1788
|
+
methodType: zod.literal("homeFeed", { error: "methodType must be \"homeFeed\"" }),
|
|
1789
|
+
cursor_score: zod.string({ error: "cursor_score must be a string" }).optional(),
|
|
1790
|
+
num: zod.coerce.number({ error: "num must be a number" }).int({ error: "num must be an integer" }).min(1, { error: "num cannot be less than 1" }).max(100, { error: "num cannot be greater than 100" }).optional(),
|
|
1791
|
+
refresh_type: zod.coerce.number({ error: "refresh_type must be a number" }).int({ error: "refresh_type must be an integer" }).optional(),
|
|
1792
|
+
note_index: zod.coerce.number({ error: "note_index must be a number" }).int({ error: "note_index must be an integer" }).optional(),
|
|
1793
|
+
category: zod.string({ error: "category must be a string" }).optional(),
|
|
1794
|
+
search_key: zod.string({ error: "search_key must be a string" }).optional()
|
|
1795
|
+
}),
|
|
1796
|
+
noteDetail: zod.object({
|
|
1797
|
+
methodType: zod.literal("noteDetail", { error: "methodType must be \"noteDetail\"" }),
|
|
1798
|
+
note_id: zod.string({ error: "note_id must be a string" }),
|
|
1799
|
+
xsec_token: zod.string({ error: "xsec_token must be a string" })
|
|
1800
|
+
}),
|
|
1801
|
+
noteComments: zod.object({
|
|
1802
|
+
methodType: zod.literal("noteComments", { error: "methodType must be \"noteComments\"" }),
|
|
1803
|
+
note_id: zod.string({ error: "note_id must be a string" }),
|
|
1804
|
+
cursor: zod.string({ error: "cursor must be a string" }).optional(),
|
|
1805
|
+
xsec_token: zod.string({ error: "xsec_token must be a string" })
|
|
1806
|
+
}),
|
|
1807
|
+
userProfile: zod.object({
|
|
1808
|
+
methodType: zod.literal("userProfile", { error: "methodType must be \"userProfile\"" }),
|
|
1809
|
+
user_id: zod.string({ error: "user_id must be a string" })
|
|
1810
|
+
}),
|
|
1811
|
+
userNoteList: zod.object({
|
|
1812
|
+
methodType: zod.literal("userNoteList", { error: "methodType must be \"userNoteList\"" }),
|
|
1813
|
+
user_id: zod.string({ error: "user_id must be a string" }),
|
|
1814
|
+
cursor: zod.string({ error: "cursor must be a string" }).optional(),
|
|
1815
|
+
num: zod.coerce.number({ error: "num must be a number" }).int({ error: "num must be an integer" }).min(1, { error: "num cannot be less than 1" }).max(100, { error: "num cannot be greater than 100" }).optional()
|
|
1816
|
+
}),
|
|
1817
|
+
emojiList: zod.object({ methodType: zod.literal("emojiList", { error: "methodType must be \"emojiList\"" }) }),
|
|
1818
|
+
searchNotes: zod.object({
|
|
1819
|
+
methodType: zod.literal("searchNotes", { error: "methodType must be \"searchNotes\"" }),
|
|
1820
|
+
keyword: zod.string({ error: "keyword must be a string" }),
|
|
1821
|
+
page: zod.coerce.number({ error: "page must be a number" }).int({ error: "page must be an integer" }).min(1, { error: "page cannot be less than 1" }).optional(),
|
|
1822
|
+
page_size: zod.coerce.number({ error: "page_size must be a number" }).int({ error: "page_size must be an integer" }).min(1, { error: "page_size cannot be less than 1" }).max(100, { error: "page_size cannot be greater than 100" }).optional(),
|
|
1823
|
+
sort: zod.enum(SearchSortTypeValues, { error: "Invalid sort type" }).optional(),
|
|
1824
|
+
note_type: zod.coerce.number({ error: "note_type must be a number" }).int({ error: "note_type must be an integer" }).refine((val) => SearchNoteTypeValues.includes(val), { message: "Invalid note type" }).optional()
|
|
1825
|
+
})
|
|
1605
1826
|
};
|
|
1606
1827
|
/**
|
|
1607
1828
|
* 小红书方法路由映射
|
|
@@ -1615,7 +1836,6 @@ const XiaohongshuMethodRoutes = {
|
|
|
1615
1836
|
emojiList: "/fetch_emoji_list",
|
|
1616
1837
|
searchNotes: "/fetch_search_notes"
|
|
1617
1838
|
};
|
|
1618
|
-
|
|
1619
1839
|
//#endregion
|
|
1620
1840
|
//#region src/validation/index.ts
|
|
1621
1841
|
/**
|
|
@@ -1685,10 +1905,10 @@ const validateXiaohongshuParams = (methodType, params) => {
|
|
|
1685
1905
|
* @param code - 响应状态码(可选,默认200)
|
|
1686
1906
|
* @returns 格式化的成功API响应对象
|
|
1687
1907
|
*/
|
|
1688
|
-
const createSuccessResponse = (data
|
|
1908
|
+
const createSuccessResponse = (data, message, code = 200) => {
|
|
1689
1909
|
return {
|
|
1690
1910
|
success: true,
|
|
1691
|
-
data
|
|
1911
|
+
data,
|
|
1692
1912
|
message,
|
|
1693
1913
|
code,
|
|
1694
1914
|
error: void 0
|
|
@@ -1701,16 +1921,15 @@ const createSuccessResponse = (data$1, message, code = 200) => {
|
|
|
1701
1921
|
* @param code - 错误状态码(可选,默认500)
|
|
1702
1922
|
* @returns 格式化的错误响应对象
|
|
1703
1923
|
*/
|
|
1704
|
-
const createErrorResponse = (error, message, code = 500, data
|
|
1924
|
+
const createErrorResponse = (error, message, code = 500, data) => {
|
|
1705
1925
|
return {
|
|
1706
1926
|
success: false,
|
|
1707
1927
|
error,
|
|
1708
1928
|
message,
|
|
1709
1929
|
code,
|
|
1710
|
-
data
|
|
1930
|
+
data
|
|
1711
1931
|
};
|
|
1712
1932
|
};
|
|
1713
|
-
|
|
1714
1933
|
//#endregion
|
|
1715
1934
|
//#region src/model/fetchers/bilibili/internal.ts
|
|
1716
1935
|
/**
|
|
@@ -1731,15 +1950,20 @@ async function fetchBilibiliInternal(methodType, options, config) {
|
|
|
1731
1950
|
const rawData = await fetchBilibili({ ...validateBilibiliParams(methodType, options) }, config.cookie, config.requestConfig);
|
|
1732
1951
|
const duration = Date.now() - startTime;
|
|
1733
1952
|
if (rawData.code !== 0) {
|
|
1953
|
+
const errorMessage = rawData.message || "B站数据获取失败";
|
|
1734
1954
|
emitApiError({
|
|
1735
1955
|
platform: "bilibili",
|
|
1736
1956
|
methodType,
|
|
1737
1957
|
errorCode: rawData.code,
|
|
1738
|
-
errorMessage
|
|
1958
|
+
errorMessage,
|
|
1739
1959
|
url: void 0,
|
|
1740
1960
|
duration
|
|
1741
1961
|
});
|
|
1742
|
-
return createErrorResponse(rawData.amagiError
|
|
1962
|
+
return createErrorResponse(rawData.amagiError ?? {
|
|
1963
|
+
errorDescription: errorMessage,
|
|
1964
|
+
requestType: methodType,
|
|
1965
|
+
requestUrl: void 0
|
|
1966
|
+
}, errorMessage, rawData.code, rawData);
|
|
1743
1967
|
}
|
|
1744
1968
|
const result = createSuccessResponse(rawData, "获取成功", 200);
|
|
1745
1969
|
emitApiSuccess({
|
|
@@ -1762,7 +1986,6 @@ async function fetchBilibiliInternal(methodType, options, config) {
|
|
|
1762
1986
|
throw new Error(`B站数据获取失败: ${errorMessage}`);
|
|
1763
1987
|
}
|
|
1764
1988
|
}
|
|
1765
|
-
|
|
1766
1989
|
//#endregion
|
|
1767
1990
|
//#region src/model/fetchers/bilibili/article.ts
|
|
1768
1991
|
/**
|
|
@@ -1841,7 +2064,6 @@ async function fetchArticleListInfo(options, cookie, requestConfig) {
|
|
|
1841
2064
|
requestConfig
|
|
1842
2065
|
});
|
|
1843
2066
|
}
|
|
1844
|
-
|
|
1845
2067
|
//#endregion
|
|
1846
2068
|
//#region src/model/fetchers/bilibili/auth.ts
|
|
1847
2069
|
/**
|
|
@@ -1942,7 +2164,6 @@ async function validateCaptchaResult(options, cookie, requestConfig) {
|
|
|
1942
2164
|
requestConfig
|
|
1943
2165
|
});
|
|
1944
2166
|
}
|
|
1945
|
-
|
|
1946
2167
|
//#endregion
|
|
1947
2168
|
//#region src/model/fetchers/bilibili/bangumi.ts
|
|
1948
2169
|
/**
|
|
@@ -1985,7 +2206,6 @@ async function fetchBangumiStreamUrl(options, cookie, requestConfig) {
|
|
|
1985
2206
|
requestConfig
|
|
1986
2207
|
});
|
|
1987
2208
|
}
|
|
1988
|
-
|
|
1989
2209
|
//#endregion
|
|
1990
2210
|
//#region src/model/fetchers/bilibili/comment.ts
|
|
1991
2211
|
/**
|
|
@@ -2029,7 +2249,6 @@ async function fetchCommentReplies$1(options, cookie, requestConfig) {
|
|
|
2029
2249
|
requestConfig
|
|
2030
2250
|
});
|
|
2031
2251
|
}
|
|
2032
|
-
|
|
2033
2252
|
//#endregion
|
|
2034
2253
|
//#region src/model/fetchers/bilibili/dynamic.ts
|
|
2035
2254
|
/**
|
|
@@ -2053,24 +2272,29 @@ async function fetchDynamicDetail(options, cookie, requestConfig) {
|
|
|
2053
2272
|
}
|
|
2054
2273
|
/**
|
|
2055
2274
|
* 获取B站动态卡片信息
|
|
2275
|
+
*
|
|
2276
|
+
* @deprecated v6.1.3 已废弃,B站官方已于 `2025-08-09` 删除原 `dynamic_svr` 接口。
|
|
2277
|
+
* 调用将返回错误信息
|
|
2278
|
+
* 计划于 v7.0.0 移除。
|
|
2279
|
+
*
|
|
2056
2280
|
* @param options - 动态参数
|
|
2057
2281
|
* @param options.dynamic_id - 动态 ID
|
|
2058
2282
|
* @param cookie - B站 Cookie (可选)
|
|
2059
2283
|
* @param requestConfig - 请求配置 (可选)
|
|
2060
|
-
* @returns
|
|
2284
|
+
* @returns 动态卡片数据(已停用,返回错误信息)
|
|
2061
2285
|
* @example
|
|
2062
2286
|
* ```typescript
|
|
2063
2287
|
* const result = await fetchDynamicCard({ dynamic_id: '123456789' }, cookie)
|
|
2064
|
-
*
|
|
2288
|
+
* // result.success === false,错误信息提示接口已停用
|
|
2065
2289
|
* ```
|
|
2066
2290
|
*/
|
|
2067
2291
|
async function fetchDynamicCard(options, cookie, requestConfig) {
|
|
2292
|
+
checkDeprecation("fetchDynamicCard");
|
|
2068
2293
|
return fetchBilibiliInternal("dynamicCard", options, {
|
|
2069
2294
|
cookie,
|
|
2070
2295
|
requestConfig
|
|
2071
2296
|
});
|
|
2072
2297
|
}
|
|
2073
|
-
|
|
2074
2298
|
//#endregion
|
|
2075
2299
|
//#region src/model/fetchers/bilibili/live.ts
|
|
2076
2300
|
/**
|
|
@@ -2111,7 +2335,6 @@ async function fetchLiveRoomInitInfo(options, cookie, requestConfig) {
|
|
|
2111
2335
|
requestConfig
|
|
2112
2336
|
});
|
|
2113
2337
|
}
|
|
2114
|
-
|
|
2115
2338
|
//#endregion
|
|
2116
2339
|
//#region src/model/fetchers/bilibili/user.ts
|
|
2117
2340
|
/**
|
|
@@ -2190,7 +2413,6 @@ async function fetchUploaderTotalViews(options, cookie, requestConfig) {
|
|
|
2190
2413
|
requestConfig
|
|
2191
2414
|
});
|
|
2192
2415
|
}
|
|
2193
|
-
|
|
2194
2416
|
//#endregion
|
|
2195
2417
|
//#region src/model/fetchers/bilibili/utils.ts
|
|
2196
2418
|
/**
|
|
@@ -2250,7 +2472,6 @@ async function fetchEmojiList$3(options, cookie, requestConfig) {
|
|
|
2250
2472
|
requestConfig
|
|
2251
2473
|
});
|
|
2252
2474
|
}
|
|
2253
|
-
|
|
2254
2475
|
//#endregion
|
|
2255
2476
|
//#region src/model/fetchers/bilibili/video.ts
|
|
2256
2477
|
/**
|
|
@@ -2311,7 +2532,6 @@ async function fetchVideoDanmaku(options, cookie, requestConfig) {
|
|
|
2311
2532
|
requestConfig
|
|
2312
2533
|
});
|
|
2313
2534
|
}
|
|
2314
|
-
|
|
2315
2535
|
//#endregion
|
|
2316
2536
|
//#region src/model/fetchers/bilibili/bound.ts
|
|
2317
2537
|
/**
|
|
@@ -2339,6 +2559,7 @@ function createBoundBilibiliFetcher(cookie, requestConfig) {
|
|
|
2339
2559
|
fetchUserSpaceInfo: (options) => fetchUserSpaceInfo(options, cookie, requestConfig),
|
|
2340
2560
|
fetchUploaderTotalViews: (options) => fetchUploaderTotalViews(options, cookie, requestConfig),
|
|
2341
2561
|
fetchDynamicDetail: (options) => fetchDynamicDetail(options, cookie, requestConfig),
|
|
2562
|
+
/** @deprecated v6.1.3 已废弃,调用将返回错误信息 */
|
|
2342
2563
|
fetchDynamicCard: (options) => fetchDynamicCard(options, cookie, requestConfig),
|
|
2343
2564
|
fetchBangumiInfo: (options) => fetchBangumiInfo(options, cookie, requestConfig),
|
|
2344
2565
|
fetchBangumiStreamUrl: (options) => fetchBangumiStreamUrl(options, cookie, requestConfig),
|
|
@@ -2358,7 +2579,6 @@ function createBoundBilibiliFetcher(cookie, requestConfig) {
|
|
|
2358
2579
|
fetchEmojiList: (options) => fetchEmojiList$3(options, cookie, requestConfig)
|
|
2359
2580
|
};
|
|
2360
2581
|
}
|
|
2361
|
-
|
|
2362
2582
|
//#endregion
|
|
2363
2583
|
//#region src/model/fetchers/bilibili/index.ts
|
|
2364
2584
|
/**
|
|
@@ -2404,7 +2624,6 @@ const bilibiliFetcher = {
|
|
|
2404
2624
|
convertBvToAv,
|
|
2405
2625
|
fetchEmojiList: fetchEmojiList$3
|
|
2406
2626
|
};
|
|
2407
|
-
|
|
2408
2627
|
//#endregion
|
|
2409
2628
|
//#region src/platform/defaultConfigs.ts
|
|
2410
2629
|
/**
|
|
@@ -2425,7 +2644,7 @@ const generateSecChUa = (userAgent) => {
|
|
|
2425
2644
|
*/
|
|
2426
2645
|
const getDouyinDefaultConfig = (cookie, requestConfig) => {
|
|
2427
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";
|
|
2428
|
-
finalUserAgent = finalUserAgent.replace(/\s+Edg\/[\d
|
|
2647
|
+
finalUserAgent = finalUserAgent.replace(/\s+Edg\/[\d.]+/g, "");
|
|
2429
2648
|
const defHeaders = {
|
|
2430
2649
|
Accept: "application/json, text/plain, */*",
|
|
2431
2650
|
"Accept-Encoding": "gzip, deflate, br, zstd",
|
|
@@ -2539,158 +2758,34 @@ const getXiaohongshuDefaultConfig = (cookie) => {
|
|
|
2539
2758
|
cookie: cookie ?? ""
|
|
2540
2759
|
} };
|
|
2541
2760
|
};
|
|
2542
|
-
|
|
2543
2761
|
//#endregion
|
|
2544
2762
|
//#region src/types/NetworksConfigType.ts
|
|
2545
|
-
/** 未知错误 */
|
|
2546
|
-
let amagiAPIErrorCode = /* @__PURE__ */ function(amagiAPIErrorCode$1) {
|
|
2547
|
-
/** 未知错误 */
|
|
2548
|
-
amagiAPIErrorCode$1["UNKNOWN"] = "UNKNOWN_ERROR";
|
|
2549
|
-
return amagiAPIErrorCode$1;
|
|
2550
|
-
}({});
|
|
2551
|
-
/** 抖音平台API错误码 */
|
|
2552
|
-
let douoyinAPIErrorCode = /* @__PURE__ */ function(douoyinAPIErrorCode$1) {
|
|
2553
|
-
/** Cookie无效或已过期 */
|
|
2554
|
-
douoyinAPIErrorCode$1["COOKIE"] = "INVALID_COOKIE";
|
|
2555
|
-
/** 内容被隐藏或下架 */
|
|
2556
|
-
douoyinAPIErrorCode$1["FILTER"] = "CONTENT_FILTERED";
|
|
2557
|
-
/** 当前用户未开播 */
|
|
2558
|
-
douoyinAPIErrorCode$1["NOT_LIVE"] = "USER_NOT_LIVE";
|
|
2559
|
-
/** 未知错误 */
|
|
2560
|
-
douoyinAPIErrorCode$1["UNKNOWN"] = "UNKNOWN_ERROR";
|
|
2561
|
-
return douoyinAPIErrorCode$1;
|
|
2562
|
-
}({});
|
|
2563
|
-
/** B站平台API错误码 */
|
|
2564
|
-
let bilibiliAPIErrorCode = /* @__PURE__ */ function(bilibiliAPIErrorCode$1) {
|
|
2565
|
-
/** 应用程序不存在或已被封禁 */
|
|
2566
|
-
bilibiliAPIErrorCode$1["APP_NOT_FOUND"] = "-1";
|
|
2567
|
-
/** Access Key 错误 */
|
|
2568
|
-
bilibiliAPIErrorCode$1["ACCESS_KEY_ERROR"] = "-2";
|
|
2569
|
-
/** API 校验密匙错误 */
|
|
2570
|
-
bilibiliAPIErrorCode$1["API_KEY_ERROR"] = "-3";
|
|
2571
|
-
/** 调用方对该Method没有权限 */
|
|
2572
|
-
bilibiliAPIErrorCode$1["METHOD_NOT_PERMITTED"] = "-4";
|
|
2573
|
-
/** 账号未登录 */
|
|
2574
|
-
bilibiliAPIErrorCode$1["NOT_LOGGED_IN"] = "-101";
|
|
2575
|
-
/** 账号被封停 */
|
|
2576
|
-
bilibiliAPIErrorCode$1["ACCOUNT_BANNED"] = "-102";
|
|
2577
|
-
/** 积分不足 */
|
|
2578
|
-
bilibiliAPIErrorCode$1["POINTS_INSUFFICIENT"] = "-103";
|
|
2579
|
-
/** 硬币不足 */
|
|
2580
|
-
bilibiliAPIErrorCode$1["COINS_INSUFFICIENT"] = "-104";
|
|
2581
|
-
/** 验证码错误 */
|
|
2582
|
-
bilibiliAPIErrorCode$1["CAPTCHA_ERROR"] = "-105";
|
|
2583
|
-
/** 账号非正式会员或在适应期 */
|
|
2584
|
-
bilibiliAPIErrorCode$1["MEMBERSHIP_LIMITED"] = "-106";
|
|
2585
|
-
/** 应用不存在或者被封禁 */
|
|
2586
|
-
bilibiliAPIErrorCode$1["APP_BANNED"] = "-107";
|
|
2587
|
-
/** 未绑定手机 */
|
|
2588
|
-
bilibiliAPIErrorCode$1["PHONE_NOT_BOUND"] = "-108";
|
|
2589
|
-
/** 未绑定手机 */
|
|
2590
|
-
bilibiliAPIErrorCode$1["PHONE_NOT_BOUND_2"] = "-110";
|
|
2591
|
-
/** csrf 校验失败 */
|
|
2592
|
-
bilibiliAPIErrorCode$1["CSRF_ERROR"] = "-111";
|
|
2593
|
-
/** 系统升级中 */
|
|
2594
|
-
bilibiliAPIErrorCode$1["SYSTEM_UPDATING"] = "-112";
|
|
2595
|
-
/** 账号尚未实名认证 */
|
|
2596
|
-
bilibiliAPIErrorCode$1["NOT_REAL_NAME_VERIFIED"] = "-113";
|
|
2597
|
-
/** 请先绑定手机 */
|
|
2598
|
-
bilibiliAPIErrorCode$1["NEED_BIND_PHONE"] = "-114";
|
|
2599
|
-
/** 请先完成实名认证 */
|
|
2600
|
-
bilibiliAPIErrorCode$1["NEED_REAL_NAME_VERIFICATION"] = "-115";
|
|
2601
|
-
/** 木有改动 */
|
|
2602
|
-
bilibiliAPIErrorCode$1["NO_CHANGE"] = "-304";
|
|
2603
|
-
/** 撞车跳转 */
|
|
2604
|
-
bilibiliAPIErrorCode$1["CONFLICT_REDIRECT"] = "-307";
|
|
2605
|
-
/** 风控校验失败 (UA 或 wbi 参数不合法) */
|
|
2606
|
-
bilibiliAPIErrorCode$1["RISK_CONTROL_FAILED"] = "-352";
|
|
2607
|
-
/** 请求错误 */
|
|
2608
|
-
bilibiliAPIErrorCode$1["BAD_REQUEST"] = "-400";
|
|
2609
|
-
/** 未认证 (或非法请求) */
|
|
2610
|
-
bilibiliAPIErrorCode$1["UNAUTHORIZED"] = "-401";
|
|
2611
|
-
/** 访问权限不足 */
|
|
2612
|
-
bilibiliAPIErrorCode$1["FORBIDDEN"] = "-403";
|
|
2613
|
-
/** 啥都木有 */
|
|
2614
|
-
bilibiliAPIErrorCode$1["NOT_FOUND"] = "-404";
|
|
2615
|
-
/** 不支持该方法 */
|
|
2616
|
-
bilibiliAPIErrorCode$1["METHOD_NOT_ALLOWED"] = "-405";
|
|
2617
|
-
/** 冲突 */
|
|
2618
|
-
bilibiliAPIErrorCode$1["CONFLICT"] = "-409";
|
|
2619
|
-
/** 请求被拦截 (客户端 ip 被服务端风控) */
|
|
2620
|
-
bilibiliAPIErrorCode$1["IP_BLOCKED"] = "-412";
|
|
2621
|
-
/** 服务器错误 */
|
|
2622
|
-
bilibiliAPIErrorCode$1["SERVER_ERROR"] = "-500";
|
|
2623
|
-
/** 过载保护,服务暂不可用 */
|
|
2624
|
-
bilibiliAPIErrorCode$1["SERVICE_UNAVAILABLE"] = "-503";
|
|
2625
|
-
/** 服务调用超时 */
|
|
2626
|
-
bilibiliAPIErrorCode$1["GATEWAY_TIMEOUT"] = "-504";
|
|
2627
|
-
/** 超出限制 */
|
|
2628
|
-
bilibiliAPIErrorCode$1["RATE_LIMITED"] = "-509";
|
|
2629
|
-
/** 上传文件不存在 */
|
|
2630
|
-
bilibiliAPIErrorCode$1["FILE_NOT_FOUND"] = "-616";
|
|
2631
|
-
/** 上传文件太大 */
|
|
2632
|
-
bilibiliAPIErrorCode$1["FILE_TOO_LARGE"] = "-617";
|
|
2633
|
-
/** 登录失败次数太多 */
|
|
2634
|
-
bilibiliAPIErrorCode$1["LOGIN_ATTEMPTS_EXCEEDED"] = "-625";
|
|
2635
|
-
/** 用户不存在 */
|
|
2636
|
-
bilibiliAPIErrorCode$1["USER_NOT_FOUND"] = "-626";
|
|
2637
|
-
/** 密码太弱 */
|
|
2638
|
-
bilibiliAPIErrorCode$1["WEAK_PASSWORD"] = "-628";
|
|
2639
|
-
/** 用户名或密码错误 */
|
|
2640
|
-
bilibiliAPIErrorCode$1["INVALID_CREDENTIALS"] = "-629";
|
|
2641
|
-
/** 操作对象数量限制 */
|
|
2642
|
-
bilibiliAPIErrorCode$1["OBJECT_LIMIT_EXCEEDED"] = "-632";
|
|
2643
|
-
/** 被锁定 */
|
|
2644
|
-
bilibiliAPIErrorCode$1["ACCOUNT_LOCKED"] = "-643";
|
|
2645
|
-
/** 用户等级太低 */
|
|
2646
|
-
bilibiliAPIErrorCode$1["USER_LEVEL_TOO_LOW"] = "-650";
|
|
2647
|
-
/** 重复的用户 */
|
|
2648
|
-
bilibiliAPIErrorCode$1["DUPLICATE_USER"] = "-652";
|
|
2649
|
-
/** Token 过期 */
|
|
2650
|
-
bilibiliAPIErrorCode$1["TOKEN_EXPIRED"] = "-658";
|
|
2651
|
-
/** 密码时间戳过期 */
|
|
2652
|
-
bilibiliAPIErrorCode$1["PASSWORD_TIMESTAMP_EXPIRED"] = "-662";
|
|
2653
|
-
/** 地理区域限制 */
|
|
2654
|
-
bilibiliAPIErrorCode$1["GEO_RESTRICTED"] = "-688";
|
|
2655
|
-
/** 版权限制 */
|
|
2656
|
-
bilibiliAPIErrorCode$1["COPYRIGHT_RESTRICTED"] = "-689";
|
|
2657
|
-
/** 扣节操失败 */
|
|
2658
|
-
bilibiliAPIErrorCode$1["REPUTATION_DEDUCTION_FAILED"] = "-701";
|
|
2659
|
-
/** 请求过于频繁,请稍后再试 */
|
|
2660
|
-
bilibiliAPIErrorCode$1["TOO_MANY_REQUESTS"] = "-799";
|
|
2661
|
-
/** 服务器开小差了 */
|
|
2662
|
-
bilibiliAPIErrorCode$1["SERVER_TEMPORARILY_UNAVAILABLE"] = "-8888";
|
|
2663
|
-
/** 未知错误 */
|
|
2664
|
-
bilibiliAPIErrorCode$1["UNKNOWN"] = "UNKNOWN";
|
|
2665
|
-
return bilibiliAPIErrorCode$1;
|
|
2666
|
-
}({});
|
|
2667
2763
|
/** 快手平台API错误码 */
|
|
2668
|
-
let kuaishouAPIErrorCode = /* @__PURE__ */ function(kuaishouAPIErrorCode
|
|
2764
|
+
let kuaishouAPIErrorCode = /* @__PURE__ */ function(kuaishouAPIErrorCode) {
|
|
2669
2765
|
/** Cookie无效或已过期 */
|
|
2670
|
-
kuaishouAPIErrorCode
|
|
2766
|
+
kuaishouAPIErrorCode["COOKIE"] = "INVALID_COOKIE";
|
|
2671
2767
|
/** 未知错误 */
|
|
2672
|
-
kuaishouAPIErrorCode
|
|
2673
|
-
return kuaishouAPIErrorCode
|
|
2768
|
+
kuaishouAPIErrorCode["UNKNOWN"] = "UNKNOWN_ERROR";
|
|
2769
|
+
return kuaishouAPIErrorCode;
|
|
2674
2770
|
}({});
|
|
2675
2771
|
/** 小红书平台API错误码 */
|
|
2676
|
-
let xiaohongshuAPIErrorCode = /* @__PURE__ */ function(xiaohongshuAPIErrorCode
|
|
2772
|
+
let xiaohongshuAPIErrorCode = /* @__PURE__ */ function(xiaohongshuAPIErrorCode) {
|
|
2677
2773
|
/** Cookie无效或已过期 */
|
|
2678
|
-
xiaohongshuAPIErrorCode
|
|
2774
|
+
xiaohongshuAPIErrorCode["COOKIE"] = "INVALID_COOKIE";
|
|
2679
2775
|
/** 未知错误 */
|
|
2680
|
-
xiaohongshuAPIErrorCode
|
|
2776
|
+
xiaohongshuAPIErrorCode["UNKNOWN"] = "UNKNOWN_ERROR";
|
|
2681
2777
|
/** 非法请求 */
|
|
2682
|
-
xiaohongshuAPIErrorCode
|
|
2778
|
+
xiaohongshuAPIErrorCode[xiaohongshuAPIErrorCode["ILLEGAL_REQUEST"] = 500] = "ILLEGAL_REQUEST";
|
|
2683
2779
|
/** 检测到帐号异常,请稍后重试 */
|
|
2684
|
-
xiaohongshuAPIErrorCode
|
|
2780
|
+
xiaohongshuAPIErrorCode[xiaohongshuAPIErrorCode["ACCOUNT_ABNORMAL"] = 300011] = "ACCOUNT_ABNORMAL";
|
|
2685
2781
|
/** 网络连接异常,请检查网络设置后重试 */
|
|
2686
|
-
xiaohongshuAPIErrorCode
|
|
2782
|
+
xiaohongshuAPIErrorCode[xiaohongshuAPIErrorCode["NETWORK_ERROR"] = 300012] = "NETWORK_ERROR";
|
|
2687
2783
|
/** 访问频次异常,请勿频繁操作 */
|
|
2688
|
-
xiaohongshuAPIErrorCode
|
|
2784
|
+
xiaohongshuAPIErrorCode[xiaohongshuAPIErrorCode["FREQUENCY_ERROR"] = 300013] = "FREQUENCY_ERROR";
|
|
2689
2785
|
/** 浏览器异常,请尝试更换浏览器后重试 */
|
|
2690
|
-
xiaohongshuAPIErrorCode
|
|
2691
|
-
return xiaohongshuAPIErrorCode
|
|
2786
|
+
xiaohongshuAPIErrorCode[xiaohongshuAPIErrorCode["BROWSER_ERROR"] = 300015] = "BROWSER_ERROR";
|
|
2787
|
+
return xiaohongshuAPIErrorCode;
|
|
2692
2788
|
}({});
|
|
2693
|
-
|
|
2694
2789
|
//#endregion
|
|
2695
2790
|
//#region src/platform/douyin/sign/a_bogus.ts
|
|
2696
2791
|
var SM3 = class {
|
|
@@ -2724,7 +2819,8 @@ var SM3 = class {
|
|
|
2724
2819
|
this.chunk = this.chunk.concat(a.slice(0, f));
|
|
2725
2820
|
while (this.chunk.length >= 64) {
|
|
2726
2821
|
this._compress(this.chunk);
|
|
2727
|
-
f < a.length
|
|
2822
|
+
if (f < a.length) this.chunk = a.slice(f, Math.min(f + 64, a.length));
|
|
2823
|
+
else this.chunk = [];
|
|
2728
2824
|
f += 64;
|
|
2729
2825
|
}
|
|
2730
2826
|
}
|
|
@@ -2760,10 +2856,17 @@ var SM3 = class {
|
|
|
2760
2856
|
if (t.length < 64) console.error("compress error: not enough data");
|
|
2761
2857
|
else {
|
|
2762
2858
|
for (var f = ((e) => {
|
|
2763
|
-
for (var r = new Array(132), 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
|
+
}
|
|
2764
2866
|
for (var n = 16; n < 68; n++) {
|
|
2765
2867
|
let a = r[n - 16] ^ r[n - 9] ^ this.le(r[n - 3], 15);
|
|
2766
|
-
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;
|
|
2767
2870
|
}
|
|
2768
2871
|
for (n = 0; n < 64; n++) r[n + 68] = (r[n] ^ r[n + 4]) >>> 0;
|
|
2769
2872
|
return r;
|
|
@@ -2773,7 +2876,15 @@ var SM3 = class {
|
|
|
2773
2876
|
let u = this.pe(c, i[0], i[1], i[2]);
|
|
2774
2877
|
u = (4294967295 & (u = u + i[3] + s + f[c + 68])) >>> 0;
|
|
2775
2878
|
let b = this.he(c, i[4], i[5], i[6]);
|
|
2776
|
-
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;
|
|
2777
2888
|
}
|
|
2778
2889
|
for (let l = 0; l < 8; l++) this.reg[l] = (this.reg[l] ^ i[l]) >>> 0;
|
|
2779
2890
|
}
|
|
@@ -2839,18 +2950,17 @@ function rc4_encrypt(plaintext, key) {
|
|
|
2839
2950
|
return cipher.join("");
|
|
2840
2951
|
}
|
|
2841
2952
|
function result_encrypt(long_str, num) {
|
|
2842
|
-
const s_obj = {
|
|
2843
|
-
s0: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
|
2844
|
-
s1: "Dkdpgh4ZKsQB80/Mfvw36XI1R25+WUAlEi7NLboqYTOPuzmFjJnryx9HVGcaStCe=",
|
|
2845
|
-
s2: "Dkdpgh4ZKsQB80/Mfvw36XI1R25-WUAlEi7NLboqYTOPuzmFjJnryx9HVGcaStCe=",
|
|
2846
|
-
s3: "ckdp1h4ZKsUB80/Mfvw36XIgR25+WQAlEi7NLboqYTOPuzmFjJnryx9HVGDaStCe",
|
|
2847
|
-
s4: "Dkdpgh2ZmsQB80/MfvV36XI1R45-WUAlEixNLwoqYTOPuzKFjJnry79HbGcaStCe"
|
|
2848
|
-
};
|
|
2849
2953
|
const constant = {
|
|
2850
2954
|
0: 16515072,
|
|
2851
2955
|
1: 258048,
|
|
2852
2956
|
2: 4032,
|
|
2853
|
-
str:
|
|
2957
|
+
str: {
|
|
2958
|
+
s0: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
|
2959
|
+
s1: "Dkdpgh4ZKsQB80/Mfvw36XI1R25+WUAlEi7NLboqYTOPuzmFjJnryx9HVGcaStCe=",
|
|
2960
|
+
s2: "Dkdpgh4ZKsQB80/Mfvw36XI1R25-WUAlEi7NLboqYTOPuzmFjJnryx9HVGcaStCe=",
|
|
2961
|
+
s3: "ckdp1h4ZKsUB80/Mfvw36XIgR25+WQAlEi7NLboqYTOPuzmFjJnryx9HVGDaStCe",
|
|
2962
|
+
s4: "Dkdpgh2ZmsQB80/MfvV36XI1R45-WUAlEixNLwoqYTOPuzKFjJnry79HbGcaStCe"
|
|
2963
|
+
}[num]
|
|
2854
2964
|
};
|
|
2855
2965
|
let result = "";
|
|
2856
2966
|
let lound = 0;
|
|
@@ -2910,10 +3020,9 @@ function generate_rc4_bb_str(url_search_params, user_agent, window_env_str, suff
|
|
|
2910
3020
|
1,
|
|
2911
3021
|
14
|
|
2912
3022
|
])), "s3"));
|
|
2913
|
-
const end_time = Date.now();
|
|
2914
3023
|
let b = {
|
|
2915
3024
|
8: 3,
|
|
2916
|
-
10:
|
|
3025
|
+
10: Date.now(),
|
|
2917
3026
|
15: {
|
|
2918
3027
|
aid: 6383,
|
|
2919
3028
|
pageId: 6241,
|
|
@@ -3086,7 +3195,7 @@ function generate_random_str() {
|
|
|
3086
3195
|
* @returns 清理后的User-Agent字符串
|
|
3087
3196
|
*/
|
|
3088
3197
|
const cleanUserAgentForSigning = (userAgent) => {
|
|
3089
|
-
return userAgent.replace(/\s+Edg\/[\d
|
|
3198
|
+
return userAgent.replace(/\s+Edg\/[\d.]+/g, "");
|
|
3090
3199
|
};
|
|
3091
3200
|
/**
|
|
3092
3201
|
* 抖音a_bogus签名算法
|
|
@@ -3098,7 +3207,6 @@ var a_bogus_default = (url, user_agent) => {
|
|
|
3098
3207
|
const cleanedUserAgent = cleanUserAgentForSigning(user_agent);
|
|
3099
3208
|
return result_encrypt(generate_random_str() + generate_rc4_bb_str(new URLSearchParams(new URL(url).search).toString(), cleanedUserAgent, "1536|747|1536|834|0|30|0|0|1536|834|1536|864|1525|747|24|24|Win32"), "s4") + "=";
|
|
3100
3209
|
};
|
|
3101
|
-
|
|
3102
3210
|
//#endregion
|
|
3103
3211
|
//#region src/platform/douyin/sign/x_bogus.ts
|
|
3104
3212
|
/**
|
|
@@ -3163,14 +3271,14 @@ var XBogus = class {
|
|
|
3163
3271
|
encodingConversion2(a, b, c) {
|
|
3164
3272
|
return String.fromCharCode(a) + String.fromCharCode(b) + c;
|
|
3165
3273
|
}
|
|
3166
|
-
rc4Encrypt(key, data
|
|
3274
|
+
rc4Encrypt(key, data) {
|
|
3167
3275
|
const keyBuffer = typeof key === "string" ? Buffer.from(key, "latin1") : key;
|
|
3168
|
-
const dataBuffer = Buffer.from(data
|
|
3169
|
-
const S = Array.from({ length: 256 }, (_, i
|
|
3276
|
+
const dataBuffer = Buffer.from(data, "latin1");
|
|
3277
|
+
const S = Array.from({ length: 256 }, (_, i) => i);
|
|
3170
3278
|
let j = 0;
|
|
3171
|
-
for (let i
|
|
3172
|
-
j = (j + S[i
|
|
3173
|
-
[S[i
|
|
3279
|
+
for (let i = 0; i < 256; i++) {
|
|
3280
|
+
j = (j + S[i] + keyBuffer[i % keyBuffer.length]) % 256;
|
|
3281
|
+
[S[i], S[j]] = [S[j], S[i]];
|
|
3174
3282
|
}
|
|
3175
3283
|
const encryptedBuffer = Buffer.alloc(dataBuffer.length);
|
|
3176
3284
|
let i = 0;
|
|
@@ -3209,7 +3317,6 @@ var XBogus = class {
|
|
|
3209
3317
|
const array2 = this.md5StrToArray(this.md5(this.md5StrToArray("d41d8cd98f00b204e9800998ecf8427e")));
|
|
3210
3318
|
const urlEncryptedArray = this.md5Encrypt(urlPath);
|
|
3211
3319
|
const timestamp = Math.floor(Date.now() / 1e3);
|
|
3212
|
-
const ct = 536919696;
|
|
3213
3320
|
const newArray = [
|
|
3214
3321
|
64,
|
|
3215
3322
|
1,
|
|
@@ -3225,10 +3332,10 @@ var XBogus = class {
|
|
|
3225
3332
|
timestamp >> 16 & 255,
|
|
3226
3333
|
timestamp >> 8 & 255,
|
|
3227
3334
|
timestamp & 255,
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3335
|
+
32,
|
|
3336
|
+
0,
|
|
3337
|
+
190,
|
|
3338
|
+
144
|
|
3232
3339
|
];
|
|
3233
3340
|
let xorResult = newArray[0];
|
|
3234
3341
|
for (let i = 1; i < newArray.length; i++) xorResult ^= newArray[i];
|
|
@@ -3262,7 +3369,6 @@ var XBogus = class {
|
|
|
3262
3369
|
};
|
|
3263
3370
|
}
|
|
3264
3371
|
};
|
|
3265
|
-
|
|
3266
3372
|
//#endregion
|
|
3267
3373
|
//#region src/platform/douyin/sign/index.ts
|
|
3268
3374
|
const defaultUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36";
|
|
@@ -3311,7 +3417,6 @@ var douyinSign = class {
|
|
|
3311
3417
|
return "verify_" + n + "_" + r.join("");
|
|
3312
3418
|
}
|
|
3313
3419
|
};
|
|
3314
|
-
|
|
3315
3420
|
//#endregion
|
|
3316
3421
|
//#region src/platform/douyin/API.ts
|
|
3317
3422
|
/**
|
|
@@ -3385,10 +3490,10 @@ var DouyinAPI = class {
|
|
|
3385
3490
|
};
|
|
3386
3491
|
}
|
|
3387
3492
|
/** 获取视频或图集数据 */
|
|
3388
|
-
getWorkDetail(data
|
|
3493
|
+
getWorkDetail(data) {
|
|
3389
3494
|
return `https://www.douyin.com/aweme/v1/web/aweme/detail/?${buildQueryString({
|
|
3390
3495
|
...this.getBaseParams(),
|
|
3391
|
-
aweme_id: data
|
|
3496
|
+
aweme_id: data.aweme_id,
|
|
3392
3497
|
update_version_code: "170400",
|
|
3393
3498
|
version_code: "190500",
|
|
3394
3499
|
version_name: "19.5.0",
|
|
@@ -3399,12 +3504,12 @@ var DouyinAPI = class {
|
|
|
3399
3504
|
})}`;
|
|
3400
3505
|
}
|
|
3401
3506
|
/** 获取评论数据 */
|
|
3402
|
-
getComments(data
|
|
3507
|
+
getComments(data) {
|
|
3403
3508
|
return `https://www.douyin.com/aweme/v1/web/comment/list/?${buildQueryString({
|
|
3404
3509
|
...this.getBaseParams(),
|
|
3405
|
-
aweme_id: data
|
|
3406
|
-
cursor: data
|
|
3407
|
-
count: data
|
|
3510
|
+
aweme_id: data.aweme_id,
|
|
3511
|
+
cursor: data.cursor ?? 0,
|
|
3512
|
+
count: data.number ?? 50,
|
|
3408
3513
|
item_type: "0",
|
|
3409
3514
|
insert_ids: "",
|
|
3410
3515
|
whale_cut_token: "",
|
|
@@ -3418,16 +3523,16 @@ var DouyinAPI = class {
|
|
|
3418
3523
|
})}`;
|
|
3419
3524
|
}
|
|
3420
3525
|
/** 获取二级评论数据 */
|
|
3421
|
-
getCommentReplies(data
|
|
3526
|
+
getCommentReplies(data) {
|
|
3422
3527
|
return `https://www-hj.douyin.com/aweme/v1/web/comment/list/reply/?${buildQueryString({
|
|
3423
3528
|
device_platform: "webapp",
|
|
3424
3529
|
aid: "6383",
|
|
3425
3530
|
channel: "channel_pc_web",
|
|
3426
|
-
item_id: data
|
|
3427
|
-
comment_id: data
|
|
3531
|
+
item_id: data.aweme_id,
|
|
3532
|
+
comment_id: data.comment_id,
|
|
3428
3533
|
cut_version: "1",
|
|
3429
|
-
cursor: data
|
|
3430
|
-
count: data
|
|
3534
|
+
cursor: data.cursor,
|
|
3535
|
+
count: data.number,
|
|
3431
3536
|
item_type: "0",
|
|
3432
3537
|
update_version_code: "170400",
|
|
3433
3538
|
pc_client_type: "1",
|
|
@@ -3460,12 +3565,12 @@ var DouyinAPI = class {
|
|
|
3460
3565
|
})}`;
|
|
3461
3566
|
}
|
|
3462
3567
|
/** 获取动图数据 */
|
|
3463
|
-
getSlidesInfo(data
|
|
3568
|
+
getSlidesInfo(data) {
|
|
3464
3569
|
return `https://www.iesdouyin.com/web/api/v2/aweme/slidesinfo/?${buildQueryString({
|
|
3465
3570
|
reflow_source: "reflow_page",
|
|
3466
3571
|
web_id: "7326472315356857893",
|
|
3467
3572
|
device_id: "7326472315356857893",
|
|
3468
|
-
aweme_ids: `[${data
|
|
3573
|
+
aweme_ids: `[${data.aweme_id}]`,
|
|
3469
3574
|
request_source: "200",
|
|
3470
3575
|
msToken: douyinSign.Mstoken(116),
|
|
3471
3576
|
verifyFp: fp,
|
|
@@ -3477,18 +3582,18 @@ var DouyinAPI = class {
|
|
|
3477
3582
|
return "https://www.douyin.com/aweme/v1/web/emoji/list";
|
|
3478
3583
|
}
|
|
3479
3584
|
/** 获取用户主页视频数据 */
|
|
3480
|
-
getUserVideoList(data
|
|
3585
|
+
getUserVideoList(data) {
|
|
3481
3586
|
return `https://www.douyin.com/aweme/v1/web/aweme/post/?${buildQueryString({
|
|
3482
3587
|
...this.getBaseParams(),
|
|
3483
|
-
sec_user_id: data
|
|
3484
|
-
max_cursor: data
|
|
3588
|
+
sec_user_id: data.sec_uid,
|
|
3589
|
+
max_cursor: data.max_cursor ?? "0",
|
|
3485
3590
|
locate_query: "false",
|
|
3486
3591
|
show_live_replay_strategy: "1",
|
|
3487
3592
|
need_time_list: "1",
|
|
3488
3593
|
time_list_query: "0",
|
|
3489
3594
|
whale_cut_token: "",
|
|
3490
3595
|
cut_version: "1",
|
|
3491
|
-
count: data
|
|
3596
|
+
count: data.number ?? 18,
|
|
3492
3597
|
publish_video_strategy_type: "2",
|
|
3493
3598
|
version_code: "170400",
|
|
3494
3599
|
version_name: "17.4.0",
|
|
@@ -3499,15 +3604,15 @@ var DouyinAPI = class {
|
|
|
3499
3604
|
})}`;
|
|
3500
3605
|
}
|
|
3501
3606
|
/** 获取用户喜欢列表数据 */
|
|
3502
|
-
getUserFavoriteList(data
|
|
3607
|
+
getUserFavoriteList(data) {
|
|
3503
3608
|
return `https://www-hj.douyin.com/aweme/v1/web/aweme/favorite/?${buildQueryString({
|
|
3504
3609
|
...this.getBaseParams(),
|
|
3505
|
-
sec_user_id: data
|
|
3506
|
-
max_cursor: data
|
|
3610
|
+
sec_user_id: data.sec_uid,
|
|
3611
|
+
max_cursor: data.max_cursor ?? "0",
|
|
3507
3612
|
min_cursor: "0",
|
|
3508
3613
|
whale_cut_token: "",
|
|
3509
3614
|
cut_version: "1",
|
|
3510
|
-
count: data
|
|
3615
|
+
count: data.number ?? 18,
|
|
3511
3616
|
publish_video_strategy_type: "2",
|
|
3512
3617
|
update_version_code: "170400",
|
|
3513
3618
|
pc_libra_divert: "Windows",
|
|
@@ -3522,16 +3627,16 @@ var DouyinAPI = class {
|
|
|
3522
3627
|
})}`;
|
|
3523
3628
|
}
|
|
3524
3629
|
/** 获取用户推荐列表数据 */
|
|
3525
|
-
getUserRecommendList(data
|
|
3630
|
+
getUserRecommendList(data) {
|
|
3526
3631
|
return `https://www.douyin.com/aweme/v1/web/familiar/recommend/feed/?${buildQueryString({
|
|
3527
3632
|
device_platform: "",
|
|
3528
3633
|
aid: "6383",
|
|
3529
3634
|
channel: "channel_pc_web",
|
|
3530
|
-
sec_user_id: data
|
|
3531
|
-
max_cursor: data
|
|
3635
|
+
sec_user_id: data.sec_uid,
|
|
3636
|
+
max_cursor: data.max_cursor ?? "0",
|
|
3532
3637
|
min_cursor: "0",
|
|
3533
3638
|
whale_cut_token: "",
|
|
3534
|
-
count: data
|
|
3639
|
+
count: data.number ?? 18,
|
|
3535
3640
|
from: "1",
|
|
3536
3641
|
update_version_code: "170400",
|
|
3537
3642
|
pc_client_type: "1",
|
|
@@ -3565,12 +3670,12 @@ var DouyinAPI = class {
|
|
|
3565
3670
|
})}`;
|
|
3566
3671
|
}
|
|
3567
3672
|
/** 获取用户主页信息 */
|
|
3568
|
-
getUserProfile(data
|
|
3673
|
+
getUserProfile(data) {
|
|
3569
3674
|
return `https://www.douyin.com/aweme/v1/web/user/profile/other/?${buildQueryString({
|
|
3570
3675
|
...this.getBaseParams(),
|
|
3571
3676
|
publish_video_strategy_type: "2",
|
|
3572
3677
|
source: "channel_pc_web",
|
|
3573
|
-
sec_user_id: data
|
|
3678
|
+
sec_user_id: data.sec_uid,
|
|
3574
3679
|
personal_center_strategy: "1",
|
|
3575
3680
|
version_code: "170400",
|
|
3576
3681
|
version_name: "17.4.0",
|
|
@@ -3581,10 +3686,10 @@ var DouyinAPI = class {
|
|
|
3581
3686
|
})}`;
|
|
3582
3687
|
}
|
|
3583
3688
|
/** 获取热点词数据 */
|
|
3584
|
-
getSuggestWords(data
|
|
3689
|
+
getSuggestWords(data) {
|
|
3585
3690
|
return `https://www.douyin.com/aweme/v1/web/api/suggest_words/?${buildQueryString({
|
|
3586
3691
|
...this.getBaseParams(),
|
|
3587
|
-
query: data
|
|
3692
|
+
query: data.query,
|
|
3588
3693
|
business_id: "30088",
|
|
3589
3694
|
from_group_id: "7129543174929812767",
|
|
3590
3695
|
version_code: "170400",
|
|
@@ -3596,16 +3701,16 @@ var DouyinAPI = class {
|
|
|
3596
3701
|
})}`;
|
|
3597
3702
|
}
|
|
3598
3703
|
/** 获取搜索数据 */
|
|
3599
|
-
search(data
|
|
3600
|
-
const searchType = data
|
|
3601
|
-
const { verifyFp, fp
|
|
3704
|
+
search(data) {
|
|
3705
|
+
const searchType = data.type ?? "general";
|
|
3706
|
+
const { verifyFp, fp, ...baseParamsWithoutFp } = this.getBaseParams();
|
|
3602
3707
|
if (searchType === "user") return `https://www.douyin.com/aweme/v1/web/discover/search/?${buildQueryString({
|
|
3603
3708
|
...baseParamsWithoutFp,
|
|
3604
|
-
count: data
|
|
3709
|
+
count: data.number ?? 10,
|
|
3605
3710
|
disable_rs: "0",
|
|
3606
3711
|
from_group_id: "",
|
|
3607
3712
|
is_filter_search: "0",
|
|
3608
|
-
keyword: data
|
|
3713
|
+
keyword: data.query,
|
|
3609
3714
|
list_type: "single",
|
|
3610
3715
|
need_filter_settings: "1",
|
|
3611
3716
|
offset: "0",
|
|
@@ -3622,16 +3727,16 @@ var DouyinAPI = class {
|
|
|
3622
3727
|
version_code: "170400",
|
|
3623
3728
|
version_name: "17.4.0",
|
|
3624
3729
|
webid: "7521399115230610959",
|
|
3625
|
-
...data
|
|
3730
|
+
...data.search_id && { search_id: data.search_id }
|
|
3626
3731
|
})}`;
|
|
3627
3732
|
else if (searchType === "video") return `https://www.douyin.com/aweme/v1/web/search/item/?${buildQueryString({
|
|
3628
3733
|
...baseParamsWithoutFp,
|
|
3629
|
-
count: data
|
|
3734
|
+
count: data.number ?? 10,
|
|
3630
3735
|
disable_rs: "0",
|
|
3631
3736
|
enable_history: "1",
|
|
3632
3737
|
from_group_id: "",
|
|
3633
3738
|
is_filter_search: "0",
|
|
3634
|
-
keyword: data
|
|
3739
|
+
keyword: data.query,
|
|
3635
3740
|
list_type: "single",
|
|
3636
3741
|
need_filter_settings: "1",
|
|
3637
3742
|
offset: "0",
|
|
@@ -3648,15 +3753,15 @@ var DouyinAPI = class {
|
|
|
3648
3753
|
version_code: "170400",
|
|
3649
3754
|
version_name: "17.4.0",
|
|
3650
3755
|
webid: "7521399115230610959",
|
|
3651
|
-
...data
|
|
3756
|
+
...data.search_id && { search_id: data.search_id }
|
|
3652
3757
|
})}`;
|
|
3653
3758
|
else return `https://www.douyin.com/aweme/v1/web/general/search/stream/?${buildQueryString({
|
|
3654
3759
|
...baseParamsWithoutFp,
|
|
3655
|
-
count: data
|
|
3760
|
+
count: data.number ?? 10,
|
|
3656
3761
|
disable_rs: "0",
|
|
3657
3762
|
enable_history: "1",
|
|
3658
3763
|
is_filter_search: "0",
|
|
3659
|
-
keyword: data
|
|
3764
|
+
keyword: data.query,
|
|
3660
3765
|
list_type: "",
|
|
3661
3766
|
need_filter_settings: "1",
|
|
3662
3767
|
offset: "0",
|
|
@@ -3712,12 +3817,12 @@ var DouyinAPI = class {
|
|
|
3712
3817
|
})}`;
|
|
3713
3818
|
}
|
|
3714
3819
|
/** 获取背景音乐数据 */
|
|
3715
|
-
getMusicInfo(data
|
|
3820
|
+
getMusicInfo(data) {
|
|
3716
3821
|
return `https://www.douyin.com/aweme/v1/web/music/detail/?${buildQueryString({
|
|
3717
3822
|
device_platform: "webapp",
|
|
3718
3823
|
aid: "6383",
|
|
3719
3824
|
channel: "channel_pc_web",
|
|
3720
|
-
music_id: data
|
|
3825
|
+
music_id: data.music_id,
|
|
3721
3826
|
scene: "1",
|
|
3722
3827
|
pc_client_type: "1",
|
|
3723
3828
|
version_code: "170400",
|
|
@@ -3747,7 +3852,7 @@ var DouyinAPI = class {
|
|
|
3747
3852
|
})}`;
|
|
3748
3853
|
}
|
|
3749
3854
|
/** 获取直播间信息 */
|
|
3750
|
-
getLiveRoomInfo(data
|
|
3855
|
+
getLiveRoomInfo(data) {
|
|
3751
3856
|
return `https://live.douyin.com/webcast/room/web/enter/?${buildQueryString({
|
|
3752
3857
|
aid: "6383",
|
|
3753
3858
|
app_name: "douyin_web",
|
|
@@ -3762,8 +3867,8 @@ var DouyinAPI = class {
|
|
|
3762
3867
|
browser_platform: "Win32",
|
|
3763
3868
|
browser_name: "Chrome",
|
|
3764
3869
|
browser_version: "125.0.0.0",
|
|
3765
|
-
web_rid: data
|
|
3766
|
-
room_id_str: data
|
|
3870
|
+
web_rid: data.web_rid,
|
|
3871
|
+
room_id_str: data.room_id,
|
|
3767
3872
|
enter_source: "",
|
|
3768
3873
|
is_need_double_stream: "false",
|
|
3769
3874
|
insert_task_id: "",
|
|
@@ -3774,23 +3879,23 @@ var DouyinAPI = class {
|
|
|
3774
3879
|
})}`;
|
|
3775
3880
|
}
|
|
3776
3881
|
/** 申请登录二维码 */
|
|
3777
|
-
getLoginQrcode(data
|
|
3882
|
+
getLoginQrcode(data) {
|
|
3778
3883
|
return `https://sso.douyin.com/get_qrcode/?${buildQueryString({
|
|
3779
|
-
verifyFp: data
|
|
3780
|
-
fp: data
|
|
3884
|
+
verifyFp: data.verify_fp,
|
|
3885
|
+
fp: data.verify_fp
|
|
3781
3886
|
})}`;
|
|
3782
3887
|
}
|
|
3783
3888
|
/** 获取弹幕数据 */
|
|
3784
|
-
getDanmakuList(data
|
|
3889
|
+
getDanmakuList(data) {
|
|
3785
3890
|
return `https://www-hj.douyin.com/aweme/v1/web/danmaku/get_v2/?${buildQueryString({
|
|
3786
3891
|
...this.getBaseParams(),
|
|
3787
3892
|
app_name: "aweme",
|
|
3788
3893
|
format: "json",
|
|
3789
|
-
group_id: data
|
|
3790
|
-
item_id: data
|
|
3791
|
-
start_time: data
|
|
3792
|
-
end_time: data
|
|
3793
|
-
duration: data
|
|
3894
|
+
group_id: data.aweme_id,
|
|
3895
|
+
item_id: data.aweme_id,
|
|
3896
|
+
start_time: data.start_time ?? "0",
|
|
3897
|
+
end_time: data.end_time ?? "32000",
|
|
3898
|
+
duration: data.duration,
|
|
3794
3899
|
update_version_code: "170400",
|
|
3795
3900
|
pc_libra_divert: "Windows",
|
|
3796
3901
|
support_h265: "1",
|
|
@@ -3823,7 +3928,6 @@ const createDouyinApiUrls = (userAgent) => {
|
|
|
3823
3928
|
};
|
|
3824
3929
|
/** 默认的 DouyinAPI 实例(使用默认浏览器版本 125.0.0.0) */
|
|
3825
3930
|
const douyinApiUrls = new DouyinAPI();
|
|
3826
|
-
|
|
3827
3931
|
//#endregion
|
|
3828
3932
|
//#region src/platform/douyin/getdata.ts
|
|
3829
3933
|
/**
|
|
@@ -3847,7 +3951,6 @@ const douyinApiUrls = new DouyinAPI();
|
|
|
3847
3951
|
const getSignature = (url, signType = "a_bogus", userAgent) => {
|
|
3848
3952
|
switch (signType) {
|
|
3849
3953
|
case "x_bogus": return douyinSign.XB(url, userAgent);
|
|
3850
|
-
case "a_bogus":
|
|
3851
3954
|
default: return douyinSign.AB(url, userAgent);
|
|
3852
3955
|
}
|
|
3853
3956
|
};
|
|
@@ -3860,7 +3963,6 @@ const getSignature = (url, signType = "a_bogus", userAgent) => {
|
|
|
3860
3963
|
const getSignParamName = (signType = "a_bogus") => {
|
|
3861
3964
|
switch (signType) {
|
|
3862
3965
|
case "x_bogus": return "X-Bogus";
|
|
3863
|
-
case "a_bogus":
|
|
3864
3966
|
default: return "a_bogus";
|
|
3865
3967
|
}
|
|
3866
3968
|
};
|
|
@@ -3884,7 +3986,7 @@ const buildSignedUrl = (url, signType = "a_bogus", userAgent) => {
|
|
|
3884
3986
|
* @param requestConfig - 外部请求配置(优先级最高)
|
|
3885
3987
|
* @returns 返回抖音数据
|
|
3886
3988
|
*/
|
|
3887
|
-
const DouyinData = async (data
|
|
3989
|
+
const DouyinData = async (data, cookie, requestConfig) => {
|
|
3888
3990
|
const defHeaders = getDouyinDefaultConfig(cookie)["headers"];
|
|
3889
3991
|
const baseRequestConfig = {
|
|
3890
3992
|
method: "GET",
|
|
@@ -3896,28 +3998,28 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
3896
3998
|
}
|
|
3897
3999
|
};
|
|
3898
4000
|
const userAgent = baseRequestConfig.headers?.["User-Agent"];
|
|
3899
|
-
const douyinApiUrls
|
|
3900
|
-
const signType = data
|
|
3901
|
-
switch (data
|
|
4001
|
+
const douyinApiUrls = createDouyinApiUrls(userAgent);
|
|
4002
|
+
const signType = data.signType ?? "a_bogus";
|
|
4003
|
+
switch (data.methodType) {
|
|
3902
4004
|
case "textWork":
|
|
3903
4005
|
case "parseWork":
|
|
3904
4006
|
case "videoWork":
|
|
3905
4007
|
case "imageAlbumWork":
|
|
3906
4008
|
case "slidesWork": {
|
|
3907
|
-
const url = douyinApiUrls
|
|
3908
|
-
return await GlobalGetData$3(data
|
|
4009
|
+
const url = douyinApiUrls.getWorkDetail({ aweme_id: data.aweme_id });
|
|
4010
|
+
return await GlobalGetData$3(data.methodType, {
|
|
3909
4011
|
...baseRequestConfig,
|
|
3910
4012
|
url: buildSignedUrl(url, signType, userAgent)
|
|
3911
4013
|
});
|
|
3912
4014
|
}
|
|
3913
4015
|
case "comments": {
|
|
3914
|
-
const urlGenerator = (params) => douyinApiUrls
|
|
4016
|
+
const urlGenerator = (params) => douyinApiUrls.getComments(params);
|
|
3915
4017
|
return await fetchPaginatedData({
|
|
3916
|
-
type: data
|
|
4018
|
+
type: data.methodType,
|
|
3917
4019
|
apiUrlGenerator: urlGenerator,
|
|
3918
4020
|
params: {
|
|
3919
|
-
...data
|
|
3920
|
-
cursor: data
|
|
4021
|
+
...data,
|
|
4022
|
+
cursor: data.cursor ?? 0
|
|
3921
4023
|
},
|
|
3922
4024
|
maxPageSize: 50,
|
|
3923
4025
|
requestConfig: baseRequestConfig,
|
|
@@ -3936,13 +4038,13 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
3936
4038
|
});
|
|
3937
4039
|
}
|
|
3938
4040
|
case "commentReplies": {
|
|
3939
|
-
const urlGenerator = (params) => douyinApiUrls
|
|
4041
|
+
const urlGenerator = (params) => douyinApiUrls.getCommentReplies(params);
|
|
3940
4042
|
return await fetchPaginatedData({
|
|
3941
|
-
type: data
|
|
4043
|
+
type: data.methodType,
|
|
3942
4044
|
apiUrlGenerator: urlGenerator,
|
|
3943
4045
|
params: {
|
|
3944
|
-
...data
|
|
3945
|
-
cursor: data
|
|
4046
|
+
...data,
|
|
4047
|
+
cursor: data.cursor ?? 0
|
|
3946
4048
|
},
|
|
3947
4049
|
maxPageSize: 3,
|
|
3948
4050
|
requestConfig: baseRequestConfig,
|
|
@@ -3961,41 +4063,41 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
3961
4063
|
});
|
|
3962
4064
|
}
|
|
3963
4065
|
case "userProfile": {
|
|
3964
|
-
const url = douyinApiUrls
|
|
4066
|
+
const url = douyinApiUrls.getUserProfile({ sec_uid: data.sec_uid });
|
|
3965
4067
|
const customConfig = {
|
|
3966
4068
|
...baseRequestConfig,
|
|
3967
4069
|
headers: {
|
|
3968
4070
|
...baseRequestConfig.headers,
|
|
3969
|
-
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data
|
|
4071
|
+
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data.sec_uid}` }
|
|
3970
4072
|
}
|
|
3971
4073
|
};
|
|
3972
|
-
return await GlobalGetData$3(data
|
|
4074
|
+
return await GlobalGetData$3(data.methodType, {
|
|
3973
4075
|
...customConfig,
|
|
3974
4076
|
url: buildSignedUrl(url, signType, userAgent)
|
|
3975
4077
|
});
|
|
3976
4078
|
}
|
|
3977
4079
|
case "emojiList": {
|
|
3978
|
-
const url = douyinApiUrls
|
|
3979
|
-
return await GlobalGetData$3(data
|
|
4080
|
+
const url = douyinApiUrls.getEmojiList();
|
|
4081
|
+
return await GlobalGetData$3(data.methodType, {
|
|
3980
4082
|
...baseRequestConfig,
|
|
3981
4083
|
url
|
|
3982
4084
|
});
|
|
3983
4085
|
}
|
|
3984
4086
|
case "userVideoList": {
|
|
3985
|
-
const urlGenerator = (params) => douyinApiUrls
|
|
4087
|
+
const urlGenerator = (params) => douyinApiUrls.getUserVideoList(params);
|
|
3986
4088
|
return await fetchPaginatedData({
|
|
3987
|
-
type: data
|
|
4089
|
+
type: data.methodType,
|
|
3988
4090
|
apiUrlGenerator: urlGenerator,
|
|
3989
4091
|
params: {
|
|
3990
|
-
...data
|
|
3991
|
-
max_cursor: data
|
|
4092
|
+
...data,
|
|
4093
|
+
max_cursor: data.max_cursor
|
|
3992
4094
|
},
|
|
3993
4095
|
maxPageSize: 18,
|
|
3994
4096
|
requestConfig: {
|
|
3995
4097
|
...baseRequestConfig,
|
|
3996
4098
|
headers: {
|
|
3997
4099
|
...baseRequestConfig.headers,
|
|
3998
|
-
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data
|
|
4100
|
+
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data.sec_uid}` }
|
|
3999
4101
|
}
|
|
4000
4102
|
},
|
|
4001
4103
|
signType,
|
|
@@ -4012,20 +4114,20 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4012
4114
|
});
|
|
4013
4115
|
}
|
|
4014
4116
|
case "userFavoriteList": {
|
|
4015
|
-
const urlGenerator = (params) => douyinApiUrls
|
|
4117
|
+
const urlGenerator = (params) => douyinApiUrls.getUserFavoriteList(params);
|
|
4016
4118
|
return await fetchPaginatedData({
|
|
4017
|
-
type: data
|
|
4119
|
+
type: data.methodType,
|
|
4018
4120
|
apiUrlGenerator: urlGenerator,
|
|
4019
4121
|
params: {
|
|
4020
|
-
...data
|
|
4021
|
-
max_cursor: data
|
|
4122
|
+
...data,
|
|
4123
|
+
max_cursor: data.max_cursor
|
|
4022
4124
|
},
|
|
4023
4125
|
maxPageSize: 18,
|
|
4024
4126
|
requestConfig: {
|
|
4025
4127
|
...baseRequestConfig,
|
|
4026
4128
|
headers: {
|
|
4027
4129
|
...baseRequestConfig.headers,
|
|
4028
|
-
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data
|
|
4130
|
+
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data.sec_uid}` }
|
|
4029
4131
|
}
|
|
4030
4132
|
},
|
|
4031
4133
|
signType,
|
|
@@ -4042,20 +4144,20 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4042
4144
|
});
|
|
4043
4145
|
}
|
|
4044
4146
|
case "userRecommendList": {
|
|
4045
|
-
const urlGenerator = (params) => douyinApiUrls
|
|
4147
|
+
const urlGenerator = (params) => douyinApiUrls.getUserRecommendList(params);
|
|
4046
4148
|
return await fetchPaginatedData({
|
|
4047
|
-
type: data
|
|
4149
|
+
type: data.methodType,
|
|
4048
4150
|
apiUrlGenerator: urlGenerator,
|
|
4049
4151
|
params: {
|
|
4050
|
-
...data
|
|
4051
|
-
max_cursor: data
|
|
4152
|
+
...data,
|
|
4153
|
+
max_cursor: data.max_cursor
|
|
4052
4154
|
},
|
|
4053
4155
|
maxPageSize: 18,
|
|
4054
4156
|
requestConfig: {
|
|
4055
4157
|
...baseRequestConfig,
|
|
4056
4158
|
headers: {
|
|
4057
4159
|
...baseRequestConfig.headers,
|
|
4058
|
-
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data
|
|
4160
|
+
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data.sec_uid}` }
|
|
4059
4161
|
}
|
|
4060
4162
|
},
|
|
4061
4163
|
signType,
|
|
@@ -4072,22 +4174,22 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4072
4174
|
});
|
|
4073
4175
|
}
|
|
4074
4176
|
case "suggestWords": {
|
|
4075
|
-
const url = douyinApiUrls
|
|
4177
|
+
const url = douyinApiUrls.getSuggestWords({ query: data.query });
|
|
4076
4178
|
const customConfig = {
|
|
4077
4179
|
...baseRequestConfig,
|
|
4078
4180
|
headers: {
|
|
4079
4181
|
...baseRequestConfig.headers,
|
|
4080
|
-
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/search/${encodeURIComponent(String(data
|
|
4182
|
+
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/search/${encodeURIComponent(String(data.query))}` }
|
|
4081
4183
|
}
|
|
4082
4184
|
};
|
|
4083
|
-
return await GlobalGetData$3(data
|
|
4185
|
+
return await GlobalGetData$3(data.methodType, {
|
|
4084
4186
|
...customConfig,
|
|
4085
4187
|
url: buildSignedUrl(url, signType, userAgent)
|
|
4086
4188
|
});
|
|
4087
4189
|
}
|
|
4088
4190
|
case "search": {
|
|
4089
|
-
const searchType = data
|
|
4090
|
-
const refererUrl = searchType === "user" ? `https://www.douyin.com/search/${encodeURIComponent(String(data
|
|
4191
|
+
const searchType = data.type ?? "general";
|
|
4192
|
+
const refererUrl = searchType === "user" ? `https://www.douyin.com/search/${encodeURIComponent(String(data.query))}?type=user` : searchType === "video" ? `https://www.douyin.com/search/${encodeURIComponent(String(data.query))}?type=video` : `https://www.douyin.com/root/search/${encodeURIComponent(String(data.query))}`;
|
|
4091
4193
|
const customConfig = {
|
|
4092
4194
|
...baseRequestConfig,
|
|
4093
4195
|
headers: {
|
|
@@ -4098,12 +4200,12 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4098
4200
|
const isUserSearch = searchType === "user";
|
|
4099
4201
|
const isVideoSearch = searchType === "video";
|
|
4100
4202
|
return await fetchPaginatedData({
|
|
4101
|
-
type: data
|
|
4102
|
-
apiUrlGenerator: (params) => douyinApiUrls
|
|
4203
|
+
type: data.methodType,
|
|
4204
|
+
apiUrlGenerator: (params) => douyinApiUrls.search(params),
|
|
4103
4205
|
params: {
|
|
4104
|
-
query: data
|
|
4105
|
-
type: data
|
|
4106
|
-
number: data
|
|
4206
|
+
query: data.query,
|
|
4207
|
+
type: data.type,
|
|
4208
|
+
number: data.number ?? 10,
|
|
4107
4209
|
search_id: ""
|
|
4108
4210
|
},
|
|
4109
4211
|
maxPageSize: 15,
|
|
@@ -4153,17 +4255,17 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4153
4255
|
if (isInvalidResponse) {
|
|
4154
4256
|
const desc = `抖音${typeStr}搜索返回无有效数据,疑似触发反爬机制,你的抖音Cookie可能已经失效!`;
|
|
4155
4257
|
const warningMessage = `
|
|
4156
|
-
获取响应数据失败!原因:${
|
|
4157
|
-
请求类型:「${data
|
|
4158
|
-
搜索关键词:「${data
|
|
4258
|
+
获取响应数据失败!原因:${typeStr}搜索返回无有效数据,疑似触发反爬机制
|
|
4259
|
+
请求类型:「${data.methodType}」
|
|
4260
|
+
搜索关键词:「${data.query}」
|
|
4159
4261
|
请求URL:${url}
|
|
4160
4262
|
`;
|
|
4161
4263
|
return {
|
|
4162
|
-
code:
|
|
4264
|
+
code: "INVALID_COOKIE",
|
|
4163
4265
|
data: raw,
|
|
4164
4266
|
amagiError: {
|
|
4165
4267
|
errorDescription: desc,
|
|
4166
|
-
requestType: data
|
|
4268
|
+
requestType: data.methodType ?? "未知请求类型",
|
|
4167
4269
|
requestUrl: url
|
|
4168
4270
|
},
|
|
4169
4271
|
amagiMessage: warningMessage
|
|
@@ -4172,17 +4274,17 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4172
4274
|
if (!list || list.length === 0) {
|
|
4173
4275
|
const desc = `抖音${typeStr}搜索接口第一次请求就返回空数组,可能该关键词无搜索结果或触发风控限制,你的抖音Cookie可能已经失效!`;
|
|
4174
4276
|
const warningMessage = `
|
|
4175
|
-
获取响应数据失败!原因:${
|
|
4176
|
-
请求类型:「${data
|
|
4177
|
-
搜索关键词:「${data
|
|
4277
|
+
获取响应数据失败!原因:${typeStr}搜索接口第一次请求就返回空数组,你的抖音Cookie可能已经失效!
|
|
4278
|
+
请求类型:「${data.methodType}」
|
|
4279
|
+
搜索关键词:「${data.query}」
|
|
4178
4280
|
请求URL:${url}
|
|
4179
4281
|
`;
|
|
4180
|
-
|
|
4282
|
+
emitLogWarn(warningMessage);
|
|
4181
4283
|
return {
|
|
4182
4284
|
data: raw,
|
|
4183
4285
|
amagiError: {
|
|
4184
4286
|
errorDescription: desc,
|
|
4185
|
-
requestType: data
|
|
4287
|
+
requestType: data.methodType ?? "未知请求类型",
|
|
4186
4288
|
requestUrl: url
|
|
4187
4289
|
},
|
|
4188
4290
|
amagiMessage: warningMessage
|
|
@@ -4203,57 +4305,57 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4203
4305
|
});
|
|
4204
4306
|
}
|
|
4205
4307
|
case "dynamicEmojiList": {
|
|
4206
|
-
const url = douyinApiUrls
|
|
4207
|
-
return await GlobalGetData$3(data
|
|
4308
|
+
const url = douyinApiUrls.getDynamicEmojiList();
|
|
4309
|
+
return await GlobalGetData$3(data.methodType, {
|
|
4208
4310
|
...baseRequestConfig,
|
|
4209
4311
|
url: buildSignedUrl(url, signType, userAgent)
|
|
4210
4312
|
});
|
|
4211
4313
|
}
|
|
4212
4314
|
case "musicInfo": {
|
|
4213
|
-
const url = douyinApiUrls
|
|
4214
|
-
return await GlobalGetData$3(data
|
|
4315
|
+
const url = douyinApiUrls.getMusicInfo({ music_id: data.music_id });
|
|
4316
|
+
return await GlobalGetData$3(data.methodType, {
|
|
4215
4317
|
...baseRequestConfig,
|
|
4216
4318
|
url: buildSignedUrl(url, signType, userAgent)
|
|
4217
4319
|
});
|
|
4218
4320
|
}
|
|
4219
4321
|
case "liveRoomInfo": {
|
|
4220
|
-
let url = douyinApiUrls
|
|
4221
|
-
room_id: data
|
|
4222
|
-
web_rid: data
|
|
4322
|
+
let url = douyinApiUrls.getLiveRoomInfo({
|
|
4323
|
+
room_id: data.room_id,
|
|
4324
|
+
web_rid: data.web_rid
|
|
4223
4325
|
});
|
|
4224
4326
|
const liveCustomConfig = {
|
|
4225
4327
|
...baseRequestConfig,
|
|
4226
4328
|
url: buildSignedUrl(url, signType, userAgent),
|
|
4227
4329
|
headers: {
|
|
4228
4330
|
...baseRequestConfig.headers,
|
|
4229
|
-
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://live.douyin.com/${data
|
|
4331
|
+
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://live.douyin.com/${data.web_rid}` }
|
|
4230
4332
|
}
|
|
4231
4333
|
};
|
|
4232
|
-
return await GlobalGetData$3(data
|
|
4334
|
+
return await GlobalGetData$3(data.methodType, {
|
|
4233
4335
|
...liveCustomConfig,
|
|
4234
4336
|
url: buildSignedUrl(url, signType, userAgent)
|
|
4235
4337
|
});
|
|
4236
4338
|
}
|
|
4237
4339
|
case "loginQrcode": {
|
|
4238
|
-
const url = douyinApiUrls
|
|
4239
|
-
return await GlobalGetData$3(data
|
|
4340
|
+
const url = douyinApiUrls.getLoginQrcode({ verify_fp: data.verify_fp });
|
|
4341
|
+
return await GlobalGetData$3(data.methodType, {
|
|
4240
4342
|
...baseRequestConfig,
|
|
4241
4343
|
url: buildSignedUrl(url, signType, userAgent)
|
|
4242
4344
|
});
|
|
4243
4345
|
}
|
|
4244
4346
|
case "danmakuList": {
|
|
4245
4347
|
const MAX_SEGMENT_DURATION = 32e3;
|
|
4246
|
-
const startTime = data
|
|
4247
|
-
const endTime = data
|
|
4348
|
+
const startTime = data.start_time ?? 0;
|
|
4349
|
+
const endTime = data.end_time ?? data.duration;
|
|
4248
4350
|
const totalDuration = endTime - startTime;
|
|
4249
4351
|
if (totalDuration <= MAX_SEGMENT_DURATION) {
|
|
4250
|
-
const url = douyinApiUrls
|
|
4251
|
-
aweme_id: data
|
|
4352
|
+
const url = douyinApiUrls.getDanmakuList({
|
|
4353
|
+
aweme_id: data.aweme_id,
|
|
4252
4354
|
start_time: startTime,
|
|
4253
4355
|
end_time: endTime,
|
|
4254
|
-
duration: data
|
|
4356
|
+
duration: data.duration
|
|
4255
4357
|
});
|
|
4256
|
-
return await GlobalGetData$3(data
|
|
4358
|
+
return await GlobalGetData$3(data.methodType, {
|
|
4257
4359
|
...baseRequestConfig,
|
|
4258
4360
|
url: buildSignedUrl(url, signType, userAgent)
|
|
4259
4361
|
});
|
|
@@ -4268,23 +4370,23 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4268
4370
|
});
|
|
4269
4371
|
currentStart = currentEnd;
|
|
4270
4372
|
}
|
|
4271
|
-
|
|
4373
|
+
emitLogDebug(`弹幕数据需要分${segments.length}段获取,总时长:${totalDuration}ms`);
|
|
4272
4374
|
const segmentPromises = segments.map(async (segment, index) => {
|
|
4273
|
-
const url = douyinApiUrls
|
|
4274
|
-
aweme_id: data
|
|
4375
|
+
const url = douyinApiUrls.getDanmakuList({
|
|
4376
|
+
aweme_id: data.aweme_id,
|
|
4275
4377
|
start_time: segment.start,
|
|
4276
4378
|
end_time: segment.end,
|
|
4277
|
-
duration: data
|
|
4379
|
+
duration: data.duration
|
|
4278
4380
|
});
|
|
4279
4381
|
try {
|
|
4280
|
-
const segmentData = await GlobalGetData$3(`${data
|
|
4382
|
+
const segmentData = await GlobalGetData$3(`${data.methodType}-segment${index + 1}`, {
|
|
4281
4383
|
...baseRequestConfig,
|
|
4282
4384
|
url: buildSignedUrl(url, signType, userAgent)
|
|
4283
4385
|
});
|
|
4284
|
-
|
|
4386
|
+
emitLogDebug(`弹幕第${index + 1}段获取成功 (${segment.start}ms-${segment.end}ms)`);
|
|
4285
4387
|
return segmentData;
|
|
4286
4388
|
} catch (error) {
|
|
4287
|
-
|
|
4389
|
+
emitLogDebug(`弹幕第${index + 1}段获取失败 (${segment.start}ms-${segment.end}ms):`, error);
|
|
4288
4390
|
return null;
|
|
4289
4391
|
}
|
|
4290
4392
|
});
|
|
@@ -4313,19 +4415,19 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4313
4415
|
extra: finalExtra,
|
|
4314
4416
|
log_pb: finalLogPb
|
|
4315
4417
|
};
|
|
4316
|
-
|
|
4418
|
+
emitLogDebug(`弹幕数据合并完成,共获取${mergedDanmakuList.length}条弹幕`);
|
|
4317
4419
|
return finalDanmakuData;
|
|
4318
4420
|
}
|
|
4319
4421
|
default: {
|
|
4320
|
-
const customUrl = data
|
|
4422
|
+
const customUrl = data.custom_url;
|
|
4321
4423
|
if (typeof customUrl === "string" && customUrl.length > 0) {
|
|
4322
4424
|
const url = buildSignedUrl(customUrl, signType, userAgent);
|
|
4323
|
-
return await GlobalGetData$3(data
|
|
4425
|
+
return await GlobalGetData$3(data.methodType ?? "customRequest", {
|
|
4324
4426
|
...baseRequestConfig,
|
|
4325
4427
|
url
|
|
4326
4428
|
});
|
|
4327
4429
|
}
|
|
4328
|
-
|
|
4430
|
+
emitLogWarn(`未知的抖音数据接口:「${data.methodType}」`);
|
|
4329
4431
|
return null;
|
|
4330
4432
|
}
|
|
4331
4433
|
}
|
|
@@ -4393,14 +4495,14 @@ const GlobalGetData$3 = async (type, config) => {
|
|
|
4393
4495
|
requestUrl: config.url
|
|
4394
4496
|
};
|
|
4395
4497
|
warningMessage = `
|
|
4396
|
-
|
|
4498
|
+
获取响应数据失败!原因:接口返回内容为空,你的抖音ck可能已经失效!
|
|
4397
4499
|
请求类型:「${type}」
|
|
4398
4500
|
请求URL:${config.url}
|
|
4399
4501
|
`;
|
|
4400
|
-
|
|
4502
|
+
emitLogWarn(warningMessage);
|
|
4401
4503
|
const cookieError = new Error(Err.errorDescription);
|
|
4402
4504
|
Object.assign(cookieError, {
|
|
4403
|
-
code:
|
|
4505
|
+
code: "INVALID_COOKIE",
|
|
4404
4506
|
data: result,
|
|
4405
4507
|
amagiError: Err
|
|
4406
4508
|
});
|
|
@@ -4414,14 +4516,14 @@ const GlobalGetData$3 = async (type, config) => {
|
|
|
4414
4516
|
requestUrl: config.url
|
|
4415
4517
|
};
|
|
4416
4518
|
warningMessage = `
|
|
4417
|
-
获取响应数据失败!原因:${
|
|
4519
|
+
获取响应数据失败!原因:${filterReason}
|
|
4418
4520
|
请求类型:「${type}」
|
|
4419
4521
|
请求URL:${config.url}
|
|
4420
4522
|
`;
|
|
4421
|
-
|
|
4523
|
+
emitLogWarn(warningMessage);
|
|
4422
4524
|
const filterError = new Error(Err.errorDescription);
|
|
4423
4525
|
Object.assign(filterError, {
|
|
4424
|
-
code:
|
|
4526
|
+
code: "CONTENT_FILTERED",
|
|
4425
4527
|
data: result,
|
|
4426
4528
|
amagiError: Err
|
|
4427
4529
|
});
|
|
@@ -4434,7 +4536,7 @@ const GlobalGetData$3 = async (type, config) => {
|
|
|
4434
4536
|
amagiMessage: warningMessage
|
|
4435
4537
|
};
|
|
4436
4538
|
return {
|
|
4437
|
-
code:
|
|
4539
|
+
code: "UNKNOWN_ERROR",
|
|
4438
4540
|
data: null,
|
|
4439
4541
|
amagiError: {
|
|
4440
4542
|
errorDescription: "未知错误",
|
|
@@ -4473,7 +4575,6 @@ const parseDouyinMultiJson = (raw) => {
|
|
|
4473
4575
|
const filterSearchResponses = (objs) => {
|
|
4474
4576
|
return objs.filter((o) => o && typeof o.cursor === "number" && typeof o.has_more === "number" && Array.isArray(o.data));
|
|
4475
4577
|
};
|
|
4476
|
-
|
|
4477
4578
|
//#endregion
|
|
4478
4579
|
//#region src/model/fetchers/douyin/internal.ts
|
|
4479
4580
|
/**
|
|
@@ -4525,7 +4626,6 @@ async function fetchDouyinInternal(methodType, options, config) {
|
|
|
4525
4626
|
throw new Error(`抖音数据获取失败: ${errorMessage}`);
|
|
4526
4627
|
}
|
|
4527
4628
|
}
|
|
4528
|
-
|
|
4529
4629
|
//#endregion
|
|
4530
4630
|
//#region src/model/fetchers/douyin/comment.ts
|
|
4531
4631
|
/**
|
|
@@ -4573,7 +4673,6 @@ async function fetchCommentReplies(options, cookie, requestConfig) {
|
|
|
4573
4673
|
requestConfig
|
|
4574
4674
|
});
|
|
4575
4675
|
}
|
|
4576
|
-
|
|
4577
4676
|
//#endregion
|
|
4578
4677
|
//#region src/model/fetchers/douyin/misc.ts
|
|
4579
4678
|
/**
|
|
@@ -4670,7 +4769,6 @@ async function fetchDynamicEmojiList(options, cookie, requestConfig) {
|
|
|
4670
4769
|
requestConfig
|
|
4671
4770
|
});
|
|
4672
4771
|
}
|
|
4673
|
-
|
|
4674
4772
|
//#endregion
|
|
4675
4773
|
//#region src/model/fetchers/douyin/search.ts
|
|
4676
4774
|
/**
|
|
@@ -4719,7 +4817,6 @@ async function fetchSuggestWords(options, cookie, requestConfig) {
|
|
|
4719
4817
|
requestConfig
|
|
4720
4818
|
});
|
|
4721
4819
|
}
|
|
4722
|
-
|
|
4723
4820
|
//#endregion
|
|
4724
4821
|
//#region src/model/fetchers/douyin/user.ts
|
|
4725
4822
|
/**
|
|
@@ -4804,7 +4901,6 @@ async function fetchUserRecommendList(options, cookie, requestConfig) {
|
|
|
4804
4901
|
requestConfig
|
|
4805
4902
|
});
|
|
4806
4903
|
}
|
|
4807
|
-
|
|
4808
4904
|
//#endregion
|
|
4809
4905
|
//#region src/model/fetchers/douyin/video.ts
|
|
4810
4906
|
/**
|
|
@@ -4921,7 +5017,6 @@ async function fetchDanmakuList(options, cookie, requestConfig) {
|
|
|
4921
5017
|
requestConfig
|
|
4922
5018
|
});
|
|
4923
5019
|
}
|
|
4924
|
-
|
|
4925
5020
|
//#endregion
|
|
4926
5021
|
//#region src/model/fetchers/douyin/bound.ts
|
|
4927
5022
|
/**
|
|
@@ -4960,7 +5055,6 @@ function createBoundDouyinFetcher(cookie, requestConfig) {
|
|
|
4960
5055
|
fetchDynamicEmojiList: (options, reqConfig) => fetchDynamicEmojiList(options, cookie, reqConfig ?? requestConfig)
|
|
4961
5056
|
};
|
|
4962
5057
|
}
|
|
4963
|
-
|
|
4964
5058
|
//#endregion
|
|
4965
5059
|
//#region src/model/fetchers/douyin/index.ts
|
|
4966
5060
|
/**
|
|
@@ -4998,7 +5092,6 @@ const douyinFetcher = {
|
|
|
4998
5092
|
fetchEmojiList: fetchEmojiList$2,
|
|
4999
5093
|
fetchDynamicEmojiList
|
|
5000
5094
|
};
|
|
5001
|
-
|
|
5002
5095
|
//#endregion
|
|
5003
5096
|
//#region src/platform/kuaishou/API.ts
|
|
5004
5097
|
/**
|
|
@@ -5036,14 +5129,19 @@ var API = class {
|
|
|
5036
5129
|
* @param data - 作品参数
|
|
5037
5130
|
* @returns 请求配置
|
|
5038
5131
|
*/
|
|
5039
|
-
videoWork(data
|
|
5132
|
+
videoWork(data) {
|
|
5040
5133
|
return {
|
|
5134
|
+
/** 接口类型 */
|
|
5041
5135
|
type: "visionVideoDetail",
|
|
5136
|
+
/** 请求url */
|
|
5042
5137
|
url: "https://www.kuaishou.com/graphql",
|
|
5138
|
+
/** 请求参数 */
|
|
5043
5139
|
body: {
|
|
5140
|
+
/** 接口类型 */
|
|
5044
5141
|
operationName: "visionVideoDetail",
|
|
5045
5142
|
variables: {
|
|
5046
|
-
|
|
5143
|
+
/** 作品ID */
|
|
5144
|
+
photoId: data.photoId,
|
|
5047
5145
|
page: "detail"
|
|
5048
5146
|
},
|
|
5049
5147
|
query: "query visionVideoDetail($photoId: String, $type: String, $page: String, $webPageArea: String) {\n visionVideoDetail(photoId: $photoId, type: $type, page: $page, webPageArea: $webPageArea) {\n status\n type\n author {\n id\n name\n following\n headerUrl\n __typename\n }\n photo {\n id\n duration\n caption\n likeCount\n realLikeCount\n coverUrl\n photoUrl\n liked\n timestamp\n expTag\n llsid\n viewCount\n videoRatio\n stereoType\n musicBlocked\n manifest {\n mediaType\n businessType\n version\n adaptationSet {\n id\n duration\n representation {\n id\n defaultSelect\n backupUrl\n codecs\n url\n height\n width\n avgBitrate\n maxBitrate\n m3u8Slice\n qualityType\n qualityLabel\n frameRate\n featureP2sp\n hidden\n disableAdaptive\n __typename\n }\n __typename\n }\n __typename\n }\n manifestH265\n photoH265Url\n coronaCropManifest\n coronaCropManifestH265\n croppedPhotoH265Url\n croppedPhotoUrl\n videoResource\n __typename\n }\n tags {\n type\n name\n __typename\n }\n commentLimit {\n canAddComment\n __typename\n }\n llsid\n danmakuSwitch\n __typename\n }\n}\n"
|
|
@@ -5055,14 +5153,14 @@ var API = class {
|
|
|
5055
5153
|
* @param data - 评论参数
|
|
5056
5154
|
* @returns 请求配置
|
|
5057
5155
|
*/
|
|
5058
|
-
comments(data
|
|
5156
|
+
comments(data) {
|
|
5059
5157
|
return {
|
|
5060
5158
|
type: "commentListQuery",
|
|
5061
5159
|
url: "https://www.kuaishou.com/graphql",
|
|
5062
5160
|
body: {
|
|
5063
5161
|
operationName: "commentListQuery",
|
|
5064
5162
|
variables: {
|
|
5065
|
-
photoId: data
|
|
5163
|
+
photoId: data.photoId,
|
|
5066
5164
|
pcursor: ""
|
|
5067
5165
|
},
|
|
5068
5166
|
query: "query commentListQuery($photoId: String, $pcursor: String) {\n visionCommentList(photoId: $photoId, pcursor: $pcursor) {\n commentCount\n pcursor\n rootComments {\n commentId\n authorId\n authorName\n content\n headurl\n timestamp\n likedCount\n realLikedCount\n liked\n status\n authorLiked\n subCommentCount\n subCommentsPcursor\n subComments {\n commentId\n authorId\n authorName\n content\n headurl\n timestamp\n likedCount\n realLikedCount\n liked\n status\n authorLiked\n replyToUserName\n replyTo\n __typename\n }\n __typename\n }\n __typename\n }\n}\n"
|
|
@@ -5078,10 +5176,10 @@ var API = class {
|
|
|
5078
5176
|
* @param data - 用户主页参数
|
|
5079
5177
|
* @returns 请求配置
|
|
5080
5178
|
*/
|
|
5081
|
-
userInfoById(data
|
|
5179
|
+
userInfoById(data) {
|
|
5082
5180
|
return createKuaishouLiveApiRequest("userInfoById", "/live_api/baseuser/userinfo/byid", {
|
|
5083
5181
|
caver: 2,
|
|
5084
|
-
principalId: data
|
|
5182
|
+
principalId: data.principalId
|
|
5085
5183
|
}, { signPath: "/rest/k/user/info" });
|
|
5086
5184
|
}
|
|
5087
5185
|
/**
|
|
@@ -5089,10 +5187,10 @@ var API = class {
|
|
|
5089
5187
|
* @param data - 用户主页参数
|
|
5090
5188
|
* @returns 请求配置
|
|
5091
5189
|
*/
|
|
5092
|
-
userSensitiveInfo(data
|
|
5190
|
+
userSensitiveInfo(data) {
|
|
5093
5191
|
return createKuaishouLiveApiRequest("userSensitiveInfo", "/live_api/baseuser/userinfo/sensitive", {
|
|
5094
5192
|
caver: 2,
|
|
5095
|
-
principalId: data
|
|
5193
|
+
principalId: data.principalId
|
|
5096
5194
|
}, { signPath: "/rest/k/user/info/sensitive" });
|
|
5097
5195
|
}
|
|
5098
5196
|
/**
|
|
@@ -5100,13 +5198,13 @@ var API = class {
|
|
|
5100
5198
|
* @param data - 用户主页参数
|
|
5101
5199
|
* @returns 请求配置
|
|
5102
5200
|
*/
|
|
5103
|
-
profilePublic(data
|
|
5201
|
+
profilePublic(data) {
|
|
5104
5202
|
return createKuaishouLiveApiRequest("profilePublic", "/live_api/profile/public", {
|
|
5105
5203
|
caver: 2,
|
|
5106
|
-
count: "count" in data
|
|
5204
|
+
count: "count" in data ? data.count ?? 12 : 12,
|
|
5107
5205
|
hasMore: true,
|
|
5108
|
-
pcursor: "pcursor" in data
|
|
5109
|
-
principalId: data
|
|
5206
|
+
pcursor: "pcursor" in data ? data.pcursor ?? "" : "",
|
|
5207
|
+
principalId: data.principalId,
|
|
5110
5208
|
privacy: "public"
|
|
5111
5209
|
}, { signPath: "/rest/k/feed/profile" });
|
|
5112
5210
|
}
|
|
@@ -5119,9 +5217,9 @@ var API = class {
|
|
|
5119
5217
|
* @param data - 用户作品列表参数
|
|
5120
5218
|
* @returns 请求配置
|
|
5121
5219
|
*/
|
|
5122
|
-
userWorkList(data
|
|
5220
|
+
userWorkList(data) {
|
|
5123
5221
|
return {
|
|
5124
|
-
...this.profilePublic(data
|
|
5222
|
+
...this.profilePublic(data),
|
|
5125
5223
|
type: "userWorkList"
|
|
5126
5224
|
};
|
|
5127
5225
|
}
|
|
@@ -5133,13 +5231,13 @@ var API = class {
|
|
|
5133
5231
|
* @param data - 用户主页参数
|
|
5134
5232
|
* @returns 请求配置
|
|
5135
5233
|
*/
|
|
5136
|
-
profilePrivate(data
|
|
5234
|
+
profilePrivate(data) {
|
|
5137
5235
|
return createKuaishouLiveApiRequest("profilePrivate", "/live_api/profile/private", {
|
|
5138
5236
|
caver: 2,
|
|
5139
5237
|
count: 12,
|
|
5140
5238
|
hasMore: true,
|
|
5141
5239
|
pcursor: "",
|
|
5142
|
-
principalId: data
|
|
5240
|
+
principalId: data.principalId,
|
|
5143
5241
|
privacy: "private"
|
|
5144
5242
|
}, { requiresSign: false });
|
|
5145
5243
|
}
|
|
@@ -5149,13 +5247,13 @@ var API = class {
|
|
|
5149
5247
|
* @param data - 用户主页参数
|
|
5150
5248
|
* @returns 请求配置
|
|
5151
5249
|
*/
|
|
5152
|
-
profileLiked(data
|
|
5250
|
+
profileLiked(data) {
|
|
5153
5251
|
return createKuaishouLiveApiRequest("profileLiked", "/live_api/profile/liked", {
|
|
5154
5252
|
caver: 2,
|
|
5155
5253
|
count: 12,
|
|
5156
5254
|
hasMore: true,
|
|
5157
5255
|
pcursor: "",
|
|
5158
|
-
principalId: data
|
|
5256
|
+
principalId: data.principalId,
|
|
5159
5257
|
privacy: "liked"
|
|
5160
5258
|
}, { requiresSign: false });
|
|
5161
5259
|
}
|
|
@@ -5164,11 +5262,11 @@ var API = class {
|
|
|
5164
5262
|
* @param data - 用户主页参数
|
|
5165
5263
|
* @returns 请求配置
|
|
5166
5264
|
*/
|
|
5167
|
-
profileInterestList(data
|
|
5265
|
+
profileInterestList(data) {
|
|
5168
5266
|
return createKuaishouLiveApiRequest("profileInterestList", "/live_api/profile/interestlist", {
|
|
5169
5267
|
caver: 2,
|
|
5170
5268
|
limit: 4,
|
|
5171
|
-
principalId: data
|
|
5269
|
+
principalId: data.principalId
|
|
5172
5270
|
});
|
|
5173
5271
|
}
|
|
5174
5272
|
/**
|
|
@@ -5179,9 +5277,9 @@ var API = class {
|
|
|
5179
5277
|
* @param data - 用户主页参数
|
|
5180
5278
|
* @returns 请求配置
|
|
5181
5279
|
*/
|
|
5182
|
-
playbackList(data
|
|
5280
|
+
playbackList(data) {
|
|
5183
5281
|
return createKuaishouLiveApiRequest("playbackList", "/live_api/playback/list", {
|
|
5184
|
-
principalId: data
|
|
5282
|
+
principalId: data.principalId,
|
|
5185
5283
|
count: 12,
|
|
5186
5284
|
cursor: "",
|
|
5187
5285
|
hasMore: true
|
|
@@ -5243,8 +5341,8 @@ var API = class {
|
|
|
5243
5341
|
* @param authToken - 私密房间等场景下可能需要的 authToken
|
|
5244
5342
|
* @returns 请求配置
|
|
5245
5343
|
*/
|
|
5246
|
-
liveDetail(data
|
|
5247
|
-
const query = { principalId: data
|
|
5344
|
+
liveDetail(data, authToken) {
|
|
5345
|
+
const query = { principalId: data.principalId };
|
|
5248
5346
|
if (authToken?.trim()) query.authToken = authToken.trim();
|
|
5249
5347
|
return createKuaishouLiveApiRequest("liveDetail", "/live_api/liveroom/livedetail", query, { requiresSign: false });
|
|
5250
5348
|
}
|
|
@@ -5326,7 +5424,6 @@ var API = class {
|
|
|
5326
5424
|
* 该对象只负责返回请求描述,不直接发起网络请求。
|
|
5327
5425
|
*/
|
|
5328
5426
|
const kuaishouApiUrls = new API();
|
|
5329
|
-
|
|
5330
5427
|
//#endregion
|
|
5331
5428
|
//#region src/platform/kuaishou/sign/hudr.ts
|
|
5332
5429
|
const KUAISHOU_HUDR_PREFIX = "HUDR_";
|
|
@@ -5401,6 +5498,8 @@ const encodeBase64Url = (bytes) => {
|
|
|
5401
5498
|
* 数据流而最小化保留的局部算法。
|
|
5402
5499
|
*/
|
|
5403
5500
|
var KuaishouChaChaCipher = class {
|
|
5501
|
+
key;
|
|
5502
|
+
nonce;
|
|
5404
5503
|
wordIndex = 0;
|
|
5405
5504
|
state = new Array(16).fill(0);
|
|
5406
5505
|
constructor(key, nonce) {
|
|
@@ -5520,7 +5619,6 @@ const deriveKuaishouHudrBody = (context) => {
|
|
|
5520
5619
|
nextCount: context.count + 1
|
|
5521
5620
|
};
|
|
5522
5621
|
};
|
|
5523
|
-
|
|
5524
5622
|
//#endregion
|
|
5525
5623
|
//#region src/platform/kuaishou/sign/primitives.ts
|
|
5526
5624
|
const KUAISHOU_BLAKE2S_IV = [
|
|
@@ -5997,7 +6095,6 @@ const transformKuaishouHeHex = (prefixHex, checksumHex) => {
|
|
|
5997
6095
|
output[input.length - 1] = xorKey;
|
|
5998
6096
|
return bytesToLowerHex(output);
|
|
5999
6097
|
};
|
|
6000
|
-
|
|
6001
6098
|
//#endregion
|
|
6002
6099
|
//#region src/platform/kuaishou/sign/he.ts
|
|
6003
6100
|
const KUAISHOU_HE_HEADER_HEX = "4B54";
|
|
@@ -6081,7 +6178,6 @@ const deriveKuaishouPureSignature = (context) => {
|
|
|
6081
6178
|
signResult: `${hudr.full}$HE_${he.finalHex}`
|
|
6082
6179
|
};
|
|
6083
6180
|
};
|
|
6084
|
-
|
|
6085
6181
|
//#endregion
|
|
6086
6182
|
//#region src/platform/kuaishou/sign/helpers.ts
|
|
6087
6183
|
const SIGN_INPUT_SKIP_KEYWORD = "__NS";
|
|
@@ -6170,7 +6266,7 @@ const buildKuaishouHxfalconSignInput = (payload) => {
|
|
|
6170
6266
|
*/
|
|
6171
6267
|
const extractCookieValue = (cookie, key) => {
|
|
6172
6268
|
if (!cookie?.trim()) return "";
|
|
6173
|
-
const pattern =
|
|
6269
|
+
const pattern = new RegExp(`(?:^|;\\s*)${key}=([^;]*)`);
|
|
6174
6270
|
return cookie.match(pattern)?.[1] ?? "";
|
|
6175
6271
|
};
|
|
6176
6272
|
const generateKuaishouAnonymousKwwSeed = () => {
|
|
@@ -6213,7 +6309,6 @@ const deriveKuaishouKww = (cookie) => {
|
|
|
6213
6309
|
if (kwfv1) return kwfv1;
|
|
6214
6310
|
return deriveKuaishouAnonymousKww();
|
|
6215
6311
|
};
|
|
6216
|
-
|
|
6217
6312
|
//#endregion
|
|
6218
6313
|
//#region src/platform/kuaishou/sign/state.ts
|
|
6219
6314
|
const KUAISHOU_DEFAULT_CAT_VERSION = "2";
|
|
@@ -6237,7 +6332,7 @@ const captureKuaishouEncodeStack = () => {
|
|
|
6237
6332
|
* @returns 用于 `SECS.s` 的栈尾字符串
|
|
6238
6333
|
*/
|
|
6239
6334
|
const deriveKuaishouSecsStackTail = (stack = captureKuaishouEncodeStack()) => {
|
|
6240
|
-
return stack.length > KUAISHOU_SECS_STACK_LIMIT ? stack.slice(-
|
|
6335
|
+
return stack.length > KUAISHOU_SECS_STACK_LIMIT ? stack.slice(-100) : stack;
|
|
6241
6336
|
};
|
|
6242
6337
|
/**
|
|
6243
6338
|
* 构造快手 `window.SECS` 的纯算法等价状态。
|
|
@@ -6269,7 +6364,6 @@ const getKuaishouPureRuntimeState = () => {
|
|
|
6269
6364
|
};
|
|
6270
6365
|
return pureRuntimeState;
|
|
6271
6366
|
};
|
|
6272
|
-
|
|
6273
6367
|
//#endregion
|
|
6274
6368
|
//#region src/platform/kuaishou/sign/index.ts
|
|
6275
6369
|
/**
|
|
@@ -6362,7 +6456,6 @@ var kuaishouSign = class {
|
|
|
6362
6456
|
return this.signLiveApiUrl(request.url, cookie, request.signPath);
|
|
6363
6457
|
}
|
|
6364
6458
|
};
|
|
6365
|
-
|
|
6366
6459
|
//#endregion
|
|
6367
6460
|
//#region src/platform/kuaishou/getdata.ts
|
|
6368
6461
|
/**
|
|
@@ -6922,7 +7015,7 @@ const dedupeLiveRoomPlayList = (items) => {
|
|
|
6922
7015
|
* @param requestConfig - 外部请求配置(优先级最高)
|
|
6923
7016
|
* @returns 返回快手数据;当前 user/live 能力已优先走纯协议聚合链路
|
|
6924
7017
|
*/
|
|
6925
|
-
const KuaishouData = async (data
|
|
7018
|
+
const KuaishouData = async (data, cookie, requestConfig) => {
|
|
6926
7019
|
const defHeaders = getKuaishouDefaultConfig(cookie)["headers"];
|
|
6927
7020
|
const baseRequestConfig = {
|
|
6928
7021
|
method: "POST",
|
|
@@ -6960,27 +7053,27 @@ const KuaishouData = async (data$1, cookie, requestConfig) => {
|
|
|
6960
7053
|
const fetchKuaishouLiveApiPayload = (type, request, refererPath, config) => {
|
|
6961
7054
|
return GlobalGetData$2(type, buildLiveApiRequestConfig(request, refererPath, cookie, requestConfig), config);
|
|
6962
7055
|
};
|
|
6963
|
-
switch (data
|
|
6964
|
-
case "videoWork": return fetchKuaishouGraphqlPayload(data
|
|
6965
|
-
case "comments": return fetchKuaishouGraphqlPayload(data
|
|
7056
|
+
switch (data.methodType) {
|
|
7057
|
+
case "videoWork": return fetchKuaishouGraphqlPayload(data.methodType, kuaishouApiUrls.videoWork({ photoId: data.photoId }));
|
|
7058
|
+
case "comments": return fetchKuaishouGraphqlPayload(data.methodType, kuaishouApiUrls.comments({ photoId: data.photoId }));
|
|
6966
7059
|
case "userProfile": {
|
|
6967
|
-
const refererPath = `profile/${encodeURIComponent(data
|
|
7060
|
+
const refererPath = `profile/${encodeURIComponent(data.principalId)}`;
|
|
6968
7061
|
const [userInfoPayload, sensitivePayload, publicPayload, privatePayload, likedPayload, playbackPayload, interestListPayload, interestMaskPayload, categoryConfigPayload, categoryDataPayload, categoryClassifyPayload, liveDetailPayload] = await Promise.all([
|
|
6969
|
-
fetchKuaishouLiveApiPayload(data
|
|
6970
|
-
fetchKuaishouLiveApiPayload(data
|
|
6971
|
-
fetchKuaishouLiveApiPayload(data
|
|
6972
|
-
fetchKuaishouLiveApiPayload(data
|
|
6973
|
-
fetchKuaishouLiveApiPayload(data
|
|
6974
|
-
fetchKuaishouLiveApiPayload(data
|
|
6975
|
-
fetchKuaishouLiveApiPayload(data
|
|
6976
|
-
fetchKuaishouLiveApiPayload(data
|
|
6977
|
-
fetchKuaishouLiveApiPayload(data
|
|
6978
|
-
fetchKuaishouLiveApiPayload(data
|
|
6979
|
-
fetchKuaishouLiveApiPayload(data
|
|
6980
|
-
fetchKuaishouLiveApiPayload(data
|
|
7062
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.userInfoById({ principalId: data.principalId }), refererPath),
|
|
7063
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.userSensitiveInfo({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
7064
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.profilePublic({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
7065
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.profilePrivate({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
7066
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.profileLiked({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
7067
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.playbackList({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
7068
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.profileInterestList({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
7069
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.interestMaskList(), refererPath, { allowResult2: true }),
|
|
7070
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.categoryConfig(), refererPath),
|
|
7071
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.categoryData(), refererPath),
|
|
7072
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.categoryClassify(), refererPath),
|
|
7073
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.liveDetail({ principalId: data.principalId }), refererPath, { allowResult2: true })
|
|
6981
7074
|
]);
|
|
6982
7075
|
if (isErrorDetailLike(userInfoPayload)) return userInfoPayload;
|
|
6983
|
-
const userProfile = createEmptyUserProfileResult(data
|
|
7076
|
+
const userProfile = createEmptyUserProfileResult(data.principalId);
|
|
6984
7077
|
const userInfo = userInfoPayload?.data?.userInfo;
|
|
6985
7078
|
const sensitiveInfo = isErrorDetailLike(sensitivePayload) ? null : sensitivePayload?.data?.sensitiveUserInfo ?? null;
|
|
6986
7079
|
const liveDetailData = resolveKuaishouLiveDetailData(liveDetailPayload);
|
|
@@ -6994,10 +7087,10 @@ const KuaishouData = async (data$1, cookie, requestConfig) => {
|
|
|
6994
7087
|
const nextInterestMask = !isErrorDetailLike(interestMaskPayload) && Array.isArray(interestMaskPayload?.data) ? interestMaskPayload.data : userProfile.interestMask;
|
|
6995
7088
|
return {
|
|
6996
7089
|
...userProfile,
|
|
6997
|
-
principalId: data
|
|
7090
|
+
principalId: data.principalId,
|
|
6998
7091
|
author: {
|
|
6999
7092
|
...userProfile.author,
|
|
7000
|
-
principalId: data
|
|
7093
|
+
principalId: data.principalId,
|
|
7001
7094
|
userInfo: normalizedAuthor,
|
|
7002
7095
|
sensitiveInfo,
|
|
7003
7096
|
followInfo: {},
|
|
@@ -7028,25 +7121,25 @@ const KuaishouData = async (data$1, cookie, requestConfig) => {
|
|
|
7028
7121
|
};
|
|
7029
7122
|
}
|
|
7030
7123
|
case "userWorkList": {
|
|
7031
|
-
const refererPath = `profile/${encodeURIComponent(data
|
|
7032
|
-
const publicPayload = await fetchKuaishouLiveApiPayload(data
|
|
7033
|
-
principalId: data
|
|
7034
|
-
pcursor: data
|
|
7035
|
-
count: data
|
|
7124
|
+
const refererPath = `profile/${encodeURIComponent(data.principalId)}`;
|
|
7125
|
+
const publicPayload = await fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.userWorkList({
|
|
7126
|
+
principalId: data.principalId,
|
|
7127
|
+
pcursor: data.pcursor,
|
|
7128
|
+
count: data.count
|
|
7036
7129
|
}), refererPath, { allowResult2: true });
|
|
7037
7130
|
if (isErrorDetailLike(publicPayload)) return publicPayload;
|
|
7038
|
-
return resolveKuaishouUserWorkList(data
|
|
7131
|
+
return resolveKuaishouUserWorkList(data.principalId, publicPayload);
|
|
7039
7132
|
}
|
|
7040
7133
|
case "liveRoomInfo": {
|
|
7041
|
-
const refererPath = `u/${encodeURIComponent(data
|
|
7134
|
+
const refererPath = `u/${encodeURIComponent(data.principalId)}`;
|
|
7042
7135
|
const [liveDetailPayload, userInfoPayload, sensitivePayload, emojiPayload] = await Promise.all([
|
|
7043
|
-
fetchKuaishouLiveApiPayload(data
|
|
7044
|
-
fetchKuaishouLiveApiPayload(data
|
|
7045
|
-
fetchKuaishouLiveApiPayload(data
|
|
7046
|
-
fetchKuaishouGraphqlPayload(data
|
|
7136
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.liveDetail({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
7137
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.userInfoById({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
7138
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.userSensitiveInfo({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
7139
|
+
fetchKuaishouGraphqlPayload(data.methodType, kuaishouApiUrls.emojiList(), { allowResult2: true })
|
|
7047
7140
|
]);
|
|
7048
7141
|
if (isErrorDetailLike(liveDetailPayload)) return liveDetailPayload;
|
|
7049
|
-
const liveRoomInfo = createEmptyLiveRoomInfoResult(data
|
|
7142
|
+
const liveRoomInfo = createEmptyLiveRoomInfoResult(data.principalId);
|
|
7050
7143
|
const liveDetailData = resolveKuaishouLiveDetailData(liveDetailPayload);
|
|
7051
7144
|
if (!liveDetailData) return liveRoomInfo;
|
|
7052
7145
|
const userInfo = isErrorDetailLike(userInfoPayload) ? void 0 : userInfoPayload?.data?.userInfo;
|
|
@@ -7064,15 +7157,15 @@ const KuaishouData = async (data$1, cookie, requestConfig) => {
|
|
|
7064
7157
|
const shouldFetchWebsocketInfo = liveDetailWebsocketMeta.websocketUrls.length === 0 || !liveDetailWebsocketMeta.token;
|
|
7065
7158
|
const shouldFetchRecommendList = liveDetailRecommendList.length === 0;
|
|
7066
7159
|
const [giftPayload, websocketPayload, recoPayload] = await Promise.all([
|
|
7067
|
-
fetchKuaishouLiveApiPayload(data
|
|
7068
|
-
shouldFetchWebsocketInfo ? fetchKuaishouLiveApiPayload(data
|
|
7069
|
-
shouldFetchRecommendList ? fetchKuaishouLiveApiPayload(data
|
|
7160
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.liveGiftList(liveStreamId), refererPath, { allowResult2: true }),
|
|
7161
|
+
shouldFetchWebsocketInfo ? fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.liveWebsocketInfo(liveStreamId), refererPath, { allowResult2: true }) : Promise.resolve(null),
|
|
7162
|
+
shouldFetchRecommendList ? fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.liveReco(currentGameId), refererPath, { allowResult2: true }) : Promise.resolve(null)
|
|
7070
7163
|
]);
|
|
7071
7164
|
const resolvedRecommendList = !isErrorDetailLike(recoPayload) && Array.isArray(recoPayload?.data?.list) ? recoPayload.data.list : liveDetailRecommendList;
|
|
7072
7165
|
const nextPlayList = dedupeLiveRoomPlayList([currentLiveRoomItem, ...Array.isArray(resolvedRecommendList) ? resolvedRecommendList.map((item) => mapRecoItemToLiveRoomPlayItem(item)) : []]);
|
|
7073
7166
|
return {
|
|
7074
7167
|
...liveRoomInfo,
|
|
7075
|
-
principalId: data
|
|
7168
|
+
principalId: data.principalId,
|
|
7076
7169
|
activeIndex: 0,
|
|
7077
7170
|
current: currentLiveRoomItem,
|
|
7078
7171
|
playList: nextPlayList,
|
|
@@ -7090,9 +7183,9 @@ const KuaishouData = async (data$1, cookie, requestConfig) => {
|
|
|
7090
7183
|
}
|
|
7091
7184
|
};
|
|
7092
7185
|
}
|
|
7093
|
-
case "emojiList": return fetchKuaishouGraphqlPayload(data
|
|
7186
|
+
case "emojiList": return fetchKuaishouGraphqlPayload(data.methodType, kuaishouApiUrls.emojiList());
|
|
7094
7187
|
default:
|
|
7095
|
-
|
|
7188
|
+
emitLogWarn(`Unknown Kuaishou API method: "${data.methodType}"`);
|
|
7096
7189
|
return null;
|
|
7097
7190
|
}
|
|
7098
7191
|
};
|
|
@@ -7131,15 +7224,15 @@ const GlobalGetData$2 = async (type, options, config) => {
|
|
|
7131
7224
|
requestBody: JSON.stringify(options.data)
|
|
7132
7225
|
};
|
|
7133
7226
|
warningMessage = `
|
|
7134
|
-
|
|
7227
|
+
获取响应数据失败!原因:接口返回内容为空,你的快手ck可能已经失效!
|
|
7135
7228
|
请求类型:「${type}」
|
|
7136
7229
|
请求URL:${options.url}
|
|
7137
7230
|
请求参数:${JSON.stringify(options.data, null, 2)}
|
|
7138
7231
|
`;
|
|
7139
|
-
|
|
7232
|
+
emitLogWarn(warningMessage);
|
|
7140
7233
|
const cookieError = new Error(Err.errorDescription);
|
|
7141
7234
|
Object.assign(cookieError, {
|
|
7142
|
-
code:
|
|
7235
|
+
code: "INVALID_COOKIE",
|
|
7143
7236
|
data: result,
|
|
7144
7237
|
amagiError: Err
|
|
7145
7238
|
});
|
|
@@ -7152,7 +7245,7 @@ const GlobalGetData$2 = async (type, options, config) => {
|
|
|
7152
7245
|
amagiMessage: warningMessage
|
|
7153
7246
|
};
|
|
7154
7247
|
return {
|
|
7155
|
-
code:
|
|
7248
|
+
code: "UNKNOWN_ERROR",
|
|
7156
7249
|
data: null,
|
|
7157
7250
|
amagiError: {
|
|
7158
7251
|
errorDescription: "未知错误",
|
|
@@ -7163,7 +7256,6 @@ const GlobalGetData$2 = async (type, options, config) => {
|
|
|
7163
7256
|
};
|
|
7164
7257
|
}
|
|
7165
7258
|
};
|
|
7166
|
-
|
|
7167
7259
|
//#endregion
|
|
7168
7260
|
//#region src/model/fetchers/kuaishou/internal.ts
|
|
7169
7261
|
/**
|
|
@@ -7215,7 +7307,6 @@ async function fetchKuaishouInternal(methodType, options, config) {
|
|
|
7215
7307
|
throw new Error(`快手数据获取失败: ${errorMessage}`);
|
|
7216
7308
|
}
|
|
7217
7309
|
}
|
|
7218
|
-
|
|
7219
7310
|
//#endregion
|
|
7220
7311
|
//#region src/model/fetchers/kuaishou/api.ts
|
|
7221
7312
|
/**
|
|
@@ -7320,7 +7411,6 @@ async function fetchEmojiList$1(options, cookie, requestConfig) {
|
|
|
7320
7411
|
requestConfig
|
|
7321
7412
|
});
|
|
7322
7413
|
}
|
|
7323
|
-
|
|
7324
7414
|
//#endregion
|
|
7325
7415
|
//#region src/model/fetchers/kuaishou/index.ts
|
|
7326
7416
|
/**
|
|
@@ -7364,7 +7454,6 @@ function createBoundKuaishouFetcher(cookie, requestConfig) {
|
|
|
7364
7454
|
fetchEmojiList: (options, reqConfig) => fetchEmojiList$1(options, cookie, reqConfig ?? requestConfig)
|
|
7365
7455
|
};
|
|
7366
7456
|
}
|
|
7367
|
-
|
|
7368
7457
|
//#endregion
|
|
7369
7458
|
//#region src/platform/xiaohongshu/getdata.ts
|
|
7370
7459
|
/**
|
|
@@ -7374,133 +7463,137 @@ function createBoundKuaishouFetcher(cookie, requestConfig) {
|
|
|
7374
7463
|
* @param requestConfig - 外部请求配置
|
|
7375
7464
|
* @returns 返回小红书数据
|
|
7376
7465
|
*/
|
|
7377
|
-
const XiaohongshuData = async (data
|
|
7378
|
-
|
|
7379
|
-
const
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
...
|
|
7385
|
-
...requestConfig?.headers ?? {}
|
|
7386
|
-
}
|
|
7387
|
-
};
|
|
7388
|
-
const xiaohongshuApiUrls$1 = createXiaohongshuApiUrls();
|
|
7389
|
-
switch (data$1.methodType) {
|
|
7390
|
-
case "homeFeed": return await GlobalGetData$1(data$1.methodType, {
|
|
7391
|
-
...baseRequestConfig,
|
|
7392
|
-
url: xiaohongshuApiUrls$1.homeFeed(data$1).Url,
|
|
7393
|
-
data: JSON.stringify(xiaohongshuApiUrls$1.homeFeed(data$1).Body),
|
|
7394
|
-
headers: {
|
|
7395
|
-
...baseRequestConfig.headers,
|
|
7396
|
-
"x-s": xiaohongshuSign.generateXSPost(xiaohongshuApiUrls$1.homeFeed(data$1).apiPath, xiaohongshuSign.extractA1FromCookie(cookie ?? ""), "xhs-pc-web", xiaohongshuApiUrls$1.homeFeed(data$1).Body),
|
|
7397
|
-
"x-s-common": xiaohongshuSign.generateXSCommon(cookie ?? ""),
|
|
7398
|
-
"x-t": xiaohongshuSign.generateXT()
|
|
7399
|
-
}
|
|
7400
|
-
});
|
|
7401
|
-
case "noteDetail": return await GlobalGetData$1(data$1.methodType, {
|
|
7402
|
-
...baseRequestConfig,
|
|
7403
|
-
url: xiaohongshuApiUrls$1.noteDetail(data$1).Url,
|
|
7404
|
-
data: xiaohongshuApiUrls$1.noteDetail(data$1).Body,
|
|
7466
|
+
const XiaohongshuData = async (data, cookie, requestConfig) => {
|
|
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,
|
|
7405
7474
|
headers: {
|
|
7406
|
-
...
|
|
7407
|
-
|
|
7408
|
-
"x-s-common": xiaohongshuSign.generateXSCommon(cookie ?? ""),
|
|
7409
|
-
"x-t": xiaohongshuSign.generateXT()
|
|
7475
|
+
...defHeaders,
|
|
7476
|
+
...requestConfig?.headers ?? {}
|
|
7410
7477
|
}
|
|
7411
|
-
}
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
...defHeaders,
|
|
7419
|
-
...requestConfig?.headers ?? {}
|
|
7420
|
-
}
|
|
7421
|
-
};
|
|
7422
|
-
return await GlobalGetData$1(data$1.methodType, {
|
|
7423
|
-
...baseRequestConfig$1,
|
|
7424
|
-
url: xiaohongshuApiUrls$1.noteComments(data$1).Url,
|
|
7478
|
+
};
|
|
7479
|
+
const xiaohongshuApiUrls = createXiaohongshuApiUrls();
|
|
7480
|
+
switch (data.methodType) {
|
|
7481
|
+
case "homeFeed": return await GlobalGetData$1(data.methodType, {
|
|
7482
|
+
...baseRequestConfig,
|
|
7483
|
+
url: xiaohongshuApiUrls.homeFeed(data).Url,
|
|
7484
|
+
data: JSON.stringify(xiaohongshuApiUrls.homeFeed(data).Body),
|
|
7425
7485
|
headers: {
|
|
7426
|
-
...baseRequestConfig
|
|
7427
|
-
"x-s": xiaohongshuSign.
|
|
7428
|
-
"x-s-common": xiaohongshuSign.generateXSCommon(
|
|
7486
|
+
...baseRequestConfig.headers,
|
|
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),
|
|
7429
7489
|
"x-t": xiaohongshuSign.generateXT()
|
|
7430
7490
|
}
|
|
7431
7491
|
});
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
timeout: 1e4,
|
|
7437
|
-
...requestConfig,
|
|
7492
|
+
case "noteDetail": return await GlobalGetData$1(data.methodType, {
|
|
7493
|
+
...baseRequestConfig,
|
|
7494
|
+
url: xiaohongshuApiUrls.noteDetail(data).Url,
|
|
7495
|
+
data: xiaohongshuApiUrls.noteDetail(data).Body,
|
|
7438
7496
|
headers: {
|
|
7439
|
-
...
|
|
7440
|
-
|
|
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()
|
|
7441
7501
|
}
|
|
7442
|
-
};
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7502
|
+
});
|
|
7503
|
+
case "noteComments": {
|
|
7504
|
+
const baseRequestConfig = {
|
|
7505
|
+
method: "GET",
|
|
7506
|
+
timeout: 1e4,
|
|
7507
|
+
...requestConfig,
|
|
7448
7508
|
headers: {
|
|
7449
|
-
...
|
|
7450
|
-
|
|
7451
|
-
|
|
7509
|
+
...defHeaders,
|
|
7510
|
+
...requestConfig?.headers ?? {}
|
|
7511
|
+
}
|
|
7512
|
+
};
|
|
7513
|
+
return await GlobalGetData$1(data.methodType, {
|
|
7514
|
+
...baseRequestConfig,
|
|
7515
|
+
url: xiaohongshuApiUrls.noteComments(data).Url,
|
|
7516
|
+
headers: {
|
|
7517
|
+
...baseRequestConfig.headers,
|
|
7518
|
+
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls.noteComments(data).apiPath, xiaohongshuSign.extractA1FromCookie(requestCookie), "xhs-pc-web"),
|
|
7519
|
+
"x-s-common": xiaohongshuSign.generateXSCommon(requestCookie),
|
|
7452
7520
|
"x-t": xiaohongshuSign.generateXT()
|
|
7453
7521
|
}
|
|
7454
|
-
})
|
|
7455
|
-
msg: "success"
|
|
7456
|
-
};
|
|
7457
|
-
}
|
|
7458
|
-
case "userNoteList": return await GlobalGetData$1(data$1.methodType, {
|
|
7459
|
-
...baseRequestConfig,
|
|
7460
|
-
method: "GET",
|
|
7461
|
-
url: xiaohongshuApiUrls$1.userNoteList(data$1).Url,
|
|
7462
|
-
headers: {
|
|
7463
|
-
...baseRequestConfig.headers,
|
|
7464
|
-
"x-b3-traceid": xiaohongshuSign.generateXB3Traceid(),
|
|
7465
|
-
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls$1.userNoteList(data$1).apiPath, xiaohongshuSign.extractA1FromCookie(cookie ?? ""), "xhs-pc-web"),
|
|
7466
|
-
"x-s-common": xiaohongshuSign.generateXSCommon(cookie ?? ""),
|
|
7467
|
-
"x-t": xiaohongshuSign.generateXT()
|
|
7522
|
+
});
|
|
7468
7523
|
}
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
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,
|
|
7472
7551
|
method: "GET",
|
|
7473
|
-
|
|
7474
|
-
...requestConfig,
|
|
7552
|
+
url: xiaohongshuApiUrls.userNoteList(data).Url,
|
|
7475
7553
|
headers: {
|
|
7476
|
-
...
|
|
7477
|
-
|
|
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()
|
|
7478
7559
|
}
|
|
7479
|
-
};
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
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, {
|
|
7583
|
+
...baseRequestConfig,
|
|
7584
|
+
url: xiaohongshuApiUrls.searchNotes(data).Url,
|
|
7585
|
+
data: xiaohongshuApiUrls.searchNotes(data).Body,
|
|
7483
7586
|
headers: {
|
|
7484
|
-
...baseRequestConfig
|
|
7485
|
-
"x-s": xiaohongshuSign.
|
|
7486
|
-
"x-s-common": xiaohongshuSign.generateXSCommon(
|
|
7587
|
+
...baseRequestConfig.headers,
|
|
7588
|
+
"x-s": xiaohongshuSign.generateXSPost(xiaohongshuApiUrls.searchNotes(data).apiPath, xiaohongshuSign.extractA1FromCookie(requestCookie), "xhs-pc-web"),
|
|
7589
|
+
"x-s-common": xiaohongshuSign.generateXSCommon(requestCookie),
|
|
7487
7590
|
"x-t": xiaohongshuSign.generateXT()
|
|
7488
7591
|
}
|
|
7489
7592
|
});
|
|
7593
|
+
default: throw new Error(`Unknown Xiaohongshu API method: "${data.methodType}"`);
|
|
7490
7594
|
}
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
url: xiaohongshuApiUrls$1.searchNotes(data$1).Url,
|
|
7494
|
-
data: xiaohongshuApiUrls$1.searchNotes(data$1).Body,
|
|
7495
|
-
headers: {
|
|
7496
|
-
...baseRequestConfig.headers,
|
|
7497
|
-
"x-s": xiaohongshuSign.generateXSPost(xiaohongshuApiUrls$1.searchNotes(data$1).apiPath, xiaohongshuSign.extractA1FromCookie(cookie ?? ""), "xhs-pc-web"),
|
|
7498
|
-
"x-s-common": xiaohongshuSign.generateXSCommon(cookie ?? ""),
|
|
7499
|
-
"x-t": xiaohongshuSign.generateXT()
|
|
7500
|
-
}
|
|
7501
|
-
});
|
|
7502
|
-
default: throw new Error(`Unknown Xiaohongshu API method: "${logger.red(data$1.methodType)}"`);
|
|
7503
|
-
}
|
|
7595
|
+
};
|
|
7596
|
+
return requestWithCookie(cookie?.trim() ?? "");
|
|
7504
7597
|
};
|
|
7505
7598
|
/**
|
|
7506
7599
|
* 全局数据获取函数
|
|
@@ -7524,7 +7617,7 @@ const GlobalGetData$1 = async (methodType, config) => {
|
|
|
7524
7617
|
if (response.code !== 0) throw new Error(`API request failed: ${response.data?.msg ?? response.msg ?? "Unknown error"}, code: ${response.code}`);
|
|
7525
7618
|
return response;
|
|
7526
7619
|
} catch (error) {
|
|
7527
|
-
|
|
7620
|
+
emitLogError(`Xiaohongshu API request failed [${methodType}]:`, error.message);
|
|
7528
7621
|
return {
|
|
7529
7622
|
code: 500,
|
|
7530
7623
|
message: "error",
|
|
@@ -7538,7 +7631,6 @@ const GlobalGetData$1 = async (methodType, config) => {
|
|
|
7538
7631
|
};
|
|
7539
7632
|
}
|
|
7540
7633
|
};
|
|
7541
|
-
|
|
7542
7634
|
//#endregion
|
|
7543
7635
|
//#region src/model/fetchers/xiaohongshu/internal.ts
|
|
7544
7636
|
/**
|
|
@@ -7549,9 +7641,9 @@ const GlobalGetData$1 = async (methodType, config) => {
|
|
|
7549
7641
|
* 搜索排序类型映射
|
|
7550
7642
|
*/
|
|
7551
7643
|
const sortTypeMapping = {
|
|
7552
|
-
general:
|
|
7553
|
-
time_descending:
|
|
7554
|
-
popularity_descending:
|
|
7644
|
+
general: "general",
|
|
7645
|
+
time_descending: "time_descending",
|
|
7646
|
+
popularity_descending: "popularity_descending"
|
|
7555
7647
|
};
|
|
7556
7648
|
/**
|
|
7557
7649
|
* 小红书 API 内部调用函数
|
|
@@ -7598,7 +7690,6 @@ async function fetchXiaohongshuInternal(methodType, options, config) {
|
|
|
7598
7690
|
throw new Error(`小红书数据获取失败: ${errorMessage}`);
|
|
7599
7691
|
}
|
|
7600
7692
|
}
|
|
7601
|
-
|
|
7602
7693
|
//#endregion
|
|
7603
7694
|
//#region src/model/fetchers/xiaohongshu/misc.ts
|
|
7604
7695
|
/**
|
|
@@ -7620,7 +7711,6 @@ async function fetchEmojiList(options, cookie, requestConfig) {
|
|
|
7620
7711
|
requestConfig
|
|
7621
7712
|
});
|
|
7622
7713
|
}
|
|
7623
|
-
|
|
7624
7714
|
//#endregion
|
|
7625
7715
|
//#region src/model/fetchers/xiaohongshu/note.ts
|
|
7626
7716
|
/**
|
|
@@ -7687,7 +7777,6 @@ async function fetchNoteComments(options, cookie, requestConfig) {
|
|
|
7687
7777
|
requestConfig
|
|
7688
7778
|
});
|
|
7689
7779
|
}
|
|
7690
|
-
|
|
7691
7780
|
//#endregion
|
|
7692
7781
|
//#region src/model/fetchers/xiaohongshu/search.ts
|
|
7693
7782
|
/**
|
|
@@ -7722,7 +7811,6 @@ async function searchNotes(options, cookie, requestConfig) {
|
|
|
7722
7811
|
requestConfig
|
|
7723
7812
|
});
|
|
7724
7813
|
}
|
|
7725
|
-
|
|
7726
7814
|
//#endregion
|
|
7727
7815
|
//#region src/model/fetchers/xiaohongshu/user.ts
|
|
7728
7816
|
/**
|
|
@@ -7763,7 +7851,6 @@ async function fetchUserNoteList(options, cookie, requestConfig) {
|
|
|
7763
7851
|
requestConfig
|
|
7764
7852
|
});
|
|
7765
7853
|
}
|
|
7766
|
-
|
|
7767
7854
|
//#endregion
|
|
7768
7855
|
//#region src/model/fetchers/xiaohongshu/index.ts
|
|
7769
7856
|
/**
|
|
@@ -7813,7 +7900,6 @@ function createBoundXiaohongshuFetcher(cookie, requestConfig) {
|
|
|
7813
7900
|
fetchEmojiList: (options, reqConfig) => fetchEmojiList(options, cookie, reqConfig ?? requestConfig)
|
|
7814
7901
|
};
|
|
7815
7902
|
}
|
|
7816
|
-
|
|
7817
7903
|
//#endregion
|
|
7818
7904
|
//#region src/model/networks.ts
|
|
7819
7905
|
/** 可恢复的错误代码列表 */
|
|
@@ -7855,7 +7941,7 @@ const createNetworkErrorResult = (error, retries) => {
|
|
|
7855
7941
|
const errorCode = error.code ?? "UNKNOWN";
|
|
7856
7942
|
const message = `网络请求失败 [${errorCode}]: ${error.message} (已重试 ${retries} 次)`;
|
|
7857
7943
|
return createErrorResponse({
|
|
7858
|
-
code:
|
|
7944
|
+
code: "UNKNOWN_ERROR",
|
|
7859
7945
|
data: null,
|
|
7860
7946
|
amagiError: {
|
|
7861
7947
|
errorDescription: `${error.message} (已重试 ${retries} 次)`,
|
|
@@ -7872,7 +7958,7 @@ const createNetworkErrorResult = (error, retries) => {
|
|
|
7872
7958
|
* @returns 清理后的User-Agent字符串
|
|
7873
7959
|
*/
|
|
7874
7960
|
const cleanUserAgent = (userAgent) => {
|
|
7875
|
-
return userAgent.replace(/\s+Edg\/[\d
|
|
7961
|
+
return userAgent.replace(/\s+Edg\/[\d.]+/g, "");
|
|
7876
7962
|
};
|
|
7877
7963
|
/**
|
|
7878
7964
|
* 执行网络请求并返回数据(带自动重试)
|
|
@@ -7992,7 +8078,6 @@ const getHeadersAndData = async (config, maxRetries = DEFAULT_MAX_RETRIES) => {
|
|
|
7992
8078
|
data: response.data
|
|
7993
8079
|
};
|
|
7994
8080
|
};
|
|
7995
|
-
|
|
7996
8081
|
//#endregion
|
|
7997
8082
|
//#region src/model/logger.ts
|
|
7998
8083
|
/**
|
|
@@ -8093,7 +8178,6 @@ const logMiddleware = (pathsToLog) => {
|
|
|
8093
8178
|
next();
|
|
8094
8179
|
};
|
|
8095
8180
|
};
|
|
8096
|
-
|
|
8097
8181
|
//#endregion
|
|
8098
8182
|
//#region src/platform/bilibili/qtparam.ts
|
|
8099
8183
|
/**
|
|
@@ -8126,8 +8210,7 @@ const qtparam = async (BASEURL, cookie) => {
|
|
|
8126
8210
|
126,
|
|
8127
8211
|
127
|
|
8128
8212
|
];
|
|
8129
|
-
|
|
8130
|
-
logininfo.data.vipStatus === 1 ? isvip = true : isvip = false;
|
|
8213
|
+
const isvip = logininfo.data.vipStatus === 1;
|
|
8131
8214
|
if (isvip) return {
|
|
8132
8215
|
QUERY: `&fnval=4048&fourk=1&${sign}`,
|
|
8133
8216
|
STATUS: "isLogin",
|
|
@@ -8139,7 +8222,6 @@ const qtparam = async (BASEURL, cookie) => {
|
|
|
8139
8222
|
isvip
|
|
8140
8223
|
};
|
|
8141
8224
|
};
|
|
8142
|
-
|
|
8143
8225
|
//#endregion
|
|
8144
8226
|
//#region src/platform/bilibili/sign/bv2av.ts
|
|
8145
8227
|
const XOR_CODE = 23442827791579n;
|
|
@@ -8191,7 +8273,6 @@ const bv2av = (bvid) => {
|
|
|
8191
8273
|
const tmp = bvidArr.reduce((pre, bvidChar) => pre * BASE + BigInt(data.indexOf(bvidChar)), 0n);
|
|
8192
8274
|
return Number(tmp & MASK_CODE ^ XOR_CODE);
|
|
8193
8275
|
};
|
|
8194
|
-
|
|
8195
8276
|
//#endregion
|
|
8196
8277
|
//#region src/platform/bilibili/sign/danmaku_proto.ts
|
|
8197
8278
|
/**
|
|
@@ -8277,16 +8358,15 @@ function getProtoType() {
|
|
|
8277
8358
|
* @param data - 二进制 protobuf 数据
|
|
8278
8359
|
* @returns 解析后的弹幕数据
|
|
8279
8360
|
*/
|
|
8280
|
-
function parseDmSegMobileReply(data
|
|
8361
|
+
function parseDmSegMobileReply(data) {
|
|
8281
8362
|
const messageType = getProtoType();
|
|
8282
|
-
const buffer = data
|
|
8363
|
+
const buffer = data instanceof Uint8Array ? data : new Uint8Array(data);
|
|
8283
8364
|
const message = messageType.decode(buffer);
|
|
8284
8365
|
return messageType.toObject(message, {
|
|
8285
8366
|
longs: String,
|
|
8286
8367
|
defaults: true
|
|
8287
8368
|
});
|
|
8288
8369
|
}
|
|
8289
|
-
|
|
8290
8370
|
//#endregion
|
|
8291
8371
|
//#region src/platform/bilibili/sign/wbi.ts
|
|
8292
8372
|
/**
|
|
@@ -8409,7 +8489,6 @@ const wbi_sign = async (BASEURL, cookie) => {
|
|
|
8409
8489
|
for (const [key, value] of url.searchParams.entries()) params[key] = value;
|
|
8410
8490
|
return encWbi(params, web_keys.img_key, web_keys.sub_key);
|
|
8411
8491
|
};
|
|
8412
|
-
|
|
8413
8492
|
//#endregion
|
|
8414
8493
|
//#region src/platform/bilibili/getdata.ts
|
|
8415
8494
|
/**
|
|
@@ -8430,28 +8509,28 @@ const wbi_sign = async (BASEURL, cookie) => {
|
|
|
8430
8509
|
* @param requestConfig - 外部请求配置(优先级最高)
|
|
8431
8510
|
* @returns 返回B站数据
|
|
8432
8511
|
*/
|
|
8433
|
-
const fetchBilibili = async (data
|
|
8512
|
+
const fetchBilibili = async (data, cookie, requestConfig) => {
|
|
8434
8513
|
const baseRequestConfig = getBilibiliDefaultConfig(cookie, requestConfig);
|
|
8435
|
-
switch (data
|
|
8436
|
-
case "videoInfo": return await GlobalGetData(data
|
|
8514
|
+
switch (data.methodType) {
|
|
8515
|
+
case "videoInfo": return await GlobalGetData(data.methodType, {
|
|
8437
8516
|
...baseRequestConfig,
|
|
8438
|
-
url: bilibiliApiUrls.getVideoInfo({ bvid: data
|
|
8517
|
+
url: bilibiliApiUrls.getVideoInfo({ bvid: data.bvid })
|
|
8439
8518
|
});
|
|
8440
8519
|
case "videoStream": {
|
|
8441
8520
|
const sign = await qtparam(bilibiliApiUrls.getVideoStream({
|
|
8442
|
-
avid: data
|
|
8443
|
-
cid: data
|
|
8521
|
+
avid: data.avid,
|
|
8522
|
+
cid: data.cid
|
|
8444
8523
|
}), baseRequestConfig.headers?.Cookie);
|
|
8445
|
-
return await GlobalGetData(data
|
|
8524
|
+
return await GlobalGetData(data.methodType, {
|
|
8446
8525
|
...baseRequestConfig,
|
|
8447
8526
|
url: bilibiliApiUrls.getVideoStream({
|
|
8448
|
-
avid: data
|
|
8449
|
-
cid: data
|
|
8527
|
+
avid: data.avid,
|
|
8528
|
+
cid: data.cid
|
|
8450
8529
|
}) + sign.QUERY
|
|
8451
8530
|
});
|
|
8452
8531
|
}
|
|
8453
8532
|
case "comments": {
|
|
8454
|
-
let { oid, number, type, mode, pagination_str, plat, seek_rpid, web_location } = data
|
|
8533
|
+
let { oid, number, type, mode, pagination_str, plat, seek_rpid, web_location } = data;
|
|
8455
8534
|
let fetchedComments = [];
|
|
8456
8535
|
const maxRequestCount = 100;
|
|
8457
8536
|
let requestCount = 0;
|
|
@@ -8462,11 +8541,11 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8462
8541
|
oid,
|
|
8463
8542
|
type
|
|
8464
8543
|
});
|
|
8465
|
-
if ((await GlobalGetData(data
|
|
8544
|
+
if ((await GlobalGetData(data.methodType, {
|
|
8466
8545
|
...baseRequestConfig,
|
|
8467
8546
|
url: checkStatusUrl
|
|
8468
8547
|
})).data === null) {
|
|
8469
|
-
|
|
8548
|
+
emitLogError("评论区未开放");
|
|
8470
8549
|
return {
|
|
8471
8550
|
code: 404,
|
|
8472
8551
|
message: "评论区未开放",
|
|
@@ -8484,7 +8563,7 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8484
8563
|
web_location: web_location ?? "1315875"
|
|
8485
8564
|
});
|
|
8486
8565
|
const finalUrl = baseUrl + await wbi_sign(baseUrl, baseRequestConfig.headers?.cookie);
|
|
8487
|
-
const response = await GlobalGetData(data
|
|
8566
|
+
const response = await GlobalGetData(data.methodType, {
|
|
8488
8567
|
...baseRequestConfig,
|
|
8489
8568
|
url: finalUrl
|
|
8490
8569
|
});
|
|
@@ -8497,7 +8576,7 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8497
8576
|
} else isEnd = true;
|
|
8498
8577
|
requestCount++;
|
|
8499
8578
|
if (isEnd || currentComments.length === 0 || !nextPaginationStr) {
|
|
8500
|
-
|
|
8579
|
+
emitLogInfo("已到达评论末尾或无更多评论");
|
|
8501
8580
|
break;
|
|
8502
8581
|
}
|
|
8503
8582
|
}
|
|
@@ -8505,43 +8584,43 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8505
8584
|
...tmpresp,
|
|
8506
8585
|
data: {
|
|
8507
8586
|
...tmpresp.data,
|
|
8508
|
-
replies: Array.from(new Map(fetchedComments.map((item) => [item.rpid, item])).values()).slice(0, Number(data
|
|
8587
|
+
replies: Array.from(new Map(fetchedComments.map((item) => [item.rpid, item])).values()).slice(0, Number(data.number ?? 20))
|
|
8509
8588
|
}
|
|
8510
8589
|
};
|
|
8511
8590
|
}
|
|
8512
|
-
case "commentReplies": return await GlobalGetData(data
|
|
8591
|
+
case "commentReplies": return await GlobalGetData(data.methodType, {
|
|
8513
8592
|
...baseRequestConfig,
|
|
8514
|
-
url: bilibiliApiUrls.getCommentReplies(data
|
|
8593
|
+
url: bilibiliApiUrls.getCommentReplies(data)
|
|
8515
8594
|
});
|
|
8516
|
-
case "emojiList": return await GlobalGetData(data
|
|
8595
|
+
case "emojiList": return await GlobalGetData(data.methodType, {
|
|
8517
8596
|
...baseRequestConfig,
|
|
8518
8597
|
url: bilibiliApiUrls.getEmojiList()
|
|
8519
8598
|
});
|
|
8520
8599
|
case "bangumiInfo": {
|
|
8521
|
-
let id = data
|
|
8600
|
+
let id = data.ep_id ?? data.season_id;
|
|
8522
8601
|
if (!id) return false;
|
|
8523
8602
|
const idType = id ? id.startsWith("ep") ? "ep_id" : "season_id" : "ep_id";
|
|
8524
8603
|
const newId = idType === "ep_id" ? id.replace("ep", "") : id.replace("ss", "");
|
|
8525
|
-
return await GlobalGetData(data
|
|
8604
|
+
return await GlobalGetData(data.methodType, {
|
|
8526
8605
|
...baseRequestConfig,
|
|
8527
8606
|
url: bilibiliApiUrls.getBangumiInfo({ [idType]: newId })
|
|
8528
8607
|
});
|
|
8529
8608
|
}
|
|
8530
8609
|
case "bangumiStream": {
|
|
8531
8610
|
const sign = await qtparam(bilibiliApiUrls.getBangumiStream({
|
|
8532
|
-
cid: data
|
|
8533
|
-
ep_id: data
|
|
8611
|
+
cid: data.cid,
|
|
8612
|
+
ep_id: data.ep_id.replace("ep", "")
|
|
8534
8613
|
}), baseRequestConfig.headers?.cookie);
|
|
8535
|
-
return await GlobalGetData(data
|
|
8614
|
+
return await GlobalGetData(data.methodType, {
|
|
8536
8615
|
...baseRequestConfig,
|
|
8537
8616
|
url: bilibiliApiUrls.getBangumiStream({
|
|
8538
|
-
cid: data
|
|
8539
|
-
ep_id: data
|
|
8617
|
+
cid: data.cid,
|
|
8618
|
+
ep_id: data.ep_id.replace("ep", "")
|
|
8540
8619
|
}) + sign.QUERY
|
|
8541
8620
|
});
|
|
8542
8621
|
}
|
|
8543
8622
|
case "userDynamicList": {
|
|
8544
|
-
const { host_mid } = data
|
|
8623
|
+
const { host_mid } = data;
|
|
8545
8624
|
const hasExternalReferer = requestConfig?.headers && ("referer" in requestConfig.headers || "Referer" in requestConfig.headers);
|
|
8546
8625
|
const customHeaders = {
|
|
8547
8626
|
...baseRequestConfig.headers,
|
|
@@ -8549,7 +8628,7 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8549
8628
|
...!hasExternalReferer && { Referer: `https://space.bilibili.com/${host_mid}/dynamic` }
|
|
8550
8629
|
};
|
|
8551
8630
|
const wbiSignQuery = await wbi_sign(bilibiliApiUrls.getUserDynamicList({ host_mid }), baseRequestConfig.headers?.cookie);
|
|
8552
|
-
return await GlobalGetData(data
|
|
8631
|
+
return await GlobalGetData(data.methodType, {
|
|
8553
8632
|
...baseRequestConfig,
|
|
8554
8633
|
headers: customHeaders,
|
|
8555
8634
|
url: bilibiliApiUrls.getUserDynamicList({ host_mid }) + wbiSignQuery
|
|
@@ -8561,55 +8640,48 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8561
8640
|
...baseRequestConfig.headers,
|
|
8562
8641
|
...!hasExternalReferer && { Referer: void 0 }
|
|
8563
8642
|
};
|
|
8564
|
-
return await GlobalGetData(data
|
|
8565
|
-
...baseRequestConfig,
|
|
8566
|
-
headers: customHeaders,
|
|
8567
|
-
url: bilibiliApiUrls.getDynamicDetail({ dynamic_id: data$1.dynamic_id })
|
|
8568
|
-
});
|
|
8569
|
-
}
|
|
8570
|
-
case "dynamicCard": {
|
|
8571
|
-
const { dynamic_id } = data$1;
|
|
8572
|
-
const hasExternalReferer = requestConfig?.headers && "referer" in requestConfig.headers;
|
|
8573
|
-
const customHeaders = {
|
|
8574
|
-
...baseRequestConfig.headers,
|
|
8575
|
-
...!hasExternalReferer && { Referer: void 0 }
|
|
8576
|
-
};
|
|
8577
|
-
return await GlobalGetData(data$1.methodType, {
|
|
8643
|
+
return await GlobalGetData(data.methodType, {
|
|
8578
8644
|
...baseRequestConfig,
|
|
8579
8645
|
headers: customHeaders,
|
|
8580
|
-
url: bilibiliApiUrls.
|
|
8646
|
+
url: bilibiliApiUrls.getDynamicDetail({ dynamic_id: data.dynamic_id })
|
|
8581
8647
|
});
|
|
8582
8648
|
}
|
|
8649
|
+
case "dynamicCard": return {
|
|
8650
|
+
code: -404,
|
|
8651
|
+
message: "接口已停用:B站官方已于 `2025-08-09` 删除 dynamic_svr 接口,fetchDynamicCard 方法已废弃,调用讲返回错误信息",
|
|
8652
|
+
ttl: 1,
|
|
8653
|
+
data: null
|
|
8654
|
+
};
|
|
8583
8655
|
case "userCard": {
|
|
8584
|
-
const { host_mid } = data
|
|
8585
|
-
return await GlobalGetData(data
|
|
8656
|
+
const { host_mid } = data;
|
|
8657
|
+
return await GlobalGetData(data.methodType, {
|
|
8586
8658
|
...baseRequestConfig,
|
|
8587
8659
|
url: bilibiliApiUrls.getUserCard({ host_mid })
|
|
8588
8660
|
});
|
|
8589
8661
|
}
|
|
8590
8662
|
case "userSpaceInfo": {
|
|
8591
|
-
const wbiSignQuery = await wbi_sign(bilibiliApiUrls.getUserSpaceInfo({ host_mid: data
|
|
8592
|
-
return await GlobalGetData(data
|
|
8663
|
+
const wbiSignQuery = await wbi_sign(bilibiliApiUrls.getUserSpaceInfo({ host_mid: data.host_mid }), baseRequestConfig.headers?.cookie);
|
|
8664
|
+
return await GlobalGetData(data.methodType, {
|
|
8593
8665
|
...baseRequestConfig,
|
|
8594
|
-
url: bilibiliApiUrls.getUserSpaceInfo({ host_mid: data
|
|
8666
|
+
url: bilibiliApiUrls.getUserSpaceInfo({ host_mid: data.host_mid }) + wbiSignQuery
|
|
8595
8667
|
});
|
|
8596
8668
|
}
|
|
8597
|
-
case "liveRoomInfo": return await GlobalGetData(data
|
|
8669
|
+
case "liveRoomInfo": return await GlobalGetData(data.methodType, {
|
|
8598
8670
|
...baseRequestConfig,
|
|
8599
|
-
url: bilibiliApiUrls.getLiveRoomInfo({ room_id: data
|
|
8671
|
+
url: bilibiliApiUrls.getLiveRoomInfo({ room_id: data.room_id })
|
|
8600
8672
|
});
|
|
8601
|
-
case "liveRoomInit": return await GlobalGetData(data
|
|
8673
|
+
case "liveRoomInit": return await GlobalGetData(data.methodType, {
|
|
8602
8674
|
...baseRequestConfig,
|
|
8603
|
-
url: bilibiliApiUrls.getLiveRoomInit({ room_id: data
|
|
8675
|
+
url: bilibiliApiUrls.getLiveRoomInit({ room_id: data.room_id })
|
|
8604
8676
|
});
|
|
8605
|
-
case "loginQrcode": return await GlobalGetData(data
|
|
8677
|
+
case "loginQrcode": return await GlobalGetData(data.methodType, {
|
|
8606
8678
|
...baseRequestConfig,
|
|
8607
8679
|
url: bilibiliApiUrls.getLoginQrcode()
|
|
8608
8680
|
});
|
|
8609
8681
|
case "qrcodeStatus": try {
|
|
8610
8682
|
const result = await getHeadersAndData({
|
|
8611
8683
|
...baseRequestConfig,
|
|
8612
|
-
url: bilibiliApiUrls.getQrcodeStatus({ qrcode_key: data
|
|
8684
|
+
url: bilibiliApiUrls.getQrcodeStatus({ qrcode_key: data.qrcode_key })
|
|
8613
8685
|
});
|
|
8614
8686
|
if (isNetworkErrorResult(result)) {
|
|
8615
8687
|
const networkError = new Error(result.error.amagiError.errorDescription);
|
|
@@ -8618,7 +8690,7 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8618
8690
|
data: null,
|
|
8619
8691
|
amagiError: {
|
|
8620
8692
|
...result.error.amagiError,
|
|
8621
|
-
requestType: data
|
|
8693
|
+
requestType: data.methodType
|
|
8622
8694
|
}
|
|
8623
8695
|
});
|
|
8624
8696
|
throw networkError;
|
|
@@ -8626,8 +8698,8 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8626
8698
|
if (result.data.code !== 0) {
|
|
8627
8699
|
const Err = {
|
|
8628
8700
|
errorDescription: `获取响应数据失败!原因:${bilibiliErrorCodeMap[String(result.data.code)] || result.data.message || "未知错误"}!`,
|
|
8629
|
-
requestType: data
|
|
8630
|
-
requestUrl: bilibiliApiUrls.getQrcodeStatus({ qrcode_key: data
|
|
8701
|
+
requestType: data.methodType,
|
|
8702
|
+
requestUrl: bilibiliApiUrls.getQrcodeStatus({ qrcode_key: data.qrcode_key })
|
|
8631
8703
|
};
|
|
8632
8704
|
return {
|
|
8633
8705
|
code: result.data.code,
|
|
@@ -8646,65 +8718,65 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8646
8718
|
} catch (error) {
|
|
8647
8719
|
if (error && typeof error === "object") return error;
|
|
8648
8720
|
return {
|
|
8649
|
-
code:
|
|
8721
|
+
code: "UNKNOWN_ERROR",
|
|
8650
8722
|
data: error.data,
|
|
8651
8723
|
amagiError: {
|
|
8652
8724
|
errorDescription: "未知错误",
|
|
8653
|
-
requestType: data
|
|
8654
|
-
requestUrl: bilibiliApiUrls.getQrcodeStatus({ qrcode_key: data
|
|
8725
|
+
requestType: data.methodType,
|
|
8726
|
+
requestUrl: bilibiliApiUrls.getQrcodeStatus({ qrcode_key: data.qrcode_key })
|
|
8655
8727
|
}
|
|
8656
8728
|
};
|
|
8657
8729
|
}
|
|
8658
|
-
case "loginStatus": return await GlobalGetData(data
|
|
8730
|
+
case "loginStatus": return await GlobalGetData(data.methodType, {
|
|
8659
8731
|
...baseRequestConfig,
|
|
8660
8732
|
url: bilibiliApiUrls.getLoginStatus()
|
|
8661
8733
|
});
|
|
8662
|
-
case "uploaderTotalViews": return await GlobalGetData(data
|
|
8734
|
+
case "uploaderTotalViews": return await GlobalGetData(data.methodType, {
|
|
8663
8735
|
...baseRequestConfig,
|
|
8664
|
-
url: bilibiliApiUrls.getUploaderTotalViews({ host_mid: data
|
|
8736
|
+
url: bilibiliApiUrls.getUploaderTotalViews({ host_mid: data.host_mid })
|
|
8665
8737
|
});
|
|
8666
8738
|
case "avToBv": return {
|
|
8667
8739
|
code: 0,
|
|
8668
8740
|
message: "success",
|
|
8669
|
-
data: { bvid: av2bv(Number(data
|
|
8741
|
+
data: { bvid: av2bv(Number(data.avid.toString().replace(/^av/i, ""))) }
|
|
8670
8742
|
};
|
|
8671
8743
|
case "bvToAv": return {
|
|
8672
8744
|
code: 0,
|
|
8673
8745
|
message: "success",
|
|
8674
|
-
data: { aid: "av" + bv2av(data
|
|
8746
|
+
data: { aid: "av" + bv2av(data.bvid) }
|
|
8675
8747
|
};
|
|
8676
|
-
case "articleContent": return await GlobalGetData(data
|
|
8748
|
+
case "articleContent": return await GlobalGetData(data.methodType, {
|
|
8677
8749
|
...baseRequestConfig,
|
|
8678
|
-
url: bilibiliApiUrls.getArticleContent({ id: data
|
|
8750
|
+
url: bilibiliApiUrls.getArticleContent({ id: data.id })
|
|
8679
8751
|
});
|
|
8680
|
-
case "articleCards": return await GlobalGetData(data
|
|
8752
|
+
case "articleCards": return await GlobalGetData(data.methodType, {
|
|
8681
8753
|
...baseRequestConfig,
|
|
8682
|
-
url: bilibiliApiUrls.getArticleCards({ ids: data
|
|
8754
|
+
url: bilibiliApiUrls.getArticleCards({ ids: data.ids })
|
|
8683
8755
|
});
|
|
8684
|
-
case "articleInfo": return await GlobalGetData(data
|
|
8756
|
+
case "articleInfo": return await GlobalGetData(data.methodType, {
|
|
8685
8757
|
...baseRequestConfig,
|
|
8686
|
-
url: bilibiliApiUrls.getArticleInfo({ id: data
|
|
8758
|
+
url: bilibiliApiUrls.getArticleInfo({ id: data.id })
|
|
8687
8759
|
});
|
|
8688
|
-
case "articleListInfo": return await GlobalGetData(data
|
|
8760
|
+
case "articleListInfo": return await GlobalGetData(data.methodType, {
|
|
8689
8761
|
...baseRequestConfig,
|
|
8690
|
-
url: bilibiliApiUrls.getArticleListInfo({ id: data
|
|
8762
|
+
url: bilibiliApiUrls.getArticleListInfo({ id: data.id })
|
|
8691
8763
|
});
|
|
8692
|
-
case "captchaFromVoucher": return await GlobalGetData(data
|
|
8764
|
+
case "captchaFromVoucher": return await GlobalGetData(data.methodType, {
|
|
8693
8765
|
...baseRequestConfig,
|
|
8694
8766
|
method: "POST",
|
|
8695
|
-
url: bilibiliApiUrls.getCaptchaFromVoucher(data
|
|
8696
|
-
data: bilibiliApiUrls.getCaptchaFromVoucher(data
|
|
8767
|
+
url: bilibiliApiUrls.getCaptchaFromVoucher(data).Url,
|
|
8768
|
+
data: bilibiliApiUrls.getCaptchaFromVoucher(data).Body
|
|
8697
8769
|
});
|
|
8698
|
-
case "validateCaptcha": return await GlobalGetData(data
|
|
8770
|
+
case "validateCaptcha": return await GlobalGetData(data.methodType, {
|
|
8699
8771
|
...baseRequestConfig,
|
|
8700
8772
|
method: "POST",
|
|
8701
|
-
url: bilibiliApiUrls.validateCaptcha(data
|
|
8702
|
-
data: bilibiliApiUrls.validateCaptcha(data
|
|
8773
|
+
url: bilibiliApiUrls.validateCaptcha(data).Url,
|
|
8774
|
+
data: bilibiliApiUrls.validateCaptcha(data).Body
|
|
8703
8775
|
});
|
|
8704
8776
|
case "videoDanmaku": {
|
|
8705
8777
|
const url = bilibiliApiUrls.getVideoDanmaku({
|
|
8706
|
-
cid: data
|
|
8707
|
-
segment_index: data
|
|
8778
|
+
cid: data.cid,
|
|
8779
|
+
segment_index: data.segment_index
|
|
8708
8780
|
});
|
|
8709
8781
|
try {
|
|
8710
8782
|
const response = await fetchData({
|
|
@@ -8719,7 +8791,7 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8719
8791
|
data: null,
|
|
8720
8792
|
amagiError: {
|
|
8721
8793
|
...response.error.amagiError,
|
|
8722
|
-
requestType: data
|
|
8794
|
+
requestType: data.methodType
|
|
8723
8795
|
}
|
|
8724
8796
|
});
|
|
8725
8797
|
throw networkError;
|
|
@@ -8731,20 +8803,19 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8731
8803
|
};
|
|
8732
8804
|
} catch (error) {
|
|
8733
8805
|
if (error && typeof error === "object" && "code" in error) return error;
|
|
8734
|
-
const Err = {
|
|
8735
|
-
errorDescription: `获取弹幕数据失败:${error instanceof Error ? error.message : "未知错误"}`,
|
|
8736
|
-
requestType: data$1.methodType,
|
|
8737
|
-
requestUrl: url
|
|
8738
|
-
};
|
|
8739
8806
|
return {
|
|
8740
|
-
code:
|
|
8807
|
+
code: "UNKNOWN_ERROR",
|
|
8741
8808
|
data: null,
|
|
8742
|
-
amagiError:
|
|
8809
|
+
amagiError: {
|
|
8810
|
+
errorDescription: `获取弹幕数据失败:${error instanceof Error ? error.message : "未知错误"}`,
|
|
8811
|
+
requestType: data.methodType,
|
|
8812
|
+
requestUrl: url
|
|
8813
|
+
}
|
|
8743
8814
|
};
|
|
8744
8815
|
}
|
|
8745
8816
|
}
|
|
8746
8817
|
default:
|
|
8747
|
-
|
|
8818
|
+
emitLogWarn(`未知的B站数据接口:「${data.methodType}」`);
|
|
8748
8819
|
return null;
|
|
8749
8820
|
}
|
|
8750
8821
|
};
|
|
@@ -8780,22 +8851,25 @@ const GlobalGetData = async (type, options, retryCount = 0) => {
|
|
|
8780
8851
|
requestUrl: options.url
|
|
8781
8852
|
};
|
|
8782
8853
|
warningMessage = `
|
|
8783
|
-
|
|
8854
|
+
获取响应数据失败!原因:接口返回内容为空,你的B站ck可能已经失效!
|
|
8784
8855
|
请求类型:「${type}」
|
|
8785
8856
|
请求URL:${options.url}
|
|
8786
8857
|
`;
|
|
8787
|
-
|
|
8858
|
+
emitLogWarn(warningMessage);
|
|
8788
8859
|
const riskError = new Error(Err.errorDescription);
|
|
8789
8860
|
Object.assign(riskError, {
|
|
8790
|
-
code:
|
|
8861
|
+
code: "-352",
|
|
8791
8862
|
data: result,
|
|
8792
8863
|
amagiError: Err
|
|
8793
8864
|
});
|
|
8794
8865
|
throw riskError;
|
|
8795
8866
|
}
|
|
8796
|
-
|
|
8867
|
+
const payload = "data" in result ? result.data : "result" in result ? result.result : void 0;
|
|
8868
|
+
const hasPayload = payload !== null && payload !== void 0;
|
|
8869
|
+
const isEmptyObjectPayload = typeof payload === "object" && !Array.isArray(payload) && Object.keys(payload).length === 0;
|
|
8870
|
+
if (result.code !== 0 || !hasPayload || isEmptyObjectPayload) {
|
|
8797
8871
|
if (result.code === -412 && retryCount < MAX_RETRIES) return await GlobalGetData(type, options, retryCount + 1);
|
|
8798
|
-
const errorMessage = bilibiliErrorCodeMap[result.code] ||
|
|
8872
|
+
const errorMessage = bilibiliErrorCodeMap[result.code] || isEmptyObjectPayload && "请求成功但无返回内容" || (result.message ?? "未知错误");
|
|
8799
8873
|
const Err = {
|
|
8800
8874
|
errorDescription: `获取响应数据失败!原因:${errorMessage}!`,
|
|
8801
8875
|
requestType: type ?? "未知请求类型",
|
|
@@ -8803,12 +8877,12 @@ const GlobalGetData = async (type, options, retryCount = 0) => {
|
|
|
8803
8877
|
responseCode: result.code
|
|
8804
8878
|
};
|
|
8805
8879
|
warningMessage = `
|
|
8806
|
-
获取响应数据失败!原因:${
|
|
8880
|
+
获取响应数据失败!原因:${errorMessage}
|
|
8807
8881
|
错误代码:${result.code}
|
|
8808
8882
|
请求类型:「${type}」
|
|
8809
8883
|
请求URL:${options.url}
|
|
8810
8884
|
`;
|
|
8811
|
-
|
|
8885
|
+
emitLogWarn(warningMessage);
|
|
8812
8886
|
const apiError = new Error(Err.errorDescription);
|
|
8813
8887
|
Object.assign(apiError, {
|
|
8814
8888
|
code: result.code,
|
|
@@ -8824,7 +8898,7 @@ const GlobalGetData = async (type, options, retryCount = 0) => {
|
|
|
8824
8898
|
amagiMessage: warningMessage
|
|
8825
8899
|
};
|
|
8826
8900
|
return {
|
|
8827
|
-
code:
|
|
8901
|
+
code: "UNKNOWN_ERROR",
|
|
8828
8902
|
data: error.data,
|
|
8829
8903
|
amagiError: {
|
|
8830
8904
|
errorDescription: "未知错误",
|
|
@@ -8891,7 +8965,6 @@ const bilibiliErrorCodeMap = {
|
|
|
8891
8965
|
1e5: "验证码获取失败",
|
|
8892
8966
|
100003: "验证码过期"
|
|
8893
8967
|
};
|
|
8894
|
-
|
|
8895
8968
|
//#endregion
|
|
8896
8969
|
//#region src/utils/errors.ts
|
|
8897
8970
|
/**
|
|
@@ -8973,7 +9046,6 @@ const handleError = (error, requestPath) => {
|
|
|
8973
9046
|
requestPath
|
|
8974
9047
|
};
|
|
8975
9048
|
};
|
|
8976
|
-
|
|
8977
9049
|
//#endregion
|
|
8978
9050
|
//#region src/middleware/validation.ts
|
|
8979
9051
|
/**
|
|
@@ -9020,7 +9092,6 @@ const createKuaishouValidationMiddleware = (methodType) => createValidationMiddl
|
|
|
9020
9092
|
* @returns Express中间件函数
|
|
9021
9093
|
*/
|
|
9022
9094
|
const createXiaohongshuValidationMiddleware = (methodType) => createValidationMiddleware(validateXiaohongshuParams, methodType);
|
|
9023
|
-
|
|
9024
9095
|
//#endregion
|
|
9025
9096
|
//#region src/platform/bilibili/routes.ts
|
|
9026
9097
|
/**
|
|
@@ -9068,7 +9139,6 @@ const createBilibiliRoutes = (cookie, requestConfig = getBilibiliDefaultConfig(c
|
|
|
9068
9139
|
for (const [method, path] of Object.entries(BilibiliMethodRoutes)) router.get(path, createBilibiliValidationMiddleware(method), createBilibiliRouteHandler(method, cookie, requestConfig));
|
|
9069
9140
|
return router;
|
|
9070
9141
|
};
|
|
9071
|
-
|
|
9072
9142
|
//#endregion
|
|
9073
9143
|
//#region src/platform/bilibili/index.ts
|
|
9074
9144
|
/** B站相关功能模块 (工具集) */
|
|
@@ -9082,7 +9152,6 @@ const bilibiliUtils = {
|
|
|
9082
9152
|
bilibiliApiUrls,
|
|
9083
9153
|
api: bilibili
|
|
9084
9154
|
};
|
|
9085
|
-
|
|
9086
9155
|
//#endregion
|
|
9087
9156
|
//#region src/platform/douyin/DouyinApi.ts
|
|
9088
9157
|
/**
|
|
@@ -9100,22 +9169,39 @@ const createDeprecatedStub$2 = (methodName) => {
|
|
|
9100
9169
|
* @deprecated v6 已废弃,请使用 douyinFetcher 或 client.douyin.fetcher 替代
|
|
9101
9170
|
*/
|
|
9102
9171
|
const douyin = {
|
|
9172
|
+
/** @deprecated 请使用 douyinFetcher.fetchTextWork 替代 */
|
|
9103
9173
|
getTextWorkInfo: createDeprecatedStub$2("getTextWorkInfo"),
|
|
9174
|
+
/** @deprecated 请使用 douyinFetcher.parseWork 替代 */
|
|
9104
9175
|
getWorkInfo: createDeprecatedStub$2("getWorkInfo"),
|
|
9176
|
+
/** @deprecated 请使用 douyinFetcher.fetchVideoWork 替代 */
|
|
9105
9177
|
getVideoWorkInfo: createDeprecatedStub$2("getVideoWorkInfo"),
|
|
9178
|
+
/** @deprecated 请使用 douyinFetcher.fetchImageAlbumWork 替代 */
|
|
9106
9179
|
getImageAlbumWorkInfo: createDeprecatedStub$2("getImageAlbumWorkInfo"),
|
|
9180
|
+
/** @deprecated 请使用 douyinFetcher.fetchSlidesWork 替代 */
|
|
9107
9181
|
getSlidesWorkInfo: createDeprecatedStub$2("getSlidesWorkInfo"),
|
|
9182
|
+
/** @deprecated 请使用 douyinFetcher.fetchComments 替代 */
|
|
9108
9183
|
getComments: createDeprecatedStub$2("getComments"),
|
|
9184
|
+
/** @deprecated 请使用 douyinFetcher.fetchCommentReplies 替代 */
|
|
9109
9185
|
getCommentReplies: createDeprecatedStub$2("getCommentReplies"),
|
|
9186
|
+
/** @deprecated 请使用 douyinFetcher.fetchUserProfile 替代 */
|
|
9110
9187
|
getUserProfile: createDeprecatedStub$2("getUserProfile"),
|
|
9188
|
+
/** @deprecated 请使用 douyinFetcher.fetchEmojiList 替代 */
|
|
9111
9189
|
getEmojiList: createDeprecatedStub$2("getEmojiList"),
|
|
9190
|
+
/** @deprecated 请使用 douyinFetcher.fetchDynamicEmojiList 替代 */
|
|
9112
9191
|
getEmojiProList: createDeprecatedStub$2("getEmojiProList"),
|
|
9192
|
+
/** @deprecated 请使用 douyinFetcher.fetchUserVideoList 替代 */
|
|
9113
9193
|
getUserVideos: createDeprecatedStub$2("getUserVideos"),
|
|
9194
|
+
/** @deprecated 请使用 douyinFetcher.fetchMusicInfo 替代 */
|
|
9114
9195
|
getMusicInfo: createDeprecatedStub$2("getMusicInfo"),
|
|
9196
|
+
/** @deprecated 请使用 douyinFetcher.fetchSuggestWords 替代 */
|
|
9115
9197
|
getSuggestWords: createDeprecatedStub$2("getSuggestWords"),
|
|
9198
|
+
/** @deprecated 请使用 douyinFetcher.searchContent 替代 */
|
|
9116
9199
|
search: createDeprecatedStub$2("search"),
|
|
9200
|
+
/** @deprecated 请使用 douyinFetcher.fetchLiveRoomInfo 替代 */
|
|
9117
9201
|
getLiveRoomInfo: createDeprecatedStub$2("getLiveRoomInfo"),
|
|
9202
|
+
/** @deprecated 请使用 douyinFetcher.fetchDanmakuList 替代 */
|
|
9118
9203
|
getDanmaku: createDeprecatedStub$2("getDanmaku"),
|
|
9204
|
+
/** @deprecated 请使用 douyinFetcher 的具体方法替代 */
|
|
9119
9205
|
invoke: createDeprecatedStub$2("invoke")
|
|
9120
9206
|
};
|
|
9121
9207
|
/**
|
|
@@ -9129,7 +9215,6 @@ const createBoundDouyinApi = (_cookie, _requestConfig) => {
|
|
|
9129
9215
|
getSearchData: createDeprecatedStub$2("getSearchData")
|
|
9130
9216
|
};
|
|
9131
9217
|
};
|
|
9132
|
-
|
|
9133
9218
|
//#endregion
|
|
9134
9219
|
//#region src/platform/douyin/routes.ts
|
|
9135
9220
|
/**
|
|
@@ -9177,7 +9262,6 @@ const createDouyinRoutes = (cookie, requestConfig = getDouyinDefaultConfig(cooki
|
|
|
9177
9262
|
for (const [method, path] of Object.entries(DouyinMethodRoutes)) router.get(path, createDouyinValidationMiddleware(method), createDouyinRouteHandler(method, cookie, requestConfig));
|
|
9178
9263
|
return router;
|
|
9179
9264
|
};
|
|
9180
|
-
|
|
9181
9265
|
//#endregion
|
|
9182
9266
|
//#region src/platform/douyin/index.ts
|
|
9183
9267
|
/** 抖音相关功能模块 (工具集) */
|
|
@@ -9186,7 +9270,6 @@ const douyinUtils = {
|
|
|
9186
9270
|
douyinApiUrls,
|
|
9187
9271
|
api: douyin
|
|
9188
9272
|
};
|
|
9189
|
-
|
|
9190
9273
|
//#endregion
|
|
9191
9274
|
//#region src/platform/kuaishou/KuaishouApi.ts
|
|
9192
9275
|
/**
|
|
@@ -9204,11 +9287,17 @@ const createDeprecatedStub$1 = (methodName) => {
|
|
|
9204
9287
|
* @deprecated v6 已废弃,请使用 kuaishouFetcher 或 client.kuaishou.fetcher 替代
|
|
9205
9288
|
*/
|
|
9206
9289
|
const kuaishou = {
|
|
9290
|
+
/** @deprecated 请使用 kuaishouFetcher.fetchVideoWork 替代 */
|
|
9207
9291
|
getWorkInfo: createDeprecatedStub$1("getWorkInfo"),
|
|
9292
|
+
/** @deprecated 请使用 kuaishouFetcher.fetchWorkComments 替代 */
|
|
9208
9293
|
getComments: createDeprecatedStub$1("getComments"),
|
|
9294
|
+
/** @deprecated 请使用 kuaishouFetcher.fetchUserProfile 替代 */
|
|
9209
9295
|
getUserProfile: createDeprecatedStub$1("getUserProfile"),
|
|
9296
|
+
/** @deprecated 请使用 kuaishouFetcher.fetchUserWorkList 替代 */
|
|
9210
9297
|
getUserWorkList: createDeprecatedStub$1("getUserWorkList"),
|
|
9298
|
+
/** @deprecated 请使用 kuaishouFetcher.fetchLiveRoomInfo 替代 */
|
|
9211
9299
|
getLiveRoomInfo: createDeprecatedStub$1("getLiveRoomInfo"),
|
|
9300
|
+
/** @deprecated 请使用 kuaishouFetcher.fetchEmojiList 替代 */
|
|
9212
9301
|
getEmojiList: createDeprecatedStub$1("getEmojiList")
|
|
9213
9302
|
};
|
|
9214
9303
|
/**
|
|
@@ -9219,7 +9308,6 @@ const kuaishou = {
|
|
|
9219
9308
|
const createBoundKuaishouApi = (_cookie, _requestConfig) => {
|
|
9220
9309
|
return { ...kuaishou };
|
|
9221
9310
|
};
|
|
9222
|
-
|
|
9223
9311
|
//#endregion
|
|
9224
9312
|
//#region src/platform/kuaishou/routes.ts
|
|
9225
9313
|
/**
|
|
@@ -9267,7 +9355,6 @@ const createKuaishouRoutes = (cookie, requestConfig = getKuaishouDefaultConfig(c
|
|
|
9267
9355
|
for (const [method, path] of Object.entries(KuaishouMethodRoutes)) router.get(path, createKuaishouValidationMiddleware(method), createKuaishouRouteHandler(method, cookie, requestConfig));
|
|
9268
9356
|
return router;
|
|
9269
9357
|
};
|
|
9270
|
-
|
|
9271
9358
|
//#endregion
|
|
9272
9359
|
//#region src/platform/kuaishou/index.ts
|
|
9273
9360
|
/** 快手相关功能模块 (工具集) */
|
|
@@ -9276,19 +9363,9 @@ const kuaishouUtils = {
|
|
|
9276
9363
|
kuaishouApiUrls,
|
|
9277
9364
|
api: kuaishou
|
|
9278
9365
|
};
|
|
9279
|
-
|
|
9280
9366
|
//#endregion
|
|
9281
9367
|
//#region src/platform/xiaohongshu/XiaohongshuApi.ts
|
|
9282
9368
|
/**
|
|
9283
|
-
* 小红书 API 模块 (已废弃)
|
|
9284
|
-
*
|
|
9285
|
-
* 此模块中的 API 已在 v6 版本废弃
|
|
9286
|
-
* 请使用 xiaohongshuFetcher 或 client.xiaohongshu.fetcher 替代
|
|
9287
|
-
*
|
|
9288
|
-
* @module platform/xiaohongshu/XiaohongshuApi
|
|
9289
|
-
* @deprecated v6 已废弃,请使用 fetcher API 替代
|
|
9290
|
-
*/
|
|
9291
|
-
/**
|
|
9292
9369
|
* 创建废弃的 API 存根函数
|
|
9293
9370
|
*/
|
|
9294
9371
|
const createDeprecatedStub = (methodName) => {
|
|
@@ -9303,12 +9380,19 @@ const createDeprecatedStub = (methodName) => {
|
|
|
9303
9380
|
* @deprecated v6 已废弃,请使用 xiaohongshuFetcher 或 client.xiaohongshu.fetcher 替代
|
|
9304
9381
|
*/
|
|
9305
9382
|
const xiaohongshu = {
|
|
9383
|
+
/** @deprecated 请使用 xiaohongshuFetcher.fetchHomeFeed 替代 */
|
|
9306
9384
|
getHomeFeed: createDeprecatedStub("getHomeFeed"),
|
|
9385
|
+
/** @deprecated 请使用 xiaohongshuFetcher.fetchNoteDetail 替代 */
|
|
9307
9386
|
getNote: createDeprecatedStub("getNote"),
|
|
9387
|
+
/** @deprecated 请使用 xiaohongshuFetcher.fetchNoteComments 替代 */
|
|
9308
9388
|
getComments: createDeprecatedStub("getComments"),
|
|
9389
|
+
/** @deprecated 请使用 xiaohongshuFetcher.fetchUserProfile 替代 */
|
|
9309
9390
|
getUser: createDeprecatedStub("getUser"),
|
|
9391
|
+
/** @deprecated 请使用 xiaohongshuFetcher.fetchUserNoteList 替代 */
|
|
9310
9392
|
getUserNotes: createDeprecatedStub("getUserNotes"),
|
|
9393
|
+
/** @deprecated 请使用 xiaohongshuFetcher.searchNotes 替代 */
|
|
9311
9394
|
getSearchNotes: createDeprecatedStub("getSearchNotes"),
|
|
9395
|
+
/** @deprecated 请使用 xiaohongshuFetcher.fetchEmojiList 替代 */
|
|
9312
9396
|
getEmojiList: createDeprecatedStub("getEmojiList")
|
|
9313
9397
|
};
|
|
9314
9398
|
/**
|
|
@@ -9319,7 +9403,6 @@ const xiaohongshu = {
|
|
|
9319
9403
|
const createBoundXiaohongshuApi = (_cookie, _requestConfig) => {
|
|
9320
9404
|
return { ...xiaohongshu };
|
|
9321
9405
|
};
|
|
9322
|
-
|
|
9323
9406
|
//#endregion
|
|
9324
9407
|
//#region src/platform/xiaohongshu/routes.ts
|
|
9325
9408
|
/**
|
|
@@ -9367,7 +9450,6 @@ const createXiaohongshuRoutes = (cookie, requestConfig = getXiaohongshuDefaultCo
|
|
|
9367
9450
|
for (const [method, path] of Object.entries(XiaohongshuMethodRoutes)) router.get(path, createXiaohongshuValidationMiddleware(method), createXiaohongshuRouteHandler(method, cookie, requestConfig));
|
|
9368
9451
|
return router;
|
|
9369
9452
|
};
|
|
9370
|
-
|
|
9371
9453
|
//#endregion
|
|
9372
9454
|
//#region src/platform/xiaohongshu/index.ts
|
|
9373
9455
|
/** 小红书相关功能模块 (工具集) */
|
|
@@ -9376,7 +9458,6 @@ const xiaohongshuUtils = {
|
|
|
9376
9458
|
xiaohongshuApiUrls,
|
|
9377
9459
|
api: xiaohongshu
|
|
9378
9460
|
};
|
|
9379
|
-
|
|
9380
9461
|
//#endregion
|
|
9381
9462
|
//#region src/server/index.ts
|
|
9382
9463
|
/**
|
|
@@ -9426,7 +9507,7 @@ const createAmagiClient = (options) => {
|
|
|
9426
9507
|
* @deprecated v6 已废弃,请使用 douyin.fetcher 替代
|
|
9427
9508
|
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
9428
9509
|
*/
|
|
9429
|
-
const getDouyinData
|
|
9510
|
+
const getDouyinData = (..._args) => {
|
|
9430
9511
|
checkDeprecation("getDouyinData");
|
|
9431
9512
|
throw new Error("getDouyinData 已废弃");
|
|
9432
9513
|
};
|
|
@@ -9434,7 +9515,7 @@ const createAmagiClient = (options) => {
|
|
|
9434
9515
|
* @deprecated v6 已废弃,请使用 bilibili.fetcher 替代
|
|
9435
9516
|
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
9436
9517
|
*/
|
|
9437
|
-
const getBilibiliData
|
|
9518
|
+
const getBilibiliData = (..._args) => {
|
|
9438
9519
|
checkDeprecation("getBilibiliData");
|
|
9439
9520
|
throw new Error("getBilibiliData 已废弃");
|
|
9440
9521
|
};
|
|
@@ -9442,7 +9523,7 @@ const createAmagiClient = (options) => {
|
|
|
9442
9523
|
* @deprecated v6 已废弃,请使用 kuaishou.fetcher 替代
|
|
9443
9524
|
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
9444
9525
|
*/
|
|
9445
|
-
const getKuaishouData
|
|
9526
|
+
const getKuaishouData = (..._args) => {
|
|
9446
9527
|
checkDeprecation("getKuaishouData");
|
|
9447
9528
|
throw new Error("getKuaishouData 已废弃");
|
|
9448
9529
|
};
|
|
@@ -9450,42 +9531,65 @@ const createAmagiClient = (options) => {
|
|
|
9450
9531
|
* @deprecated v6 已废弃,请使用 xiaohongshu.fetcher 替代
|
|
9451
9532
|
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
9452
9533
|
*/
|
|
9453
|
-
const getXiaohongshuData
|
|
9534
|
+
const getXiaohongshuData = (..._args) => {
|
|
9454
9535
|
checkDeprecation("getXiaohongshuData");
|
|
9455
9536
|
throw new Error("getXiaohongshuData 已废弃");
|
|
9456
9537
|
};
|
|
9457
9538
|
return {
|
|
9539
|
+
/** 启动本地HTTP服务 */
|
|
9458
9540
|
startServer,
|
|
9541
|
+
/** 事件系统 */
|
|
9459
9542
|
events: amagiEvents,
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
|
|
9465
|
-
|
|
9543
|
+
/**
|
|
9544
|
+
* 注册事件监听器
|
|
9545
|
+
* @param event - 事件名称
|
|
9546
|
+
* @param listener - 事件处理函数
|
|
9547
|
+
*/
|
|
9548
|
+
on: (event, listener) => amagiEvents.on(event, listener),
|
|
9549
|
+
/**
|
|
9550
|
+
* 注册一次性事件监听器
|
|
9551
|
+
* @param event - 事件名称
|
|
9552
|
+
* @param listener - 事件处理函数 (只触发一次)
|
|
9553
|
+
*/
|
|
9554
|
+
once: (event, listener) => amagiEvents.once(event, listener),
|
|
9555
|
+
/** @deprecated v6 已废弃,请使用 douyin.fetcher 替代 */
|
|
9556
|
+
getDouyinData,
|
|
9557
|
+
/** @deprecated v6 已废弃,请使用 bilibili.fetcher 替代 */
|
|
9558
|
+
getBilibiliData,
|
|
9559
|
+
/** @deprecated v6 已废弃,请使用 kuaishou.fetcher 替代 */
|
|
9560
|
+
getKuaishouData,
|
|
9561
|
+
/** @deprecated v6 已废弃,请使用 xiaohongshu.fetcher 替代 */
|
|
9562
|
+
getXiaohongshuData,
|
|
9466
9563
|
douyin: {
|
|
9467
9564
|
...douyinUtils,
|
|
9565
|
+
/** @deprecated 请使用 fetcher 替代 */
|
|
9468
9566
|
api: createBoundDouyinApi(douyinCookie, requestConfig),
|
|
9567
|
+
/** fetcher */
|
|
9469
9568
|
fetcher: createBoundDouyinFetcher(douyinCookie, requestConfig)
|
|
9470
9569
|
},
|
|
9471
9570
|
bilibili: {
|
|
9472
9571
|
...bilibiliUtils,
|
|
9572
|
+
/** @deprecated 请使用 fetcher 替代 */
|
|
9473
9573
|
api: createBoundBilibiliApi(bilibiliCookie, requestConfig),
|
|
9574
|
+
/** fetcher */
|
|
9474
9575
|
fetcher: createBoundBilibiliFetcher(bilibiliCookie, requestConfig)
|
|
9475
9576
|
},
|
|
9476
9577
|
kuaishou: {
|
|
9477
9578
|
...kuaishouUtils,
|
|
9579
|
+
/** @deprecated 请使用 fetcher 替代 */
|
|
9478
9580
|
api: createBoundKuaishouApi(kuaishouCookie, requestConfig),
|
|
9581
|
+
/** fetcher */
|
|
9479
9582
|
fetcher: createBoundKuaishouFetcher(kuaishouCookie, requestConfig)
|
|
9480
9583
|
},
|
|
9481
9584
|
xiaohongshu: {
|
|
9482
9585
|
...xiaohongshuUtils,
|
|
9586
|
+
/** @deprecated 请使用 fetcher 替代 */
|
|
9483
9587
|
api: createBoundXiaohongshuApi(xiaohongshuCookie, requestConfig),
|
|
9588
|
+
/** fetcher */
|
|
9484
9589
|
fetcher: createBoundXiaohongshuFetcher(xiaohongshuCookie, requestConfig)
|
|
9485
9590
|
}
|
|
9486
9591
|
};
|
|
9487
9592
|
};
|
|
9488
|
-
|
|
9489
9593
|
//#endregion
|
|
9490
9594
|
//#region src/types/BilibiliAPIParams.ts
|
|
9491
9595
|
/**
|
|
@@ -9494,136 +9598,133 @@ const createAmagiClient = (options) => {
|
|
|
9494
9598
|
* 对应 CommentParams.type 与 CommentReplyParams.type
|
|
9495
9599
|
* @see https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/comment/readme.md#评论区类型代码
|
|
9496
9600
|
*/
|
|
9497
|
-
let CommentType = /* @__PURE__ */ function(CommentType
|
|
9601
|
+
let CommentType = /* @__PURE__ */ function(CommentType) {
|
|
9498
9602
|
/** 视频稿件:oid 为稿件 avid */
|
|
9499
|
-
CommentType
|
|
9603
|
+
CommentType[CommentType["Video"] = 1] = "Video";
|
|
9500
9604
|
/** 话题:oid 为话题 id */
|
|
9501
|
-
CommentType
|
|
9605
|
+
CommentType[CommentType["Topic"] = 2] = "Topic";
|
|
9502
9606
|
/** 活动:oid 为活动 id */
|
|
9503
|
-
CommentType
|
|
9607
|
+
CommentType[CommentType["Activity"] = 4] = "Activity";
|
|
9504
9608
|
/** 小视频:oid 为小视频 id */
|
|
9505
|
-
CommentType
|
|
9609
|
+
CommentType[CommentType["SmallVideo"] = 5] = "SmallVideo";
|
|
9506
9610
|
/** 小黑屋封禁信息:oid 为封禁公示 id */
|
|
9507
|
-
CommentType
|
|
9611
|
+
CommentType[CommentType["BlockInfo"] = 6] = "BlockInfo";
|
|
9508
9612
|
/** 公告信息:oid 为公告 id */
|
|
9509
|
-
CommentType
|
|
9613
|
+
CommentType[CommentType["Announcement"] = 7] = "Announcement";
|
|
9510
9614
|
/** 直播活动:oid 为直播间 id */
|
|
9511
|
-
CommentType
|
|
9615
|
+
CommentType[CommentType["LiveActivity"] = 8] = "LiveActivity";
|
|
9512
9616
|
/** 活动稿件:oid 含义未知 */
|
|
9513
|
-
CommentType
|
|
9617
|
+
CommentType[CommentType["ActivityVideo"] = 9] = "ActivityVideo";
|
|
9514
9618
|
/** 直播公告:oid 含义未知 */
|
|
9515
|
-
CommentType
|
|
9619
|
+
CommentType[CommentType["LiveAnnouncement"] = 10] = "LiveAnnouncement";
|
|
9516
9620
|
/** 相簿(图片动态):oid 为相簿 id */
|
|
9517
|
-
CommentType
|
|
9621
|
+
CommentType[CommentType["Album"] = 11] = "Album";
|
|
9518
9622
|
/** 专栏:oid 为专栏 cvid */
|
|
9519
|
-
CommentType
|
|
9623
|
+
CommentType[CommentType["Article"] = 12] = "Article";
|
|
9520
9624
|
/** 票务:oid 含义未知 */
|
|
9521
|
-
CommentType
|
|
9625
|
+
CommentType[CommentType["Ticket"] = 13] = "Ticket";
|
|
9522
9626
|
/** 音频:oid 为音频 auid */
|
|
9523
|
-
CommentType
|
|
9627
|
+
CommentType[CommentType["Audio"] = 14] = "Audio";
|
|
9524
9628
|
/** 风纪委员会:oid 为众裁项目 id */
|
|
9525
|
-
CommentType
|
|
9629
|
+
CommentType[CommentType["Jury"] = 15] = "Jury";
|
|
9526
9630
|
/** 点评:oid 含义未知 */
|
|
9527
|
-
CommentType
|
|
9631
|
+
CommentType[CommentType["Review"] = 16] = "Review";
|
|
9528
9632
|
/** 动态(纯文字动态&分享):oid 为动态 id */
|
|
9529
|
-
CommentType
|
|
9633
|
+
CommentType[CommentType["Dynamic"] = 17] = "Dynamic";
|
|
9530
9634
|
/** 播单:oid 含义未知 */
|
|
9531
|
-
CommentType
|
|
9635
|
+
CommentType[CommentType["Playlist"] = 18] = "Playlist";
|
|
9532
9636
|
/** 音乐播单:oid 含义未知 */
|
|
9533
|
-
CommentType
|
|
9637
|
+
CommentType[CommentType["MusicPlaylist"] = 19] = "MusicPlaylist";
|
|
9534
9638
|
/** 漫画:oid 含义未知 */
|
|
9535
|
-
CommentType
|
|
9639
|
+
CommentType[CommentType["Comic1"] = 20] = "Comic1";
|
|
9536
9640
|
/** 漫画:oid 含义未知 */
|
|
9537
|
-
CommentType
|
|
9641
|
+
CommentType[CommentType["Comic2"] = 21] = "Comic2";
|
|
9538
9642
|
/** 漫画:oid 为漫画 mcid */
|
|
9539
|
-
CommentType
|
|
9643
|
+
CommentType[CommentType["Comic"] = 22] = "Comic";
|
|
9540
9644
|
/** 课程:oid 为课程 epid */
|
|
9541
|
-
CommentType
|
|
9542
|
-
return CommentType
|
|
9645
|
+
CommentType[CommentType["Course"] = 33] = "Course";
|
|
9646
|
+
return CommentType;
|
|
9543
9647
|
}({});
|
|
9544
|
-
|
|
9545
9648
|
//#endregion
|
|
9546
9649
|
//#region src/types/ReturnDataType/Bilibili/Dynamic/index.ts
|
|
9547
9650
|
/**
|
|
9548
9651
|
* 转发动态种子动态主体类型枚举
|
|
9549
9652
|
*/
|
|
9550
|
-
let MajorType = /* @__PURE__ */ function(MajorType
|
|
9653
|
+
let MajorType = /* @__PURE__ */ function(MajorType) {
|
|
9551
9654
|
/** 动态失效 */
|
|
9552
|
-
MajorType
|
|
9655
|
+
MajorType["NONE"] = "MAJOR_TYPE_NONE";
|
|
9553
9656
|
/** 图文动态 */
|
|
9554
|
-
MajorType
|
|
9657
|
+
MajorType["OPUS"] = "MAJOR_TYPE_OPUS";
|
|
9555
9658
|
/** 视频 */
|
|
9556
|
-
MajorType
|
|
9659
|
+
MajorType["ARCHIVE"] = "MAJOR_TYPE_ARCHIVE";
|
|
9557
9660
|
/** 剧集更新 */
|
|
9558
|
-
MajorType
|
|
9661
|
+
MajorType["PGC"] = "MAJOR_TYPE_PGC";
|
|
9559
9662
|
/** 课程 */
|
|
9560
|
-
MajorType
|
|
9663
|
+
MajorType["COURSES"] = "MAJOR_TYPE_COURSES";
|
|
9561
9664
|
/** 带图动态 */
|
|
9562
|
-
MajorType
|
|
9665
|
+
MajorType["DRAW"] = "MAJOR_TYPE_DRAW";
|
|
9563
9666
|
/** 文章 */
|
|
9564
|
-
MajorType
|
|
9667
|
+
MajorType["ARTICLE"] = "MAJOR_TYPE_ARTICLE";
|
|
9565
9668
|
/** 音频更新 */
|
|
9566
|
-
MajorType
|
|
9669
|
+
MajorType["MUSIC"] = "MAJOR_TYPE_MUSIC";
|
|
9567
9670
|
/** 一般类型 */
|
|
9568
|
-
MajorType
|
|
9671
|
+
MajorType["COMMON"] = "MAJOR_TYPE_COMMON";
|
|
9569
9672
|
/** 直播间分享 */
|
|
9570
|
-
MajorType
|
|
9673
|
+
MajorType["LIVE"] = "MAJOR_TYPE_LIVE";
|
|
9571
9674
|
/** 媒体列表 */
|
|
9572
|
-
MajorType
|
|
9675
|
+
MajorType["MEDIALIST"] = "MAJOR_TYPE_MEDIALIST";
|
|
9573
9676
|
/** 小程序 */
|
|
9574
|
-
MajorType
|
|
9677
|
+
MajorType["APPLET"] = "MAJOR_TYPE_APPLET";
|
|
9575
9678
|
/** 订阅 */
|
|
9576
|
-
MajorType
|
|
9679
|
+
MajorType["SUBSCRIPTION"] = "MAJOR_TYPE_SUBSCRIPTION";
|
|
9577
9680
|
/** 直播状态 */
|
|
9578
|
-
MajorType
|
|
9681
|
+
MajorType["LIVE_RCMD"] = "MAJOR_TYPE_LIVE_RCMD";
|
|
9579
9682
|
/** 合集更新 */
|
|
9580
|
-
MajorType
|
|
9683
|
+
MajorType["UGC_SEASON"] = "MAJOR_TYPE_UGC_SEASON";
|
|
9581
9684
|
/** 新订阅 */
|
|
9582
|
-
MajorType
|
|
9685
|
+
MajorType["SUBSCRIPTION_NEW"] = "MAJOR_TYPE_SUBSCRIPTION_NEW";
|
|
9583
9686
|
/** 充电相关 */
|
|
9584
|
-
MajorType
|
|
9585
|
-
return MajorType
|
|
9687
|
+
MajorType["UPOWER_COMMON"] = "MAJOR_TYPE_UPOWER_COMMON";
|
|
9688
|
+
return MajorType;
|
|
9586
9689
|
}({});
|
|
9587
9690
|
/**
|
|
9588
9691
|
* 相关内容卡片类型枚举
|
|
9589
9692
|
* 用于标识动态中附加的相关内容卡片的类型
|
|
9590
9693
|
*/
|
|
9591
|
-
let AdditionalType = /* @__PURE__ */ function(AdditionalType
|
|
9694
|
+
let AdditionalType = /* @__PURE__ */ function(AdditionalType) {
|
|
9592
9695
|
/** 无相关内容 */
|
|
9593
|
-
AdditionalType
|
|
9696
|
+
AdditionalType["NONE"] = "ADDITIONAL_TYPE_NONE";
|
|
9594
9697
|
/** 剧集相关 */
|
|
9595
|
-
AdditionalType
|
|
9698
|
+
AdditionalType["PGC"] = "ADDITIONAL_TYPE_PGC";
|
|
9596
9699
|
/** 商品信息 */
|
|
9597
|
-
AdditionalType
|
|
9700
|
+
AdditionalType["GOODS"] = "ADDITIONAL_TYPE_GOODS";
|
|
9598
9701
|
/** 投票 */
|
|
9599
|
-
AdditionalType
|
|
9702
|
+
AdditionalType["VOTE"] = "ADDITIONAL_TYPE_VOTE";
|
|
9600
9703
|
/** 一般类型 */
|
|
9601
|
-
AdditionalType
|
|
9704
|
+
AdditionalType["COMMON"] = "ADDITIONAL_TYPE_COMMON";
|
|
9602
9705
|
/** 比赛信息 */
|
|
9603
|
-
AdditionalType
|
|
9706
|
+
AdditionalType["MATCH"] = "ADDITIONAL_TYPE_MATCH";
|
|
9604
9707
|
/** UP主推荐 */
|
|
9605
|
-
AdditionalType
|
|
9708
|
+
AdditionalType["UP_RCMD"] = "ADDITIONAL_TYPE_UP_RCMD";
|
|
9606
9709
|
/** 视频跳转 */
|
|
9607
|
-
AdditionalType
|
|
9710
|
+
AdditionalType["UGC"] = "ADDITIONAL_TYPE_UGC";
|
|
9608
9711
|
/** 直播预约 */
|
|
9609
|
-
AdditionalType
|
|
9712
|
+
AdditionalType["RESERVE"] = "ADDITIONAL_TYPE_RESERVE";
|
|
9610
9713
|
/** 充电专属抽奖 */
|
|
9611
|
-
AdditionalType
|
|
9612
|
-
return AdditionalType
|
|
9714
|
+
AdditionalType["UPOWER_LOTTERY"] = "ADDITIONAL_TYPE_UPOWER_LOTTERY";
|
|
9715
|
+
return AdditionalType;
|
|
9613
9716
|
}({});
|
|
9614
|
-
|
|
9615
9717
|
//#endregion
|
|
9616
|
-
//#region src/types/ReturnDataType/Bilibili/DynamicInfo.ts
|
|
9617
|
-
let DynamicType = /* @__PURE__ */ function(DynamicType
|
|
9618
|
-
DynamicType
|
|
9619
|
-
DynamicType
|
|
9620
|
-
DynamicType
|
|
9621
|
-
DynamicType
|
|
9622
|
-
DynamicType
|
|
9623
|
-
DynamicType
|
|
9624
|
-
return DynamicType
|
|
9718
|
+
//#region src/types/ReturnDataType/Bilibili/DynamicInfo/index.ts
|
|
9719
|
+
let DynamicType = /* @__PURE__ */ function(DynamicType) {
|
|
9720
|
+
DynamicType["AV"] = "DYNAMIC_TYPE_AV";
|
|
9721
|
+
DynamicType["DRAW"] = "DYNAMIC_TYPE_DRAW";
|
|
9722
|
+
DynamicType["WORD"] = "DYNAMIC_TYPE_WORD";
|
|
9723
|
+
DynamicType["LIVE_RCMD"] = "DYNAMIC_TYPE_LIVE_RCMD";
|
|
9724
|
+
DynamicType["FORWARD"] = "DYNAMIC_TYPE_FORWARD";
|
|
9725
|
+
DynamicType["ARTICLE"] = "DYNAMIC_TYPE_ARTICLE";
|
|
9726
|
+
return DynamicType;
|
|
9625
9727
|
}({});
|
|
9626
|
-
|
|
9627
9728
|
//#endregion
|
|
9628
9729
|
//#region src/types/method-keys.ts
|
|
9629
9730
|
/**
|
|
@@ -9882,7 +9983,6 @@ const MethodMaps = {
|
|
|
9882
9983
|
toFetcher: XiaohongshuMethodToFetcher
|
|
9883
9984
|
}
|
|
9884
9985
|
};
|
|
9885
|
-
|
|
9886
9986
|
//#endregion
|
|
9887
9987
|
//#region src/types/api-spec.ts
|
|
9888
9988
|
const DouyinMethodMapping = {
|
|
@@ -9904,8 +10004,7 @@ const DouyinMethodMapping = {
|
|
|
9904
10004
|
动态表情数据: "fetchDynamicEmojiList",
|
|
9905
10005
|
弹幕数据: "fetchDanmakuList"
|
|
9906
10006
|
};
|
|
9907
|
-
|
|
9908
|
-
const DouyinMethodReverseMapping = Object.fromEntries(Object.entries(DouyinMethodMapping).map(([k, v]) => [v, k]));
|
|
10007
|
+
Object.fromEntries(Object.entries(DouyinMethodMapping).map(([k, v]) => [v, k]));
|
|
9909
10008
|
const BilibiliMethodMapping = {
|
|
9910
10009
|
单个视频作品数据: "fetchVideoInfo",
|
|
9911
10010
|
单个视频下载信息数据: "fetchVideoStreamUrl",
|
|
@@ -9935,8 +10034,7 @@ const BilibiliMethodMapping = {
|
|
|
9935
10034
|
从_v_voucher_申请_captcha: "requestCaptchaFromVoucher",
|
|
9936
10035
|
验证验证码结果: "validateCaptchaResult"
|
|
9937
10036
|
};
|
|
9938
|
-
|
|
9939
|
-
const BilibiliMethodReverseMapping = Object.fromEntries(Object.entries(BilibiliMethodMapping).map(([k, v]) => [v, k]));
|
|
10037
|
+
Object.fromEntries(Object.entries(BilibiliMethodMapping).map(([k, v]) => [v, k]));
|
|
9940
10038
|
const KuaishouMethodMapping = {
|
|
9941
10039
|
单个视频作品数据: "fetchVideoWork",
|
|
9942
10040
|
评论数据: "fetchWorkComments",
|
|
@@ -9945,8 +10043,7 @@ const KuaishouMethodMapping = {
|
|
|
9945
10043
|
直播间信息数据: "fetchLiveRoomInfo",
|
|
9946
10044
|
Emoji数据: "fetchEmojiList"
|
|
9947
10045
|
};
|
|
9948
|
-
|
|
9949
|
-
const KuaishouMethodReverseMapping = Object.fromEntries(Object.entries(KuaishouMethodMapping).map(([k, v]) => [v, k]));
|
|
10046
|
+
Object.fromEntries(Object.entries(KuaishouMethodMapping).map(([k, v]) => [v, k]));
|
|
9950
10047
|
const XiaohongshuMethodMapping = {
|
|
9951
10048
|
首页推荐数据: "fetchHomeFeed",
|
|
9952
10049
|
单个笔记数据: "fetchNoteDetail",
|
|
@@ -9956,8 +10053,7 @@ const XiaohongshuMethodMapping = {
|
|
|
9956
10053
|
表情列表: "fetchEmojiList",
|
|
9957
10054
|
搜索笔记: "searchNotes"
|
|
9958
10055
|
};
|
|
9959
|
-
|
|
9960
|
-
const XiaohongshuMethodReverseMapping = Object.fromEntries(Object.entries(XiaohongshuMethodMapping).map(([k, v]) => [v, k]));
|
|
10056
|
+
Object.fromEntries(Object.entries(XiaohongshuMethodMapping).map(([k, v]) => [v, k]));
|
|
9961
10057
|
/**
|
|
9962
10058
|
* Douyin HTTP API 路由
|
|
9963
10059
|
*
|
|
@@ -10065,7 +10161,6 @@ function getApiRoute(platform, methodType) {
|
|
|
10065
10161
|
xiaohongshu: XiaohongshuApiRoutes
|
|
10066
10162
|
}[platform][methodType];
|
|
10067
10163
|
}
|
|
10068
|
-
|
|
10069
10164
|
//#endregion
|
|
10070
10165
|
//#region src/index.ts
|
|
10071
10166
|
/**
|
|
@@ -10073,7 +10168,7 @@ function getApiRoute(platform, methodType) {
|
|
|
10073
10168
|
* 构建后使用 __VERSION__,开发环境从 package.json 读取
|
|
10074
10169
|
*/
|
|
10075
10170
|
const getVersion = () => {
|
|
10076
|
-
return "6.
|
|
10171
|
+
return "6.2.0";
|
|
10077
10172
|
};
|
|
10078
10173
|
const VERSION = getVersion();
|
|
10079
10174
|
/**
|
|
@@ -10120,7 +10215,12 @@ const CreateApp = CreateAmagiApp;
|
|
|
10120
10215
|
/** After instantiation, it can interact with the specified platform API to quickly obtain data. */
|
|
10121
10216
|
const Client = CreateApp;
|
|
10122
10217
|
const amagi = Client;
|
|
10123
|
-
|
|
10218
|
+
/*!
|
|
10219
|
+
* @ikenxuan/amagi
|
|
10220
|
+
* Copyright(c) 2023 ikenxuan
|
|
10221
|
+
* GPL-3.0 Licensed
|
|
10222
|
+
*/
|
|
10124
10223
|
//#endregion
|
|
10125
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 };
|
|
10225
|
+
|
|
10126
10226
|
//# sourceMappingURL=index.mjs.map
|