@ikenxuan/amagi 6.1.2 → 6.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-CbDLau6x.cjs → chunk-CKQMccvm.cjs} +13 -19
- package/dist/default/index.cjs +761 -857
- package/dist/default/index.d.ts +17287 -16786
- package/dist/default/index.mjs +749 -847
- 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/package.json +4 -4
package/dist/default/index.cjs
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
Object.
|
|
2
|
-
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
const require_chunk = require("../chunk-CKQMccvm.cjs");
|
|
3
6
|
let node_url = require("node:url");
|
|
4
|
-
node_url = require_chunk.__toESM(node_url);
|
|
7
|
+
node_url = require_chunk.__toESM(node_url, 1);
|
|
5
8
|
let node_events = require("node:events");
|
|
6
9
|
let zod = require("zod");
|
|
7
|
-
zod = require_chunk.__toESM(zod);
|
|
10
|
+
zod = require_chunk.__toESM(zod, 1);
|
|
8
11
|
let _ikenxuan_xhshow_ts = require("@ikenxuan/xhshow-ts");
|
|
9
12
|
let node_crypto = require("node:crypto");
|
|
10
|
-
node_crypto = require_chunk.__toESM(node_crypto);
|
|
13
|
+
node_crypto = require_chunk.__toESM(node_crypto, 1);
|
|
11
14
|
let axios = require("axios");
|
|
12
|
-
axios = require_chunk.__toESM(axios);
|
|
15
|
+
axios = require_chunk.__toESM(axios, 1);
|
|
13
16
|
let chalk = require("chalk");
|
|
14
17
|
let protobufjs = require("protobufjs");
|
|
15
|
-
protobufjs = require_chunk.__toESM(protobufjs);
|
|
18
|
+
protobufjs = require_chunk.__toESM(protobufjs, 1);
|
|
16
19
|
let express = require("express");
|
|
17
|
-
express = require_chunk.__toESM(express);
|
|
18
|
-
|
|
20
|
+
express = require_chunk.__toESM(express, 1);
|
|
19
21
|
//#region src/utils/deprecation.ts
|
|
20
22
|
/**
|
|
21
23
|
* 废弃 API 注册表
|
|
@@ -74,7 +76,9 @@ function checkDeprecation(apiName) {
|
|
|
74
76
|
* @returns 格式化的废弃提示消息字符串
|
|
75
77
|
*/
|
|
76
78
|
function buildDeprecationMessage(config) {
|
|
77
|
-
const lines = [`[DEPRECATED] "${config.name}" 已在 v${config.deprecatedIn}
|
|
79
|
+
const lines = [`[DEPRECATED] "${config.name}" 已在 v${config.deprecatedIn} 版本废弃。`];
|
|
80
|
+
if (config.replacement) lines.push(`请使用 "${config.replacement}" 替代。`);
|
|
81
|
+
else lines.push("此接口已被上游删除,无法继续使用,无可用替代方案。");
|
|
78
82
|
if (config.removedIn) lines.push(`此 API 将在 v${config.removedIn} 版本移除。`);
|
|
79
83
|
if (config.migrationGuide) lines.push(`迁移指南: ${config.migrationGuide}`);
|
|
80
84
|
return lines.join("\n");
|
|
@@ -182,10 +186,6 @@ registerDeprecatedApi({
|
|
|
182
186
|
name: "动态详情数据",
|
|
183
187
|
replacement: "fetchDynamicDetail"
|
|
184
188
|
},
|
|
185
|
-
{
|
|
186
|
-
name: "动态卡片数据",
|
|
187
|
-
replacement: "fetchDynamicCard"
|
|
188
|
-
},
|
|
189
189
|
{
|
|
190
190
|
name: "直播间信息",
|
|
191
191
|
replacement: "fetchLiveRoomInfo"
|
|
@@ -335,7 +335,20 @@ registerDeprecatedApi({
|
|
|
335
335
|
throwError: true
|
|
336
336
|
});
|
|
337
337
|
});
|
|
338
|
-
|
|
338
|
+
registerDeprecatedApi({
|
|
339
|
+
name: `methodType: '动态卡片数据'`,
|
|
340
|
+
deprecatedIn: "6.0.0",
|
|
341
|
+
removedIn: "7.0.0",
|
|
342
|
+
migrationGuide: "https://amagi-docs.vercel.app/docs/changelog/6.1.3",
|
|
343
|
+
throwError: false
|
|
344
|
+
});
|
|
345
|
+
registerDeprecatedApi({
|
|
346
|
+
name: "fetchDynamicCard",
|
|
347
|
+
deprecatedIn: "6.1.3",
|
|
348
|
+
removedIn: "7.0.0",
|
|
349
|
+
migrationGuide: "https://amagi-docs.vercel.app/docs/changelog/6.1.3",
|
|
350
|
+
throwError: false
|
|
351
|
+
});
|
|
339
352
|
//#endregion
|
|
340
353
|
//#region src/model/DataFetchers.ts
|
|
341
354
|
/**
|
|
@@ -443,7 +456,6 @@ function getXiaohongshuData(..._args) {
|
|
|
443
456
|
checkDeprecation("getXiaohongshuData");
|
|
444
457
|
throw new Error("getXiaohongshuData 已废弃");
|
|
445
458
|
}
|
|
446
|
-
|
|
447
459
|
//#endregion
|
|
448
460
|
//#region src/platform/bilibili/API.ts
|
|
449
461
|
/**
|
|
@@ -457,133 +469,138 @@ var BilibiliAPI = class {
|
|
|
457
469
|
return "https://api.bilibili.com/x/web-interface/nav";
|
|
458
470
|
}
|
|
459
471
|
/** 获取视频详细信息 */
|
|
460
|
-
getVideoInfo(data
|
|
461
|
-
return `https://api.bilibili.com/x/web-interface/view?bvid=${data
|
|
472
|
+
getVideoInfo(data) {
|
|
473
|
+
return `https://api.bilibili.com/x/web-interface/view?bvid=${data.bvid}`;
|
|
462
474
|
}
|
|
463
475
|
/** 获取视频流信息 */
|
|
464
|
-
getVideoStream(data
|
|
465
|
-
return `https://api.bilibili.com/x/player/playurl?avid=${data
|
|
476
|
+
getVideoStream(data) {
|
|
477
|
+
return `https://api.bilibili.com/x/player/playurl?avid=${data.avid}&cid=${data.cid}`;
|
|
466
478
|
}
|
|
467
479
|
/**
|
|
468
480
|
* 获取评论区明细
|
|
469
481
|
* @see https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/comment/readme.md#评论区类型代码
|
|
470
482
|
*/
|
|
471
|
-
getComments(data
|
|
483
|
+
getComments(data) {
|
|
472
484
|
const params = new URLSearchParams({
|
|
473
|
-
oid: data
|
|
474
|
-
type: data
|
|
475
|
-
mode: (data
|
|
485
|
+
oid: data.oid.toString(),
|
|
486
|
+
type: data.type.toString(),
|
|
487
|
+
mode: (data.mode ?? 3).toString(),
|
|
476
488
|
plat: "1",
|
|
477
489
|
seek_rpid: "",
|
|
478
490
|
web_location: "1315875"
|
|
479
491
|
});
|
|
480
|
-
if (data
|
|
492
|
+
if (data.pagination_str) params.append("pagination_str", JSON.stringify({ offset: data.pagination_str }));
|
|
481
493
|
else params.append("pagination_str", JSON.stringify({ offset: "" }));
|
|
482
494
|
return `https://api.bilibili.com/x/v2/reply/wbi/main?${params.toString()}`;
|
|
483
495
|
}
|
|
484
496
|
/** 获取评论区状态 */
|
|
485
|
-
getCommentStatus(data
|
|
486
|
-
return `https://api.bilibili.com/x/v2/reply/subject/description?type=${data
|
|
497
|
+
getCommentStatus(data) {
|
|
498
|
+
return `https://api.bilibili.com/x/v2/reply/subject/description?type=${data.type}&oid=${data.oid}`;
|
|
487
499
|
}
|
|
488
500
|
/** 获取指定评论的回复 */
|
|
489
|
-
getCommentReplies(data
|
|
490
|
-
return `https://api.bilibili.com/x/v2/reply/reply?type=${data
|
|
501
|
+
getCommentReplies(data) {
|
|
502
|
+
return `https://api.bilibili.com/x/v2/reply/reply?type=${data.type}&oid=${data.oid}&root=${data.root}&ps=${data.number}`;
|
|
491
503
|
}
|
|
492
504
|
/** 获取表情列表 */
|
|
493
505
|
getEmojiList() {
|
|
494
506
|
return "https://api.bilibili.com/x/emote/user/panel/web?business=reply&web_location=0.0";
|
|
495
507
|
}
|
|
496
508
|
/** 获取番剧明细 */
|
|
497
|
-
getBangumiInfo(data
|
|
498
|
-
if (data
|
|
499
|
-
else if (data
|
|
509
|
+
getBangumiInfo(data) {
|
|
510
|
+
if (data.ep_id) return `https://api.bilibili.com/pgc/view/web/season?ep_id=${data.ep_id}`;
|
|
511
|
+
else if (data.season_id) return `https://api.bilibili.com/pgc/view/web/season?season_id=${data.season_id}`;
|
|
500
512
|
else throw new Error("Missing required parameter: ep_id or season_id");
|
|
501
513
|
}
|
|
502
514
|
/** 获取番剧视频流信息 */
|
|
503
|
-
getBangumiStream(data
|
|
504
|
-
return `https://api.bilibili.com/pgc/player/web/playurl?cid=${data
|
|
515
|
+
getBangumiStream(data) {
|
|
516
|
+
return `https://api.bilibili.com/pgc/player/web/playurl?cid=${data.cid}&ep_id=${data.ep_id}`;
|
|
505
517
|
}
|
|
506
518
|
/** 获取用户空间动态 */
|
|
507
|
-
getUserDynamicList(data
|
|
519
|
+
getUserDynamicList(data) {
|
|
508
520
|
return `https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/space?${new URLSearchParams({
|
|
509
|
-
host_mid: data
|
|
521
|
+
host_mid: data.host_mid.toString(),
|
|
510
522
|
offset: "",
|
|
511
523
|
platform: "web",
|
|
512
524
|
features: "itemOpusStyle,listOnlyfans,opusBigCover,onlyfansVote,forwardListHidden,decorationCard,commentsNewVersion,onlyfansAssetsV2,ugcDelete,onlyfansQaCard,avatarAutoTheme,sunflowerStyle,eva3CardOpus,eva3CardVideo,eva3CardComment"
|
|
513
525
|
}).toString()}`;
|
|
514
526
|
}
|
|
515
527
|
/** 获取动态详情 */
|
|
516
|
-
getDynamicDetail(data
|
|
517
|
-
return `https://api.bilibili.com/x/polymer/web-dynamic/v1/detail?id=${data
|
|
528
|
+
getDynamicDetail(data) {
|
|
529
|
+
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`;
|
|
518
530
|
}
|
|
519
|
-
/**
|
|
520
|
-
|
|
521
|
-
|
|
531
|
+
/**
|
|
532
|
+
* 获取动态卡片信息
|
|
533
|
+
*
|
|
534
|
+
* @deprecated B站官方已于 `2025-08-09` 删除原 `dynamic_svr` 接口,该接口已停用。
|
|
535
|
+
* 调用将返回错误信息,请使用 {@link getDynamicDetail} 替代。
|
|
536
|
+
*/
|
|
537
|
+
getDynamicCard(data) {
|
|
538
|
+
return this.getDynamicDetail(data);
|
|
522
539
|
}
|
|
523
540
|
/** 获取用户名片信息 */
|
|
524
|
-
getUserCard(data
|
|
525
|
-
return `https://api.bilibili.com/x/web-interface/card?mid=${data
|
|
541
|
+
getUserCard(data) {
|
|
542
|
+
return `https://api.bilibili.com/x/web-interface/card?mid=${data.host_mid}&photo=true`;
|
|
526
543
|
}
|
|
527
544
|
/** 获取直播间信息 */
|
|
528
|
-
getLiveRoomInfo(data
|
|
529
|
-
return `https://api.live.bilibili.com/room/v1/Room/get_info?room_id=${data
|
|
545
|
+
getLiveRoomInfo(data) {
|
|
546
|
+
return `https://api.live.bilibili.com/room/v1/Room/get_info?room_id=${data.room_id}`;
|
|
530
547
|
}
|
|
531
548
|
/** 获取直播间初始化信息 */
|
|
532
|
-
getLiveRoomInit(data
|
|
533
|
-
return `https://api.live.bilibili.com/room/v1/Room/room_init?id=${data
|
|
549
|
+
getLiveRoomInit(data) {
|
|
550
|
+
return `https://api.live.bilibili.com/room/v1/Room/room_init?id=${data.room_id}`;
|
|
534
551
|
}
|
|
535
552
|
/** 申请登录二维码 */
|
|
536
553
|
getLoginQrcode() {
|
|
537
554
|
return "https://passport.bilibili.com/x/passport-login/web/qrcode/generate";
|
|
538
555
|
}
|
|
539
556
|
/** 查询二维码状态 */
|
|
540
|
-
getQrcodeStatus(data
|
|
541
|
-
return `https://passport.bilibili.com/x/passport-login/web/qrcode/poll?qrcode_key=${data
|
|
557
|
+
getQrcodeStatus(data) {
|
|
558
|
+
return `https://passport.bilibili.com/x/passport-login/web/qrcode/poll?qrcode_key=${data.qrcode_key}`;
|
|
542
559
|
}
|
|
543
560
|
/** 获取UP主总播放量 */
|
|
544
|
-
getUploaderTotalViews(data
|
|
545
|
-
return `https://api.bilibili.com/x/space/upstat?mid=${data
|
|
561
|
+
getUploaderTotalViews(data) {
|
|
562
|
+
return `https://api.bilibili.com/x/space/upstat?mid=${data.host_mid}`;
|
|
546
563
|
}
|
|
547
564
|
/** 获取专栏正文内容 */
|
|
548
|
-
getArticleContent(data
|
|
549
|
-
return `https://api.bilibili.com/x/article/view?id=${data
|
|
565
|
+
getArticleContent(data) {
|
|
566
|
+
return `https://api.bilibili.com/x/article/view?id=${data.id}`;
|
|
550
567
|
}
|
|
551
568
|
/** 获取专栏显示卡片信息 */
|
|
552
|
-
getArticleCards(data
|
|
553
|
-
return `https://api.bilibili.com/x/article/cards?ids=${Array.isArray(data
|
|
569
|
+
getArticleCards(data) {
|
|
570
|
+
return `https://api.bilibili.com/x/article/cards?ids=${Array.isArray(data.ids) ? data.ids.join(",") : data.ids}`;
|
|
554
571
|
}
|
|
555
572
|
/** 获取专栏文章基本信息 */
|
|
556
|
-
getArticleInfo(data
|
|
557
|
-
return `https://api.bilibili.com/x/article/viewinfo?id=${data
|
|
573
|
+
getArticleInfo(data) {
|
|
574
|
+
return `https://api.bilibili.com/x/article/viewinfo?id=${data.id}`;
|
|
558
575
|
}
|
|
559
576
|
/** 获取文集基本信息 */
|
|
560
|
-
getArticleListInfo(data
|
|
561
|
-
return `https://api.bilibili.com/x/article/list/web/articles?id=${data
|
|
577
|
+
getArticleListInfo(data) {
|
|
578
|
+
return `https://api.bilibili.com/x/article/list/web/articles?id=${data.id}`;
|
|
562
579
|
}
|
|
563
580
|
/** 获取用户空间详细信息 */
|
|
564
|
-
getUserSpaceInfo(data
|
|
565
|
-
return `https://api.bilibili.com/x/space/wbi/acc/info?mid=${data
|
|
581
|
+
getUserSpaceInfo(data) {
|
|
582
|
+
return `https://api.bilibili.com/x/space/wbi/acc/info?mid=${data.host_mid}`;
|
|
566
583
|
}
|
|
567
584
|
/** 从 v_voucher 申请验证码 */
|
|
568
|
-
getCaptchaFromVoucher(data
|
|
585
|
+
getCaptchaFromVoucher(data) {
|
|
569
586
|
return {
|
|
570
587
|
Url: "https://api.bilibili.com/x/gaia-vgate/v1/register",
|
|
571
588
|
Body: {
|
|
572
|
-
...data
|
|
573
|
-
v_voucher: data
|
|
589
|
+
...data.csrf !== void 0 && { csrf: data.csrf },
|
|
590
|
+
v_voucher: data.v_voucher
|
|
574
591
|
}
|
|
575
592
|
};
|
|
576
593
|
}
|
|
577
594
|
/** 验证验证码结果 */
|
|
578
|
-
validateCaptcha(data
|
|
595
|
+
validateCaptcha(data) {
|
|
579
596
|
return {
|
|
580
597
|
Url: "https://api.bilibili.com/x/gaia-vgate/v1/validate",
|
|
581
598
|
Body: {
|
|
582
|
-
challenge: data
|
|
583
|
-
token: data
|
|
584
|
-
validate: data
|
|
585
|
-
seccode: data
|
|
586
|
-
...data
|
|
599
|
+
challenge: data.challenge,
|
|
600
|
+
token: data.token,
|
|
601
|
+
validate: data.validate,
|
|
602
|
+
seccode: data.seccode,
|
|
603
|
+
...data.csrf !== void 0 && { csrf: data.csrf }
|
|
587
604
|
}
|
|
588
605
|
};
|
|
589
606
|
}
|
|
@@ -591,17 +608,16 @@ var BilibiliAPI = class {
|
|
|
591
608
|
* 获取实时弹幕(web端 protobuf 接口)
|
|
592
609
|
* @see https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/danmaku/danmaku_proto.md
|
|
593
610
|
*/
|
|
594
|
-
getVideoDanmaku(data
|
|
611
|
+
getVideoDanmaku(data) {
|
|
595
612
|
return `https://api.bilibili.com/x/v2/dm/web/seg.so?${new URLSearchParams({
|
|
596
613
|
type: "1",
|
|
597
|
-
oid: data
|
|
598
|
-
segment_index: (data
|
|
614
|
+
oid: data.cid.toString(),
|
|
615
|
+
segment_index: (data.segment_index ?? 1).toString()
|
|
599
616
|
}).toString()}`;
|
|
600
617
|
}
|
|
601
618
|
};
|
|
602
619
|
/** B站 API URL 构建器实例 */
|
|
603
620
|
const bilibiliApiUrls = new BilibiliAPI();
|
|
604
|
-
|
|
605
621
|
//#endregion
|
|
606
622
|
//#region src/platform/bilibili/BilibiliApi.ts
|
|
607
623
|
/**
|
|
@@ -619,32 +635,59 @@ const createDeprecatedStub$3 = (methodName) => {
|
|
|
619
635
|
* @deprecated v6 已废弃,请使用 bilibiliFetcher 或 client.bilibili.fetcher 替代
|
|
620
636
|
*/
|
|
621
637
|
const bilibili = {
|
|
638
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchVideoInfo 替代 */
|
|
622
639
|
getVideoInfo: createDeprecatedStub$3("getVideoInfo"),
|
|
640
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchVideoStreamUrl 替代 */
|
|
623
641
|
getVideoStream: createDeprecatedStub$3("getVideoStream"),
|
|
642
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchComments 替代 */
|
|
624
643
|
getComments: createDeprecatedStub$3("getComments"),
|
|
644
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchCommentReplies 替代 */
|
|
625
645
|
getCommentReply: createDeprecatedStub$3("getCommentReply"),
|
|
646
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchUserCard 替代 */
|
|
626
647
|
getUserProfile: createDeprecatedStub$3("getUserProfile"),
|
|
648
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchUserDynamicList 替代 */
|
|
627
649
|
getUserDynamic: createDeprecatedStub$3("getUserDynamic"),
|
|
650
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchEmojiList 替代 */
|
|
628
651
|
getEmojiList: createDeprecatedStub$3("getEmojiList"),
|
|
652
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchBangumiInfo 替代 */
|
|
629
653
|
getBangumiInfo: createDeprecatedStub$3("getBangumiInfo"),
|
|
654
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchBangumiStreamUrl 替代 */
|
|
630
655
|
getBangumiStream: createDeprecatedStub$3("getBangumiStream"),
|
|
656
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchDynamicDetail 替代 */
|
|
631
657
|
getDynamicInfo: createDeprecatedStub$3("getDynamicInfo"),
|
|
658
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchDynamicCard 替代 */
|
|
632
659
|
getDynamicCard: createDeprecatedStub$3("getDynamicCard"),
|
|
660
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchLiveRoomInfo 替代 */
|
|
633
661
|
getLiveRoomDetail: createDeprecatedStub$3("getLiveRoomDetail"),
|
|
662
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchLiveRoomInitInfo 替代 */
|
|
634
663
|
getLiveRoomInitInfo: createDeprecatedStub$3("getLiveRoomInitInfo"),
|
|
664
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchLoginStatus 替代 */
|
|
635
665
|
getLoginBasicInfo: createDeprecatedStub$3("getLoginBasicInfo"),
|
|
666
|
+
/** @deprecated 请使用 bilibiliFetcher.requestLoginQrcode 替代 */
|
|
636
667
|
getLoginQrcode: createDeprecatedStub$3("getLoginQrcode"),
|
|
668
|
+
/** @deprecated 请使用 bilibiliFetcher.checkQrcodeStatus 替代 */
|
|
637
669
|
checkQrcodeStatus: createDeprecatedStub$3("checkQrcodeStatus"),
|
|
670
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchUploaderTotalViews 替代 */
|
|
638
671
|
getUserTotalPlayCount: createDeprecatedStub$3("getUserTotalPlayCount"),
|
|
672
|
+
/** @deprecated 请使用 bilibiliFetcher.convertAvToBv 替代 */
|
|
639
673
|
convertAvToBv: createDeprecatedStub$3("convertAvToBv"),
|
|
674
|
+
/** @deprecated 请使用 bilibiliFetcher.convertBvToAv 替代 */
|
|
640
675
|
convertBvToAv: createDeprecatedStub$3("convertBvToAv"),
|
|
676
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchArticleContent 替代 */
|
|
641
677
|
getArticleContent: createDeprecatedStub$3("getArticleContent"),
|
|
678
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchArticleCards 替代 */
|
|
642
679
|
getArticleCard: createDeprecatedStub$3("getArticleCard"),
|
|
680
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchArticleInfo 替代 */
|
|
643
681
|
getArticleInfo: createDeprecatedStub$3("getArticleInfo"),
|
|
682
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchArticleListInfo 替代 */
|
|
644
683
|
getColumnInfo: createDeprecatedStub$3("getColumnInfo"),
|
|
684
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchUserSpaceInfo 替代 */
|
|
645
685
|
getUserProfileDetail: createDeprecatedStub$3("getUserProfileDetail"),
|
|
686
|
+
/** @deprecated 请使用 bilibiliFetcher.requestCaptchaFromVoucher 替代 */
|
|
646
687
|
applyVoucherCaptcha: createDeprecatedStub$3("applyVoucherCaptcha"),
|
|
688
|
+
/** @deprecated 请使用 bilibiliFetcher.validateCaptchaResult 替代 */
|
|
647
689
|
validateCaptcha: createDeprecatedStub$3("validateCaptcha"),
|
|
690
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchVideoDanmaku 替代 */
|
|
648
691
|
getDanmaku: createDeprecatedStub$3("getDanmaku")
|
|
649
692
|
};
|
|
650
693
|
/**
|
|
@@ -655,7 +698,6 @@ const bilibili = {
|
|
|
655
698
|
const createBoundBilibiliApi = (_cookie, _requestConfig) => {
|
|
656
699
|
return { ...bilibili };
|
|
657
700
|
};
|
|
658
|
-
|
|
659
701
|
//#endregion
|
|
660
702
|
//#region src/model/events.ts
|
|
661
703
|
/**
|
|
@@ -674,8 +716,8 @@ var TypedEventEmitter = class extends node_events.EventEmitter {
|
|
|
674
716
|
* @param data - 事件数据
|
|
675
717
|
* @returns 是否有监听器处理了该事件
|
|
676
718
|
*/
|
|
677
|
-
emit(event, data
|
|
678
|
-
return super.emit(event, data
|
|
719
|
+
emit(event, data) {
|
|
720
|
+
return super.emit(event, data);
|
|
679
721
|
}
|
|
680
722
|
/**
|
|
681
723
|
* 注册事件监听器
|
|
@@ -737,9 +779,9 @@ const emitLog = (level, message, ...args) => {
|
|
|
737
779
|
* 发射 HTTP 请求事件
|
|
738
780
|
* @param data - 请求数据 (不含 timestamp)
|
|
739
781
|
*/
|
|
740
|
-
const emitHttpRequest = (data
|
|
782
|
+
const emitHttpRequest = (data) => {
|
|
741
783
|
amagiEvents.emit("http:request", {
|
|
742
|
-
...data
|
|
784
|
+
...data,
|
|
743
785
|
timestamp: /* @__PURE__ */ new Date()
|
|
744
786
|
});
|
|
745
787
|
};
|
|
@@ -747,9 +789,9 @@ const emitHttpRequest = (data$1) => {
|
|
|
747
789
|
* 发射 HTTP 响应事件
|
|
748
790
|
* @param data - 响应数据 (不含 timestamp)
|
|
749
791
|
*/
|
|
750
|
-
const emitHttpResponse = (data
|
|
792
|
+
const emitHttpResponse = (data) => {
|
|
751
793
|
amagiEvents.emit("http:response", {
|
|
752
|
-
...data
|
|
794
|
+
...data,
|
|
753
795
|
timestamp: /* @__PURE__ */ new Date()
|
|
754
796
|
});
|
|
755
797
|
};
|
|
@@ -757,9 +799,9 @@ const emitHttpResponse = (data$1) => {
|
|
|
757
799
|
* 发射网络重试事件
|
|
758
800
|
* @param data - 重试数据 (不含 timestamp)
|
|
759
801
|
*/
|
|
760
|
-
const emitNetworkRetry = (data
|
|
802
|
+
const emitNetworkRetry = (data) => {
|
|
761
803
|
amagiEvents.emit("network:retry", {
|
|
762
|
-
...data
|
|
804
|
+
...data,
|
|
763
805
|
timestamp: /* @__PURE__ */ new Date()
|
|
764
806
|
});
|
|
765
807
|
};
|
|
@@ -767,9 +809,9 @@ const emitNetworkRetry = (data$1) => {
|
|
|
767
809
|
* 发射网络错误事件
|
|
768
810
|
* @param data - 错误数据 (不含 timestamp)
|
|
769
811
|
*/
|
|
770
|
-
const emitNetworkError = (data
|
|
812
|
+
const emitNetworkError = (data) => {
|
|
771
813
|
amagiEvents.emit("network:error", {
|
|
772
|
-
...data
|
|
814
|
+
...data,
|
|
773
815
|
timestamp: /* @__PURE__ */ new Date()
|
|
774
816
|
});
|
|
775
817
|
};
|
|
@@ -777,9 +819,9 @@ const emitNetworkError = (data$1) => {
|
|
|
777
819
|
* 发射 API 成功事件
|
|
778
820
|
* @param data - 成功数据 (不含 timestamp)
|
|
779
821
|
*/
|
|
780
|
-
const emitApiSuccess = (data
|
|
822
|
+
const emitApiSuccess = (data) => {
|
|
781
823
|
amagiEvents.emit("api:success", {
|
|
782
|
-
...data
|
|
824
|
+
...data,
|
|
783
825
|
timestamp: /* @__PURE__ */ new Date()
|
|
784
826
|
});
|
|
785
827
|
};
|
|
@@ -787,9 +829,9 @@ const emitApiSuccess = (data$1) => {
|
|
|
787
829
|
* 发射 API 错误事件
|
|
788
830
|
* @param data - 错误数据 (不含 timestamp)
|
|
789
831
|
*/
|
|
790
|
-
const emitApiError = (data
|
|
832
|
+
const emitApiError = (data) => {
|
|
791
833
|
amagiEvents.emit("api:error", {
|
|
792
|
-
...data
|
|
834
|
+
...data,
|
|
793
835
|
timestamp: /* @__PURE__ */ new Date()
|
|
794
836
|
});
|
|
795
837
|
};
|
|
@@ -833,7 +875,6 @@ const emitLogDebug = (message, ...args) => {
|
|
|
833
875
|
const emitLogMark = (message, ...args) => {
|
|
834
876
|
emitLog("mark", message, ...args);
|
|
835
877
|
};
|
|
836
|
-
|
|
837
878
|
//#endregion
|
|
838
879
|
//#region src/validation/utils.ts
|
|
839
880
|
function smartNumber(errorMessage, minValue = 1, isInteger = false) {
|
|
@@ -864,7 +905,6 @@ const extractCreatorInfoFromHtml = (html) => {
|
|
|
864
905
|
return null;
|
|
865
906
|
}
|
|
866
907
|
};
|
|
867
|
-
|
|
868
908
|
//#endregion
|
|
869
909
|
//#region src/validation/bilibili.ts
|
|
870
910
|
/** 视频信息参数验证 */
|
|
@@ -958,7 +998,7 @@ const BilibiliBangumiInfoParamsSchema = zod.default.object({
|
|
|
958
998
|
methodType: zod.default.literal("bangumiInfo", { error: "方法类型必须是\"bangumiInfo\"" }),
|
|
959
999
|
ep_id: zod.default.string({ error: "番剧EP ID必须是字符串" }).min(1, { error: "番剧EP ID不能为空" }).optional(),
|
|
960
1000
|
season_id: zod.default.string({ error: "番剧季度ID必须是字符串" }).optional()
|
|
961
|
-
}).refine((data
|
|
1001
|
+
}).refine((data) => data.ep_id ?? data.season_id, {
|
|
962
1002
|
error: "ep_id 和 season_id 至少需要提供一个",
|
|
963
1003
|
path: ["ep_id"]
|
|
964
1004
|
});
|
|
@@ -1098,7 +1138,6 @@ const BilibiliMethodRoutes = {
|
|
|
1098
1138
|
validateCaptcha: "/validate_captcha",
|
|
1099
1139
|
videoDanmaku: "/fetch_danmaku"
|
|
1100
1140
|
};
|
|
1101
|
-
|
|
1102
1141
|
//#endregion
|
|
1103
1142
|
//#region src/validation/douyin.ts
|
|
1104
1143
|
/** 作品参数验证 */
|
|
@@ -1187,14 +1226,14 @@ const DouyinDanmakuParamsSchema = zod.default.object({
|
|
|
1187
1226
|
start_time: zod.default.coerce.number({ error: "开始时间必须是数字" }).int({ error: "开始时间必须是整数" }).min(0, { error: "开始时间不能小于0" }).optional(),
|
|
1188
1227
|
end_time: zod.default.coerce.number({ error: "结束时间必须是数字" }).int({ error: "结束时间必须是整数" }).min(0, { error: "结束时间不能小于0" }).optional(),
|
|
1189
1228
|
duration: zod.default.coerce.number({ error: "视频时长必须是数字" }).int({ error: "视频时长必须是整数" }).min(0, { error: "视频时长不能小于0" })
|
|
1190
|
-
}).refine((data
|
|
1191
|
-
if (data
|
|
1229
|
+
}).refine((data) => {
|
|
1230
|
+
if (data.end_time !== void 0) return data.end_time <= data.duration;
|
|
1192
1231
|
return true;
|
|
1193
1232
|
}, {
|
|
1194
1233
|
error: "获取弹幕区间的结束时间不能超过视频总时长",
|
|
1195
1234
|
path: ["end_time"]
|
|
1196
|
-
}).refine((data
|
|
1197
|
-
if (data
|
|
1235
|
+
}).refine((data) => {
|
|
1236
|
+
if (data.start_time !== void 0 && data.end_time !== void 0) return data.start_time < data.end_time;
|
|
1198
1237
|
return true;
|
|
1199
1238
|
}, {
|
|
1200
1239
|
error: "获取弹幕区间的开始时间必须小于结束时间",
|
|
@@ -1244,7 +1283,6 @@ const DouyinMethodRoutes = {
|
|
|
1244
1283
|
danmakuList: "/fetch_work_danmaku",
|
|
1245
1284
|
loginQrcode: "/fetch_login_qrcode"
|
|
1246
1285
|
};
|
|
1247
|
-
|
|
1248
1286
|
//#endregion
|
|
1249
1287
|
//#region src/validation/kuaishou.ts
|
|
1250
1288
|
/**
|
|
@@ -1310,7 +1348,6 @@ const KuaishouMethodRoutes = {
|
|
|
1310
1348
|
liveRoomInfo: "/fetch_live_room_info",
|
|
1311
1349
|
emojiList: "/fetch_emoji_list"
|
|
1312
1350
|
};
|
|
1313
|
-
|
|
1314
1351
|
//#endregion
|
|
1315
1352
|
//#region src/platform/xiaohongshu/sign/index.ts
|
|
1316
1353
|
/**
|
|
@@ -1377,44 +1414,43 @@ var xiaohongshuSign = class {
|
|
|
1377
1414
|
*/
|
|
1378
1415
|
static getSearchId = () => (BigInt(Date.now()) << 64n) + BigInt(Math.floor(Math.random() * 2147483646)).toString(36);
|
|
1379
1416
|
};
|
|
1380
|
-
|
|
1381
1417
|
//#endregion
|
|
1382
1418
|
//#region src/platform/xiaohongshu/API.ts
|
|
1383
1419
|
/**
|
|
1384
1420
|
* 搜索排序类型枚举
|
|
1385
1421
|
*/
|
|
1386
|
-
let SearchSortType = /* @__PURE__ */ function(SearchSortType
|
|
1422
|
+
let SearchSortType = /* @__PURE__ */ function(SearchSortType) {
|
|
1387
1423
|
/**
|
|
1388
1424
|
* 默认排序
|
|
1389
1425
|
*/
|
|
1390
|
-
SearchSortType
|
|
1426
|
+
SearchSortType["GENERAL"] = "general";
|
|
1391
1427
|
/**
|
|
1392
1428
|
* 最受欢迎(按热度降序)
|
|
1393
1429
|
*/
|
|
1394
|
-
SearchSortType
|
|
1430
|
+
SearchSortType["MOST_POPULAR"] = "popularity_descending";
|
|
1395
1431
|
/**
|
|
1396
1432
|
* 最新发布(按时间降序)
|
|
1397
1433
|
*/
|
|
1398
|
-
SearchSortType
|
|
1399
|
-
return SearchSortType
|
|
1434
|
+
SearchSortType["LATEST"] = "time_descending";
|
|
1435
|
+
return SearchSortType;
|
|
1400
1436
|
}({});
|
|
1401
1437
|
/**
|
|
1402
1438
|
* 搜索笔记类型枚举
|
|
1403
1439
|
*/
|
|
1404
|
-
let SearchNoteType = /* @__PURE__ */ function(SearchNoteType
|
|
1440
|
+
let SearchNoteType = /* @__PURE__ */ function(SearchNoteType) {
|
|
1405
1441
|
/**
|
|
1406
1442
|
* 默认(全部类型)
|
|
1407
1443
|
*/
|
|
1408
|
-
SearchNoteType
|
|
1444
|
+
SearchNoteType[SearchNoteType["ALL"] = 0] = "ALL";
|
|
1409
1445
|
/**
|
|
1410
1446
|
* 仅视频
|
|
1411
1447
|
*/
|
|
1412
|
-
SearchNoteType
|
|
1448
|
+
SearchNoteType[SearchNoteType["VIDEO"] = 1] = "VIDEO";
|
|
1413
1449
|
/**
|
|
1414
1450
|
* 仅图片
|
|
1415
1451
|
*/
|
|
1416
|
-
SearchNoteType
|
|
1417
|
-
return SearchNoteType
|
|
1452
|
+
SearchNoteType[SearchNoteType["IMAGE"] = 2] = "IMAGE";
|
|
1453
|
+
return SearchNoteType;
|
|
1418
1454
|
}({});
|
|
1419
1455
|
/**
|
|
1420
1456
|
* 构建查询字符串
|
|
@@ -1428,17 +1464,22 @@ const buildQueryString$1 = (params) => {
|
|
|
1428
1464
|
* 小红书API地址配置
|
|
1429
1465
|
*/
|
|
1430
1466
|
const xiaohongshuApiUrls = {
|
|
1431
|
-
|
|
1467
|
+
/**
|
|
1468
|
+
* 获取首页推荐数据的接口地址
|
|
1469
|
+
* @param data - 请求参数
|
|
1470
|
+
* @returns 完整的接口URL
|
|
1471
|
+
*/
|
|
1472
|
+
homeFeed(data = {}) {
|
|
1432
1473
|
return {
|
|
1433
1474
|
apiPath: "/api/sns/web/v1/homefeed",
|
|
1434
1475
|
Url: "https://edith.xiaohongshu.com/api/sns/web/v1/homefeed",
|
|
1435
1476
|
Body: {
|
|
1436
|
-
cursor_score: data
|
|
1437
|
-
num: data
|
|
1438
|
-
refresh_type: data
|
|
1439
|
-
note_index: data
|
|
1440
|
-
category: data
|
|
1441
|
-
search_key: data
|
|
1477
|
+
cursor_score: data.cursor_score ?? "1.7599348899670024E9",
|
|
1478
|
+
num: data.num ?? 33,
|
|
1479
|
+
refresh_type: data.refresh_type ?? 3,
|
|
1480
|
+
note_index: data.note_index ?? 33,
|
|
1481
|
+
category: data.category ?? "homefeed_recommend",
|
|
1482
|
+
search_key: data.search_key ?? "",
|
|
1442
1483
|
image_formats: [
|
|
1443
1484
|
"jpg",
|
|
1444
1485
|
"webp",
|
|
@@ -1447,12 +1488,17 @@ const xiaohongshuApiUrls = {
|
|
|
1447
1488
|
}
|
|
1448
1489
|
};
|
|
1449
1490
|
},
|
|
1450
|
-
|
|
1491
|
+
/**
|
|
1492
|
+
* 获取单个笔记数据的接口地址
|
|
1493
|
+
* @param data - 请求参数
|
|
1494
|
+
* @returns 完整的接口URL
|
|
1495
|
+
*/
|
|
1496
|
+
noteDetail(data) {
|
|
1451
1497
|
return {
|
|
1452
1498
|
apiPath: "/api/sns/web/v1/feed",
|
|
1453
1499
|
Url: "https://edith.xiaohongshu.com/api/sns/web/v1/feed",
|
|
1454
1500
|
Body: {
|
|
1455
|
-
source_note_id: data
|
|
1501
|
+
source_note_id: data.note_id,
|
|
1456
1502
|
image_formats: [
|
|
1457
1503
|
"jpg",
|
|
1458
1504
|
"webp",
|
|
@@ -1460,38 +1506,53 @@ const xiaohongshuApiUrls = {
|
|
|
1460
1506
|
],
|
|
1461
1507
|
extra: { need_body_topic: "1" },
|
|
1462
1508
|
xsec_source: "pc_feed",
|
|
1463
|
-
xsec_token: data
|
|
1509
|
+
xsec_token: data.xsec_token
|
|
1464
1510
|
}
|
|
1465
1511
|
};
|
|
1466
1512
|
},
|
|
1467
|
-
|
|
1513
|
+
/**
|
|
1514
|
+
* 获取评论数据的接口地址
|
|
1515
|
+
* @param data - 请求参数
|
|
1516
|
+
* @returns 完整的接口URL
|
|
1517
|
+
*/
|
|
1518
|
+
noteComments(data) {
|
|
1468
1519
|
return {
|
|
1469
1520
|
apiPath: "/api/sns/web/v2/comment/page",
|
|
1470
1521
|
Url: `https://edith.xiaohongshu.com/api/sns/web/v2/comment/page?${buildQueryString$1({
|
|
1471
|
-
note_id: data
|
|
1472
|
-
cursor: data
|
|
1522
|
+
note_id: data.note_id,
|
|
1523
|
+
cursor: data.cursor ?? "",
|
|
1473
1524
|
image_formats: [
|
|
1474
1525
|
"jpg",
|
|
1475
1526
|
"webp",
|
|
1476
1527
|
"avif"
|
|
1477
1528
|
].join(","),
|
|
1478
|
-
xsec_token: data
|
|
1529
|
+
xsec_token: data.xsec_token
|
|
1479
1530
|
})}`
|
|
1480
1531
|
};
|
|
1481
1532
|
},
|
|
1482
|
-
|
|
1533
|
+
/**
|
|
1534
|
+
* 获取用户数据的接口地址
|
|
1535
|
+
* @param data - 请求参数
|
|
1536
|
+
* @returns 完整的接口URL
|
|
1537
|
+
*/
|
|
1538
|
+
userProfile(data) {
|
|
1483
1539
|
return {
|
|
1484
1540
|
apiPath: "/api/sns/web/v1/user/otherinfo",
|
|
1485
|
-
Url: `https://www.xiaohongshu.com/user/profile/${data
|
|
1541
|
+
Url: `https://www.xiaohongshu.com/user/profile/${data.user_id}`
|
|
1486
1542
|
};
|
|
1487
1543
|
},
|
|
1488
|
-
|
|
1544
|
+
/**
|
|
1545
|
+
* 获取用户笔记数据的接口地址
|
|
1546
|
+
* @param data - 请求参数
|
|
1547
|
+
* @returns 完整的接口URL
|
|
1548
|
+
*/
|
|
1549
|
+
userNoteList(data) {
|
|
1489
1550
|
return {
|
|
1490
1551
|
apiPath: "/api/sns/web/v1/user_posted",
|
|
1491
1552
|
Url: `https://edith.xiaohongshu.com/api/sns/web/v1/user_posted?${buildQueryString$1({
|
|
1492
|
-
user_id: data
|
|
1493
|
-
cursor: data
|
|
1494
|
-
num: data
|
|
1553
|
+
user_id: data.user_id,
|
|
1554
|
+
cursor: data.cursor ?? "",
|
|
1555
|
+
num: data.num ?? 30,
|
|
1495
1556
|
image_formats: [
|
|
1496
1557
|
"jpg",
|
|
1497
1558
|
"webp",
|
|
@@ -1501,21 +1562,31 @@ const xiaohongshuApiUrls = {
|
|
|
1501
1562
|
})}`
|
|
1502
1563
|
};
|
|
1503
1564
|
},
|
|
1504
|
-
|
|
1565
|
+
/**
|
|
1566
|
+
* 获取笔记表情列表的接口地址
|
|
1567
|
+
* @param data - 请求参数
|
|
1568
|
+
* @returns 完整的接口URL
|
|
1569
|
+
*/
|
|
1570
|
+
emojiList(data) {
|
|
1505
1571
|
return {
|
|
1506
1572
|
apiPath: "/api/im/redmoji/detail",
|
|
1507
1573
|
Url: "https://edith.xiaohongshu.com/api/im/redmoji/detail"
|
|
1508
1574
|
};
|
|
1509
1575
|
},
|
|
1510
|
-
|
|
1576
|
+
/**
|
|
1577
|
+
* 搜索笔记的接口地址
|
|
1578
|
+
* @param data - 请求参数
|
|
1579
|
+
* @returns 完整的接口URL
|
|
1580
|
+
*/
|
|
1581
|
+
searchNotes(data) {
|
|
1511
1582
|
return {
|
|
1512
1583
|
apiPath: "/api/sns/web/v1/search/notes",
|
|
1513
1584
|
Body: {
|
|
1514
|
-
keyword: data
|
|
1515
|
-
page: data
|
|
1516
|
-
page_size: data
|
|
1517
|
-
sort:
|
|
1518
|
-
note_type:
|
|
1585
|
+
keyword: data.keyword,
|
|
1586
|
+
page: data.page ?? 1,
|
|
1587
|
+
page_size: data.page_size ?? 20,
|
|
1588
|
+
sort: "general",
|
|
1589
|
+
note_type: 0,
|
|
1519
1590
|
search_id: xiaohongshuSign.getSearchId(),
|
|
1520
1591
|
image_formats: [
|
|
1521
1592
|
"jpg",
|
|
@@ -1534,82 +1605,53 @@ const xiaohongshuApiUrls = {
|
|
|
1534
1605
|
const createXiaohongshuApiUrls = () => {
|
|
1535
1606
|
return xiaohongshuApiUrls;
|
|
1536
1607
|
};
|
|
1537
|
-
|
|
1538
1608
|
//#endregion
|
|
1539
1609
|
//#region src/validation/xiaohongshu.ts
|
|
1540
1610
|
const SearchSortTypeValues = Object.values(SearchSortType).filter((v) => typeof v === "string");
|
|
1541
1611
|
const SearchNoteTypeValues = Object.values(SearchNoteType).filter((v) => typeof v === "number");
|
|
1542
1612
|
/**
|
|
1543
|
-
* 小红书首页推荐数据参数验证模式
|
|
1544
|
-
*/
|
|
1545
|
-
const HomeFeedParamsSchema = zod.default.object({
|
|
1546
|
-
methodType: zod.default.literal("homeFeed", { error: "methodType must be \"homeFeed\"" }),
|
|
1547
|
-
cursor_score: zod.default.string({ error: "cursor_score must be a string" }).optional(),
|
|
1548
|
-
num: zod.default.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(),
|
|
1549
|
-
refresh_type: zod.default.coerce.number({ error: "refresh_type must be a number" }).int({ error: "refresh_type must be an integer" }).optional(),
|
|
1550
|
-
note_index: zod.default.coerce.number({ error: "note_index must be a number" }).int({ error: "note_index must be an integer" }).optional(),
|
|
1551
|
-
category: zod.default.string({ error: "category must be a string" }).optional(),
|
|
1552
|
-
search_key: zod.default.string({ error: "search_key must be a string" }).optional()
|
|
1553
|
-
});
|
|
1554
|
-
/**
|
|
1555
|
-
* 小红书单个笔记数据参数验证模式
|
|
1556
|
-
*/
|
|
1557
|
-
const NoteParamsSchema = zod.default.object({
|
|
1558
|
-
methodType: zod.default.literal("noteDetail", { error: "methodType must be \"noteDetail\"" }),
|
|
1559
|
-
note_id: zod.default.string({ error: "note_id must be a string" }),
|
|
1560
|
-
xsec_token: zod.default.string({ error: "xsec_token must be a string" })
|
|
1561
|
-
});
|
|
1562
|
-
/**
|
|
1563
|
-
* 小红书评论数据参数验证模式
|
|
1564
|
-
*/
|
|
1565
|
-
const CommentParamsSchema = zod.default.object({
|
|
1566
|
-
methodType: zod.default.literal("noteComments", { error: "methodType must be \"noteComments\"" }),
|
|
1567
|
-
note_id: zod.default.string({ error: "note_id must be a string" }),
|
|
1568
|
-
cursor: zod.default.string({ error: "cursor must be a string" }).optional(),
|
|
1569
|
-
xsec_token: zod.default.string({ error: "xsec_token must be a string" })
|
|
1570
|
-
});
|
|
1571
|
-
/**
|
|
1572
|
-
* 小红书用户数据参数验证模式
|
|
1573
|
-
*/
|
|
1574
|
-
const UserParamsSchema = zod.default.object({
|
|
1575
|
-
methodType: zod.default.literal("userProfile", { error: "methodType must be \"userProfile\"" }),
|
|
1576
|
-
user_id: zod.default.string({ error: "user_id must be a string" })
|
|
1577
|
-
});
|
|
1578
|
-
/**
|
|
1579
|
-
* 小红书用户笔记数据参数验证模式
|
|
1580
|
-
*/
|
|
1581
|
-
const UserNoteParamsSchema = zod.default.object({
|
|
1582
|
-
methodType: zod.default.literal("userNoteList", { error: "methodType must be \"userNoteList\"" }),
|
|
1583
|
-
user_id: zod.default.string({ error: "user_id must be a string" }),
|
|
1584
|
-
cursor: zod.default.string({ error: "cursor must be a string" }).optional(),
|
|
1585
|
-
num: zod.default.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()
|
|
1586
|
-
});
|
|
1587
|
-
/**
|
|
1588
|
-
* 小红书表情列表参数验证模式
|
|
1589
|
-
*/
|
|
1590
|
-
const EmojiListParamsSchema = zod.default.object({ methodType: zod.default.literal("emojiList", { error: "methodType must be \"emojiList\"" }) });
|
|
1591
|
-
/**
|
|
1592
|
-
* 小红书搜索笔记参数验证模式
|
|
1593
|
-
*/
|
|
1594
|
-
const SearchNoteParamsSchema = zod.default.object({
|
|
1595
|
-
methodType: zod.default.literal("searchNotes", { error: "methodType must be \"searchNotes\"" }),
|
|
1596
|
-
keyword: zod.default.string({ error: "keyword must be a string" }),
|
|
1597
|
-
page: zod.default.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(),
|
|
1598
|
-
page_size: zod.default.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(),
|
|
1599
|
-
sort: zod.default.enum(SearchSortTypeValues, { error: "Invalid sort type" }).optional(),
|
|
1600
|
-
note_type: zod.default.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()
|
|
1601
|
-
});
|
|
1602
|
-
/**
|
|
1603
1613
|
* 小红书验证模式映射
|
|
1604
1614
|
*/
|
|
1605
1615
|
const XiaohongshuValidationSchemas = {
|
|
1606
|
-
homeFeed:
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1616
|
+
homeFeed: zod.default.object({
|
|
1617
|
+
methodType: zod.default.literal("homeFeed", { error: "methodType must be \"homeFeed\"" }),
|
|
1618
|
+
cursor_score: zod.default.string({ error: "cursor_score must be a string" }).optional(),
|
|
1619
|
+
num: zod.default.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(),
|
|
1620
|
+
refresh_type: zod.default.coerce.number({ error: "refresh_type must be a number" }).int({ error: "refresh_type must be an integer" }).optional(),
|
|
1621
|
+
note_index: zod.default.coerce.number({ error: "note_index must be a number" }).int({ error: "note_index must be an integer" }).optional(),
|
|
1622
|
+
category: zod.default.string({ error: "category must be a string" }).optional(),
|
|
1623
|
+
search_key: zod.default.string({ error: "search_key must be a string" }).optional()
|
|
1624
|
+
}),
|
|
1625
|
+
noteDetail: zod.default.object({
|
|
1626
|
+
methodType: zod.default.literal("noteDetail", { error: "methodType must be \"noteDetail\"" }),
|
|
1627
|
+
note_id: zod.default.string({ error: "note_id must be a string" }),
|
|
1628
|
+
xsec_token: zod.default.string({ error: "xsec_token must be a string" })
|
|
1629
|
+
}),
|
|
1630
|
+
noteComments: zod.default.object({
|
|
1631
|
+
methodType: zod.default.literal("noteComments", { error: "methodType must be \"noteComments\"" }),
|
|
1632
|
+
note_id: zod.default.string({ error: "note_id must be a string" }),
|
|
1633
|
+
cursor: zod.default.string({ error: "cursor must be a string" }).optional(),
|
|
1634
|
+
xsec_token: zod.default.string({ error: "xsec_token must be a string" })
|
|
1635
|
+
}),
|
|
1636
|
+
userProfile: zod.default.object({
|
|
1637
|
+
methodType: zod.default.literal("userProfile", { error: "methodType must be \"userProfile\"" }),
|
|
1638
|
+
user_id: zod.default.string({ error: "user_id must be a string" })
|
|
1639
|
+
}),
|
|
1640
|
+
userNoteList: zod.default.object({
|
|
1641
|
+
methodType: zod.default.literal("userNoteList", { error: "methodType must be \"userNoteList\"" }),
|
|
1642
|
+
user_id: zod.default.string({ error: "user_id must be a string" }),
|
|
1643
|
+
cursor: zod.default.string({ error: "cursor must be a string" }).optional(),
|
|
1644
|
+
num: zod.default.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()
|
|
1645
|
+
}),
|
|
1646
|
+
emojiList: zod.default.object({ methodType: zod.default.literal("emojiList", { error: "methodType must be \"emojiList\"" }) }),
|
|
1647
|
+
searchNotes: zod.default.object({
|
|
1648
|
+
methodType: zod.default.literal("searchNotes", { error: "methodType must be \"searchNotes\"" }),
|
|
1649
|
+
keyword: zod.default.string({ error: "keyword must be a string" }),
|
|
1650
|
+
page: zod.default.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(),
|
|
1651
|
+
page_size: zod.default.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(),
|
|
1652
|
+
sort: zod.default.enum(SearchSortTypeValues, { error: "Invalid sort type" }).optional(),
|
|
1653
|
+
note_type: zod.default.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()
|
|
1654
|
+
})
|
|
1613
1655
|
};
|
|
1614
1656
|
/**
|
|
1615
1657
|
* 小红书方法路由映射
|
|
@@ -1623,7 +1665,6 @@ const XiaohongshuMethodRoutes = {
|
|
|
1623
1665
|
emojiList: "/fetch_emoji_list",
|
|
1624
1666
|
searchNotes: "/fetch_search_notes"
|
|
1625
1667
|
};
|
|
1626
|
-
|
|
1627
1668
|
//#endregion
|
|
1628
1669
|
//#region src/validation/index.ts
|
|
1629
1670
|
/**
|
|
@@ -1693,10 +1734,10 @@ const validateXiaohongshuParams = (methodType, params) => {
|
|
|
1693
1734
|
* @param code - 响应状态码(可选,默认200)
|
|
1694
1735
|
* @returns 格式化的成功API响应对象
|
|
1695
1736
|
*/
|
|
1696
|
-
const createSuccessResponse = (data
|
|
1737
|
+
const createSuccessResponse = (data, message, code = 200) => {
|
|
1697
1738
|
return {
|
|
1698
1739
|
success: true,
|
|
1699
|
-
data
|
|
1740
|
+
data,
|
|
1700
1741
|
message,
|
|
1701
1742
|
code,
|
|
1702
1743
|
error: void 0
|
|
@@ -1709,16 +1750,15 @@ const createSuccessResponse = (data$1, message, code = 200) => {
|
|
|
1709
1750
|
* @param code - 错误状态码(可选,默认500)
|
|
1710
1751
|
* @returns 格式化的错误响应对象
|
|
1711
1752
|
*/
|
|
1712
|
-
const createErrorResponse = (error, message, code = 500, data
|
|
1753
|
+
const createErrorResponse = (error, message, code = 500, data) => {
|
|
1713
1754
|
return {
|
|
1714
1755
|
success: false,
|
|
1715
1756
|
error,
|
|
1716
1757
|
message,
|
|
1717
1758
|
code,
|
|
1718
|
-
data
|
|
1759
|
+
data
|
|
1719
1760
|
};
|
|
1720
1761
|
};
|
|
1721
|
-
|
|
1722
1762
|
//#endregion
|
|
1723
1763
|
//#region src/model/fetchers/bilibili/internal.ts
|
|
1724
1764
|
/**
|
|
@@ -1739,15 +1779,20 @@ async function fetchBilibiliInternal(methodType, options, config) {
|
|
|
1739
1779
|
const rawData = await fetchBilibili({ ...validateBilibiliParams(methodType, options) }, config.cookie, config.requestConfig);
|
|
1740
1780
|
const duration = Date.now() - startTime;
|
|
1741
1781
|
if (rawData.code !== 0) {
|
|
1782
|
+
const errorMessage = rawData.message || "B站数据获取失败";
|
|
1742
1783
|
emitApiError({
|
|
1743
1784
|
platform: "bilibili",
|
|
1744
1785
|
methodType,
|
|
1745
1786
|
errorCode: rawData.code,
|
|
1746
|
-
errorMessage
|
|
1787
|
+
errorMessage,
|
|
1747
1788
|
url: void 0,
|
|
1748
1789
|
duration
|
|
1749
1790
|
});
|
|
1750
|
-
return createErrorResponse(rawData.amagiError
|
|
1791
|
+
return createErrorResponse(rawData.amagiError ?? {
|
|
1792
|
+
errorDescription: errorMessage,
|
|
1793
|
+
requestType: methodType,
|
|
1794
|
+
requestUrl: void 0
|
|
1795
|
+
}, errorMessage, rawData.code, rawData);
|
|
1751
1796
|
}
|
|
1752
1797
|
const result = createSuccessResponse(rawData, "获取成功", 200);
|
|
1753
1798
|
emitApiSuccess({
|
|
@@ -1770,7 +1815,6 @@ async function fetchBilibiliInternal(methodType, options, config) {
|
|
|
1770
1815
|
throw new Error(`B站数据获取失败: ${errorMessage}`);
|
|
1771
1816
|
}
|
|
1772
1817
|
}
|
|
1773
|
-
|
|
1774
1818
|
//#endregion
|
|
1775
1819
|
//#region src/model/fetchers/bilibili/article.ts
|
|
1776
1820
|
/**
|
|
@@ -1849,7 +1893,6 @@ async function fetchArticleListInfo(options, cookie, requestConfig) {
|
|
|
1849
1893
|
requestConfig
|
|
1850
1894
|
});
|
|
1851
1895
|
}
|
|
1852
|
-
|
|
1853
1896
|
//#endregion
|
|
1854
1897
|
//#region src/model/fetchers/bilibili/auth.ts
|
|
1855
1898
|
/**
|
|
@@ -1950,7 +1993,6 @@ async function validateCaptchaResult(options, cookie, requestConfig) {
|
|
|
1950
1993
|
requestConfig
|
|
1951
1994
|
});
|
|
1952
1995
|
}
|
|
1953
|
-
|
|
1954
1996
|
//#endregion
|
|
1955
1997
|
//#region src/model/fetchers/bilibili/bangumi.ts
|
|
1956
1998
|
/**
|
|
@@ -1993,7 +2035,6 @@ async function fetchBangumiStreamUrl(options, cookie, requestConfig) {
|
|
|
1993
2035
|
requestConfig
|
|
1994
2036
|
});
|
|
1995
2037
|
}
|
|
1996
|
-
|
|
1997
2038
|
//#endregion
|
|
1998
2039
|
//#region src/model/fetchers/bilibili/comment.ts
|
|
1999
2040
|
/**
|
|
@@ -2037,7 +2078,6 @@ async function fetchCommentReplies$1(options, cookie, requestConfig) {
|
|
|
2037
2078
|
requestConfig
|
|
2038
2079
|
});
|
|
2039
2080
|
}
|
|
2040
|
-
|
|
2041
2081
|
//#endregion
|
|
2042
2082
|
//#region src/model/fetchers/bilibili/dynamic.ts
|
|
2043
2083
|
/**
|
|
@@ -2061,24 +2101,29 @@ async function fetchDynamicDetail(options, cookie, requestConfig) {
|
|
|
2061
2101
|
}
|
|
2062
2102
|
/**
|
|
2063
2103
|
* 获取B站动态卡片信息
|
|
2104
|
+
*
|
|
2105
|
+
* @deprecated v6.1.3 已废弃,B站官方已于 `2025-08-09` 删除原 `dynamic_svr` 接口。
|
|
2106
|
+
* 调用将返回错误信息
|
|
2107
|
+
* 计划于 v7.0.0 移除。
|
|
2108
|
+
*
|
|
2064
2109
|
* @param options - 动态参数
|
|
2065
2110
|
* @param options.dynamic_id - 动态 ID
|
|
2066
2111
|
* @param cookie - B站 Cookie (可选)
|
|
2067
2112
|
* @param requestConfig - 请求配置 (可选)
|
|
2068
|
-
* @returns
|
|
2113
|
+
* @returns 动态卡片数据(已停用,返回错误信息)
|
|
2069
2114
|
* @example
|
|
2070
2115
|
* ```typescript
|
|
2071
2116
|
* const result = await fetchDynamicCard({ dynamic_id: '123456789' }, cookie)
|
|
2072
|
-
*
|
|
2117
|
+
* // result.success === false,错误信息提示接口已停用
|
|
2073
2118
|
* ```
|
|
2074
2119
|
*/
|
|
2075
2120
|
async function fetchDynamicCard(options, cookie, requestConfig) {
|
|
2121
|
+
checkDeprecation("fetchDynamicCard");
|
|
2076
2122
|
return fetchBilibiliInternal("dynamicCard", options, {
|
|
2077
2123
|
cookie,
|
|
2078
2124
|
requestConfig
|
|
2079
2125
|
});
|
|
2080
2126
|
}
|
|
2081
|
-
|
|
2082
2127
|
//#endregion
|
|
2083
2128
|
//#region src/model/fetchers/bilibili/live.ts
|
|
2084
2129
|
/**
|
|
@@ -2119,7 +2164,6 @@ async function fetchLiveRoomInitInfo(options, cookie, requestConfig) {
|
|
|
2119
2164
|
requestConfig
|
|
2120
2165
|
});
|
|
2121
2166
|
}
|
|
2122
|
-
|
|
2123
2167
|
//#endregion
|
|
2124
2168
|
//#region src/model/fetchers/bilibili/user.ts
|
|
2125
2169
|
/**
|
|
@@ -2198,7 +2242,6 @@ async function fetchUploaderTotalViews(options, cookie, requestConfig) {
|
|
|
2198
2242
|
requestConfig
|
|
2199
2243
|
});
|
|
2200
2244
|
}
|
|
2201
|
-
|
|
2202
2245
|
//#endregion
|
|
2203
2246
|
//#region src/model/fetchers/bilibili/utils.ts
|
|
2204
2247
|
/**
|
|
@@ -2258,7 +2301,6 @@ async function fetchEmojiList$3(options, cookie, requestConfig) {
|
|
|
2258
2301
|
requestConfig
|
|
2259
2302
|
});
|
|
2260
2303
|
}
|
|
2261
|
-
|
|
2262
2304
|
//#endregion
|
|
2263
2305
|
//#region src/model/fetchers/bilibili/video.ts
|
|
2264
2306
|
/**
|
|
@@ -2319,7 +2361,6 @@ async function fetchVideoDanmaku(options, cookie, requestConfig) {
|
|
|
2319
2361
|
requestConfig
|
|
2320
2362
|
});
|
|
2321
2363
|
}
|
|
2322
|
-
|
|
2323
2364
|
//#endregion
|
|
2324
2365
|
//#region src/model/fetchers/bilibili/bound.ts
|
|
2325
2366
|
/**
|
|
@@ -2347,6 +2388,7 @@ function createBoundBilibiliFetcher(cookie, requestConfig) {
|
|
|
2347
2388
|
fetchUserSpaceInfo: (options) => fetchUserSpaceInfo(options, cookie, requestConfig),
|
|
2348
2389
|
fetchUploaderTotalViews: (options) => fetchUploaderTotalViews(options, cookie, requestConfig),
|
|
2349
2390
|
fetchDynamicDetail: (options) => fetchDynamicDetail(options, cookie, requestConfig),
|
|
2391
|
+
/** @deprecated v6.1.3 已废弃,调用将返回错误信息 */
|
|
2350
2392
|
fetchDynamicCard: (options) => fetchDynamicCard(options, cookie, requestConfig),
|
|
2351
2393
|
fetchBangumiInfo: (options) => fetchBangumiInfo(options, cookie, requestConfig),
|
|
2352
2394
|
fetchBangumiStreamUrl: (options) => fetchBangumiStreamUrl(options, cookie, requestConfig),
|
|
@@ -2366,7 +2408,6 @@ function createBoundBilibiliFetcher(cookie, requestConfig) {
|
|
|
2366
2408
|
fetchEmojiList: (options) => fetchEmojiList$3(options, cookie, requestConfig)
|
|
2367
2409
|
};
|
|
2368
2410
|
}
|
|
2369
|
-
|
|
2370
2411
|
//#endregion
|
|
2371
2412
|
//#region src/model/fetchers/bilibili/index.ts
|
|
2372
2413
|
/**
|
|
@@ -2412,7 +2453,6 @@ const bilibiliFetcher = {
|
|
|
2412
2453
|
convertBvToAv,
|
|
2413
2454
|
fetchEmojiList: fetchEmojiList$3
|
|
2414
2455
|
};
|
|
2415
|
-
|
|
2416
2456
|
//#endregion
|
|
2417
2457
|
//#region src/platform/defaultConfigs.ts
|
|
2418
2458
|
/**
|
|
@@ -2547,158 +2587,34 @@ const getXiaohongshuDefaultConfig = (cookie) => {
|
|
|
2547
2587
|
cookie: cookie ?? ""
|
|
2548
2588
|
} };
|
|
2549
2589
|
};
|
|
2550
|
-
|
|
2551
2590
|
//#endregion
|
|
2552
2591
|
//#region src/types/NetworksConfigType.ts
|
|
2553
|
-
/** 未知错误 */
|
|
2554
|
-
let amagiAPIErrorCode = /* @__PURE__ */ function(amagiAPIErrorCode$1) {
|
|
2555
|
-
/** 未知错误 */
|
|
2556
|
-
amagiAPIErrorCode$1["UNKNOWN"] = "UNKNOWN_ERROR";
|
|
2557
|
-
return amagiAPIErrorCode$1;
|
|
2558
|
-
}({});
|
|
2559
|
-
/** 抖音平台API错误码 */
|
|
2560
|
-
let douoyinAPIErrorCode = /* @__PURE__ */ function(douoyinAPIErrorCode$1) {
|
|
2561
|
-
/** Cookie无效或已过期 */
|
|
2562
|
-
douoyinAPIErrorCode$1["COOKIE"] = "INVALID_COOKIE";
|
|
2563
|
-
/** 内容被隐藏或下架 */
|
|
2564
|
-
douoyinAPIErrorCode$1["FILTER"] = "CONTENT_FILTERED";
|
|
2565
|
-
/** 当前用户未开播 */
|
|
2566
|
-
douoyinAPIErrorCode$1["NOT_LIVE"] = "USER_NOT_LIVE";
|
|
2567
|
-
/** 未知错误 */
|
|
2568
|
-
douoyinAPIErrorCode$1["UNKNOWN"] = "UNKNOWN_ERROR";
|
|
2569
|
-
return douoyinAPIErrorCode$1;
|
|
2570
|
-
}({});
|
|
2571
|
-
/** B站平台API错误码 */
|
|
2572
|
-
let bilibiliAPIErrorCode = /* @__PURE__ */ function(bilibiliAPIErrorCode$1) {
|
|
2573
|
-
/** 应用程序不存在或已被封禁 */
|
|
2574
|
-
bilibiliAPIErrorCode$1["APP_NOT_FOUND"] = "-1";
|
|
2575
|
-
/** Access Key 错误 */
|
|
2576
|
-
bilibiliAPIErrorCode$1["ACCESS_KEY_ERROR"] = "-2";
|
|
2577
|
-
/** API 校验密匙错误 */
|
|
2578
|
-
bilibiliAPIErrorCode$1["API_KEY_ERROR"] = "-3";
|
|
2579
|
-
/** 调用方对该Method没有权限 */
|
|
2580
|
-
bilibiliAPIErrorCode$1["METHOD_NOT_PERMITTED"] = "-4";
|
|
2581
|
-
/** 账号未登录 */
|
|
2582
|
-
bilibiliAPIErrorCode$1["NOT_LOGGED_IN"] = "-101";
|
|
2583
|
-
/** 账号被封停 */
|
|
2584
|
-
bilibiliAPIErrorCode$1["ACCOUNT_BANNED"] = "-102";
|
|
2585
|
-
/** 积分不足 */
|
|
2586
|
-
bilibiliAPIErrorCode$1["POINTS_INSUFFICIENT"] = "-103";
|
|
2587
|
-
/** 硬币不足 */
|
|
2588
|
-
bilibiliAPIErrorCode$1["COINS_INSUFFICIENT"] = "-104";
|
|
2589
|
-
/** 验证码错误 */
|
|
2590
|
-
bilibiliAPIErrorCode$1["CAPTCHA_ERROR"] = "-105";
|
|
2591
|
-
/** 账号非正式会员或在适应期 */
|
|
2592
|
-
bilibiliAPIErrorCode$1["MEMBERSHIP_LIMITED"] = "-106";
|
|
2593
|
-
/** 应用不存在或者被封禁 */
|
|
2594
|
-
bilibiliAPIErrorCode$1["APP_BANNED"] = "-107";
|
|
2595
|
-
/** 未绑定手机 */
|
|
2596
|
-
bilibiliAPIErrorCode$1["PHONE_NOT_BOUND"] = "-108";
|
|
2597
|
-
/** 未绑定手机 */
|
|
2598
|
-
bilibiliAPIErrorCode$1["PHONE_NOT_BOUND_2"] = "-110";
|
|
2599
|
-
/** csrf 校验失败 */
|
|
2600
|
-
bilibiliAPIErrorCode$1["CSRF_ERROR"] = "-111";
|
|
2601
|
-
/** 系统升级中 */
|
|
2602
|
-
bilibiliAPIErrorCode$1["SYSTEM_UPDATING"] = "-112";
|
|
2603
|
-
/** 账号尚未实名认证 */
|
|
2604
|
-
bilibiliAPIErrorCode$1["NOT_REAL_NAME_VERIFIED"] = "-113";
|
|
2605
|
-
/** 请先绑定手机 */
|
|
2606
|
-
bilibiliAPIErrorCode$1["NEED_BIND_PHONE"] = "-114";
|
|
2607
|
-
/** 请先完成实名认证 */
|
|
2608
|
-
bilibiliAPIErrorCode$1["NEED_REAL_NAME_VERIFICATION"] = "-115";
|
|
2609
|
-
/** 木有改动 */
|
|
2610
|
-
bilibiliAPIErrorCode$1["NO_CHANGE"] = "-304";
|
|
2611
|
-
/** 撞车跳转 */
|
|
2612
|
-
bilibiliAPIErrorCode$1["CONFLICT_REDIRECT"] = "-307";
|
|
2613
|
-
/** 风控校验失败 (UA 或 wbi 参数不合法) */
|
|
2614
|
-
bilibiliAPIErrorCode$1["RISK_CONTROL_FAILED"] = "-352";
|
|
2615
|
-
/** 请求错误 */
|
|
2616
|
-
bilibiliAPIErrorCode$1["BAD_REQUEST"] = "-400";
|
|
2617
|
-
/** 未认证 (或非法请求) */
|
|
2618
|
-
bilibiliAPIErrorCode$1["UNAUTHORIZED"] = "-401";
|
|
2619
|
-
/** 访问权限不足 */
|
|
2620
|
-
bilibiliAPIErrorCode$1["FORBIDDEN"] = "-403";
|
|
2621
|
-
/** 啥都木有 */
|
|
2622
|
-
bilibiliAPIErrorCode$1["NOT_FOUND"] = "-404";
|
|
2623
|
-
/** 不支持该方法 */
|
|
2624
|
-
bilibiliAPIErrorCode$1["METHOD_NOT_ALLOWED"] = "-405";
|
|
2625
|
-
/** 冲突 */
|
|
2626
|
-
bilibiliAPIErrorCode$1["CONFLICT"] = "-409";
|
|
2627
|
-
/** 请求被拦截 (客户端 ip 被服务端风控) */
|
|
2628
|
-
bilibiliAPIErrorCode$1["IP_BLOCKED"] = "-412";
|
|
2629
|
-
/** 服务器错误 */
|
|
2630
|
-
bilibiliAPIErrorCode$1["SERVER_ERROR"] = "-500";
|
|
2631
|
-
/** 过载保护,服务暂不可用 */
|
|
2632
|
-
bilibiliAPIErrorCode$1["SERVICE_UNAVAILABLE"] = "-503";
|
|
2633
|
-
/** 服务调用超时 */
|
|
2634
|
-
bilibiliAPIErrorCode$1["GATEWAY_TIMEOUT"] = "-504";
|
|
2635
|
-
/** 超出限制 */
|
|
2636
|
-
bilibiliAPIErrorCode$1["RATE_LIMITED"] = "-509";
|
|
2637
|
-
/** 上传文件不存在 */
|
|
2638
|
-
bilibiliAPIErrorCode$1["FILE_NOT_FOUND"] = "-616";
|
|
2639
|
-
/** 上传文件太大 */
|
|
2640
|
-
bilibiliAPIErrorCode$1["FILE_TOO_LARGE"] = "-617";
|
|
2641
|
-
/** 登录失败次数太多 */
|
|
2642
|
-
bilibiliAPIErrorCode$1["LOGIN_ATTEMPTS_EXCEEDED"] = "-625";
|
|
2643
|
-
/** 用户不存在 */
|
|
2644
|
-
bilibiliAPIErrorCode$1["USER_NOT_FOUND"] = "-626";
|
|
2645
|
-
/** 密码太弱 */
|
|
2646
|
-
bilibiliAPIErrorCode$1["WEAK_PASSWORD"] = "-628";
|
|
2647
|
-
/** 用户名或密码错误 */
|
|
2648
|
-
bilibiliAPIErrorCode$1["INVALID_CREDENTIALS"] = "-629";
|
|
2649
|
-
/** 操作对象数量限制 */
|
|
2650
|
-
bilibiliAPIErrorCode$1["OBJECT_LIMIT_EXCEEDED"] = "-632";
|
|
2651
|
-
/** 被锁定 */
|
|
2652
|
-
bilibiliAPIErrorCode$1["ACCOUNT_LOCKED"] = "-643";
|
|
2653
|
-
/** 用户等级太低 */
|
|
2654
|
-
bilibiliAPIErrorCode$1["USER_LEVEL_TOO_LOW"] = "-650";
|
|
2655
|
-
/** 重复的用户 */
|
|
2656
|
-
bilibiliAPIErrorCode$1["DUPLICATE_USER"] = "-652";
|
|
2657
|
-
/** Token 过期 */
|
|
2658
|
-
bilibiliAPIErrorCode$1["TOKEN_EXPIRED"] = "-658";
|
|
2659
|
-
/** 密码时间戳过期 */
|
|
2660
|
-
bilibiliAPIErrorCode$1["PASSWORD_TIMESTAMP_EXPIRED"] = "-662";
|
|
2661
|
-
/** 地理区域限制 */
|
|
2662
|
-
bilibiliAPIErrorCode$1["GEO_RESTRICTED"] = "-688";
|
|
2663
|
-
/** 版权限制 */
|
|
2664
|
-
bilibiliAPIErrorCode$1["COPYRIGHT_RESTRICTED"] = "-689";
|
|
2665
|
-
/** 扣节操失败 */
|
|
2666
|
-
bilibiliAPIErrorCode$1["REPUTATION_DEDUCTION_FAILED"] = "-701";
|
|
2667
|
-
/** 请求过于频繁,请稍后再试 */
|
|
2668
|
-
bilibiliAPIErrorCode$1["TOO_MANY_REQUESTS"] = "-799";
|
|
2669
|
-
/** 服务器开小差了 */
|
|
2670
|
-
bilibiliAPIErrorCode$1["SERVER_TEMPORARILY_UNAVAILABLE"] = "-8888";
|
|
2671
|
-
/** 未知错误 */
|
|
2672
|
-
bilibiliAPIErrorCode$1["UNKNOWN"] = "UNKNOWN";
|
|
2673
|
-
return bilibiliAPIErrorCode$1;
|
|
2674
|
-
}({});
|
|
2675
2592
|
/** 快手平台API错误码 */
|
|
2676
|
-
let kuaishouAPIErrorCode = /* @__PURE__ */ function(kuaishouAPIErrorCode
|
|
2593
|
+
let kuaishouAPIErrorCode = /* @__PURE__ */ function(kuaishouAPIErrorCode) {
|
|
2677
2594
|
/** Cookie无效或已过期 */
|
|
2678
|
-
kuaishouAPIErrorCode
|
|
2595
|
+
kuaishouAPIErrorCode["COOKIE"] = "INVALID_COOKIE";
|
|
2679
2596
|
/** 未知错误 */
|
|
2680
|
-
kuaishouAPIErrorCode
|
|
2681
|
-
return kuaishouAPIErrorCode
|
|
2597
|
+
kuaishouAPIErrorCode["UNKNOWN"] = "UNKNOWN_ERROR";
|
|
2598
|
+
return kuaishouAPIErrorCode;
|
|
2682
2599
|
}({});
|
|
2683
2600
|
/** 小红书平台API错误码 */
|
|
2684
|
-
let xiaohongshuAPIErrorCode = /* @__PURE__ */ function(xiaohongshuAPIErrorCode
|
|
2601
|
+
let xiaohongshuAPIErrorCode = /* @__PURE__ */ function(xiaohongshuAPIErrorCode) {
|
|
2685
2602
|
/** Cookie无效或已过期 */
|
|
2686
|
-
xiaohongshuAPIErrorCode
|
|
2603
|
+
xiaohongshuAPIErrorCode["COOKIE"] = "INVALID_COOKIE";
|
|
2687
2604
|
/** 未知错误 */
|
|
2688
|
-
xiaohongshuAPIErrorCode
|
|
2605
|
+
xiaohongshuAPIErrorCode["UNKNOWN"] = "UNKNOWN_ERROR";
|
|
2689
2606
|
/** 非法请求 */
|
|
2690
|
-
xiaohongshuAPIErrorCode
|
|
2607
|
+
xiaohongshuAPIErrorCode[xiaohongshuAPIErrorCode["ILLEGAL_REQUEST"] = 500] = "ILLEGAL_REQUEST";
|
|
2691
2608
|
/** 检测到帐号异常,请稍后重试 */
|
|
2692
|
-
xiaohongshuAPIErrorCode
|
|
2609
|
+
xiaohongshuAPIErrorCode[xiaohongshuAPIErrorCode["ACCOUNT_ABNORMAL"] = 300011] = "ACCOUNT_ABNORMAL";
|
|
2693
2610
|
/** 网络连接异常,请检查网络设置后重试 */
|
|
2694
|
-
xiaohongshuAPIErrorCode
|
|
2611
|
+
xiaohongshuAPIErrorCode[xiaohongshuAPIErrorCode["NETWORK_ERROR"] = 300012] = "NETWORK_ERROR";
|
|
2695
2612
|
/** 访问频次异常,请勿频繁操作 */
|
|
2696
|
-
xiaohongshuAPIErrorCode
|
|
2613
|
+
xiaohongshuAPIErrorCode[xiaohongshuAPIErrorCode["FREQUENCY_ERROR"] = 300013] = "FREQUENCY_ERROR";
|
|
2697
2614
|
/** 浏览器异常,请尝试更换浏览器后重试 */
|
|
2698
|
-
xiaohongshuAPIErrorCode
|
|
2699
|
-
return xiaohongshuAPIErrorCode
|
|
2615
|
+
xiaohongshuAPIErrorCode[xiaohongshuAPIErrorCode["BROWSER_ERROR"] = 300015] = "BROWSER_ERROR";
|
|
2616
|
+
return xiaohongshuAPIErrorCode;
|
|
2700
2617
|
}({});
|
|
2701
|
-
|
|
2702
2618
|
//#endregion
|
|
2703
2619
|
//#region src/platform/douyin/sign/a_bogus.ts
|
|
2704
2620
|
var SM3 = class {
|
|
@@ -2768,7 +2684,7 @@ var SM3 = class {
|
|
|
2768
2684
|
if (t.length < 64) console.error("compress error: not enough data");
|
|
2769
2685
|
else {
|
|
2770
2686
|
for (var f = ((e) => {
|
|
2771
|
-
for (var r = new Array(132), t
|
|
2687
|
+
for (var r = new Array(132), t = 0; t < 16; t++) r[t] = e[4 * t] << 24, r[t] |= e[4 * t + 1] << 16, r[t] |= e[4 * t + 2] << 8, r[t] |= e[4 * t + 3], r[t] >>>= 0;
|
|
2772
2688
|
for (var n = 16; n < 68; n++) {
|
|
2773
2689
|
let a = r[n - 16] ^ r[n - 9] ^ this.le(r[n - 3], 15);
|
|
2774
2690
|
a = a ^ this.le(a, 15) ^ this.le(a, 23), r[n] = (a ^ this.le(r[n - 13], 7) ^ r[n - 6]) >>> 0;
|
|
@@ -2847,18 +2763,17 @@ function rc4_encrypt(plaintext, key) {
|
|
|
2847
2763
|
return cipher.join("");
|
|
2848
2764
|
}
|
|
2849
2765
|
function result_encrypt(long_str, num) {
|
|
2850
|
-
const s_obj = {
|
|
2851
|
-
s0: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
|
2852
|
-
s1: "Dkdpgh4ZKsQB80/Mfvw36XI1R25+WUAlEi7NLboqYTOPuzmFjJnryx9HVGcaStCe=",
|
|
2853
|
-
s2: "Dkdpgh4ZKsQB80/Mfvw36XI1R25-WUAlEi7NLboqYTOPuzmFjJnryx9HVGcaStCe=",
|
|
2854
|
-
s3: "ckdp1h4ZKsUB80/Mfvw36XIgR25+WQAlEi7NLboqYTOPuzmFjJnryx9HVGDaStCe",
|
|
2855
|
-
s4: "Dkdpgh2ZmsQB80/MfvV36XI1R45-WUAlEixNLwoqYTOPuzKFjJnry79HbGcaStCe"
|
|
2856
|
-
};
|
|
2857
2766
|
const constant = {
|
|
2858
2767
|
0: 16515072,
|
|
2859
2768
|
1: 258048,
|
|
2860
2769
|
2: 4032,
|
|
2861
|
-
str:
|
|
2770
|
+
str: {
|
|
2771
|
+
s0: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
|
2772
|
+
s1: "Dkdpgh4ZKsQB80/Mfvw36XI1R25+WUAlEi7NLboqYTOPuzmFjJnryx9HVGcaStCe=",
|
|
2773
|
+
s2: "Dkdpgh4ZKsQB80/Mfvw36XI1R25-WUAlEi7NLboqYTOPuzmFjJnryx9HVGcaStCe=",
|
|
2774
|
+
s3: "ckdp1h4ZKsUB80/Mfvw36XIgR25+WQAlEi7NLboqYTOPuzmFjJnryx9HVGDaStCe",
|
|
2775
|
+
s4: "Dkdpgh2ZmsQB80/MfvV36XI1R45-WUAlEixNLwoqYTOPuzKFjJnry79HbGcaStCe"
|
|
2776
|
+
}[num]
|
|
2862
2777
|
};
|
|
2863
2778
|
let result = "";
|
|
2864
2779
|
let lound = 0;
|
|
@@ -2918,10 +2833,9 @@ function generate_rc4_bb_str(url_search_params, user_agent, window_env_str, suff
|
|
|
2918
2833
|
1,
|
|
2919
2834
|
14
|
|
2920
2835
|
])), "s3"));
|
|
2921
|
-
const end_time = Date.now();
|
|
2922
2836
|
let b = {
|
|
2923
2837
|
8: 3,
|
|
2924
|
-
10:
|
|
2838
|
+
10: Date.now(),
|
|
2925
2839
|
15: {
|
|
2926
2840
|
aid: 6383,
|
|
2927
2841
|
pageId: 6241,
|
|
@@ -3106,7 +3020,6 @@ var a_bogus_default = (url, user_agent) => {
|
|
|
3106
3020
|
const cleanedUserAgent = cleanUserAgentForSigning(user_agent);
|
|
3107
3021
|
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") + "=";
|
|
3108
3022
|
};
|
|
3109
|
-
|
|
3110
3023
|
//#endregion
|
|
3111
3024
|
//#region src/platform/douyin/sign/x_bogus.ts
|
|
3112
3025
|
/**
|
|
@@ -3171,14 +3084,14 @@ var XBogus = class {
|
|
|
3171
3084
|
encodingConversion2(a, b, c) {
|
|
3172
3085
|
return String.fromCharCode(a) + String.fromCharCode(b) + c;
|
|
3173
3086
|
}
|
|
3174
|
-
rc4Encrypt(key, data
|
|
3087
|
+
rc4Encrypt(key, data) {
|
|
3175
3088
|
const keyBuffer = typeof key === "string" ? Buffer.from(key, "latin1") : key;
|
|
3176
|
-
const dataBuffer = Buffer.from(data
|
|
3177
|
-
const S = Array.from({ length: 256 }, (_, i
|
|
3089
|
+
const dataBuffer = Buffer.from(data, "latin1");
|
|
3090
|
+
const S = Array.from({ length: 256 }, (_, i) => i);
|
|
3178
3091
|
let j = 0;
|
|
3179
|
-
for (let i
|
|
3180
|
-
j = (j + S[i
|
|
3181
|
-
[S[i
|
|
3092
|
+
for (let i = 0; i < 256; i++) {
|
|
3093
|
+
j = (j + S[i] + keyBuffer[i % keyBuffer.length]) % 256;
|
|
3094
|
+
[S[i], S[j]] = [S[j], S[i]];
|
|
3182
3095
|
}
|
|
3183
3096
|
const encryptedBuffer = Buffer.alloc(dataBuffer.length);
|
|
3184
3097
|
let i = 0;
|
|
@@ -3270,7 +3183,6 @@ var XBogus = class {
|
|
|
3270
3183
|
};
|
|
3271
3184
|
}
|
|
3272
3185
|
};
|
|
3273
|
-
|
|
3274
3186
|
//#endregion
|
|
3275
3187
|
//#region src/platform/douyin/sign/index.ts
|
|
3276
3188
|
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";
|
|
@@ -3319,7 +3231,6 @@ var douyinSign = class {
|
|
|
3319
3231
|
return "verify_" + n + "_" + r.join("");
|
|
3320
3232
|
}
|
|
3321
3233
|
};
|
|
3322
|
-
|
|
3323
3234
|
//#endregion
|
|
3324
3235
|
//#region src/platform/douyin/API.ts
|
|
3325
3236
|
/**
|
|
@@ -3393,10 +3304,10 @@ var DouyinAPI = class {
|
|
|
3393
3304
|
};
|
|
3394
3305
|
}
|
|
3395
3306
|
/** 获取视频或图集数据 */
|
|
3396
|
-
getWorkDetail(data
|
|
3307
|
+
getWorkDetail(data) {
|
|
3397
3308
|
return `https://www.douyin.com/aweme/v1/web/aweme/detail/?${buildQueryString({
|
|
3398
3309
|
...this.getBaseParams(),
|
|
3399
|
-
aweme_id: data
|
|
3310
|
+
aweme_id: data.aweme_id,
|
|
3400
3311
|
update_version_code: "170400",
|
|
3401
3312
|
version_code: "190500",
|
|
3402
3313
|
version_name: "19.5.0",
|
|
@@ -3407,12 +3318,12 @@ var DouyinAPI = class {
|
|
|
3407
3318
|
})}`;
|
|
3408
3319
|
}
|
|
3409
3320
|
/** 获取评论数据 */
|
|
3410
|
-
getComments(data
|
|
3321
|
+
getComments(data) {
|
|
3411
3322
|
return `https://www.douyin.com/aweme/v1/web/comment/list/?${buildQueryString({
|
|
3412
3323
|
...this.getBaseParams(),
|
|
3413
|
-
aweme_id: data
|
|
3414
|
-
cursor: data
|
|
3415
|
-
count: data
|
|
3324
|
+
aweme_id: data.aweme_id,
|
|
3325
|
+
cursor: data.cursor ?? 0,
|
|
3326
|
+
count: data.number ?? 50,
|
|
3416
3327
|
item_type: "0",
|
|
3417
3328
|
insert_ids: "",
|
|
3418
3329
|
whale_cut_token: "",
|
|
@@ -3426,16 +3337,16 @@ var DouyinAPI = class {
|
|
|
3426
3337
|
})}`;
|
|
3427
3338
|
}
|
|
3428
3339
|
/** 获取二级评论数据 */
|
|
3429
|
-
getCommentReplies(data
|
|
3340
|
+
getCommentReplies(data) {
|
|
3430
3341
|
return `https://www-hj.douyin.com/aweme/v1/web/comment/list/reply/?${buildQueryString({
|
|
3431
3342
|
device_platform: "webapp",
|
|
3432
3343
|
aid: "6383",
|
|
3433
3344
|
channel: "channel_pc_web",
|
|
3434
|
-
item_id: data
|
|
3435
|
-
comment_id: data
|
|
3345
|
+
item_id: data.aweme_id,
|
|
3346
|
+
comment_id: data.comment_id,
|
|
3436
3347
|
cut_version: "1",
|
|
3437
|
-
cursor: data
|
|
3438
|
-
count: data
|
|
3348
|
+
cursor: data.cursor,
|
|
3349
|
+
count: data.number,
|
|
3439
3350
|
item_type: "0",
|
|
3440
3351
|
update_version_code: "170400",
|
|
3441
3352
|
pc_client_type: "1",
|
|
@@ -3468,12 +3379,12 @@ var DouyinAPI = class {
|
|
|
3468
3379
|
})}`;
|
|
3469
3380
|
}
|
|
3470
3381
|
/** 获取动图数据 */
|
|
3471
|
-
getSlidesInfo(data
|
|
3382
|
+
getSlidesInfo(data) {
|
|
3472
3383
|
return `https://www.iesdouyin.com/web/api/v2/aweme/slidesinfo/?${buildQueryString({
|
|
3473
3384
|
reflow_source: "reflow_page",
|
|
3474
3385
|
web_id: "7326472315356857893",
|
|
3475
3386
|
device_id: "7326472315356857893",
|
|
3476
|
-
aweme_ids: `[${data
|
|
3387
|
+
aweme_ids: `[${data.aweme_id}]`,
|
|
3477
3388
|
request_source: "200",
|
|
3478
3389
|
msToken: douyinSign.Mstoken(116),
|
|
3479
3390
|
verifyFp: fp,
|
|
@@ -3485,18 +3396,18 @@ var DouyinAPI = class {
|
|
|
3485
3396
|
return "https://www.douyin.com/aweme/v1/web/emoji/list";
|
|
3486
3397
|
}
|
|
3487
3398
|
/** 获取用户主页视频数据 */
|
|
3488
|
-
getUserVideoList(data
|
|
3399
|
+
getUserVideoList(data) {
|
|
3489
3400
|
return `https://www.douyin.com/aweme/v1/web/aweme/post/?${buildQueryString({
|
|
3490
3401
|
...this.getBaseParams(),
|
|
3491
|
-
sec_user_id: data
|
|
3492
|
-
max_cursor: data
|
|
3402
|
+
sec_user_id: data.sec_uid,
|
|
3403
|
+
max_cursor: data.max_cursor ?? "0",
|
|
3493
3404
|
locate_query: "false",
|
|
3494
3405
|
show_live_replay_strategy: "1",
|
|
3495
3406
|
need_time_list: "1",
|
|
3496
3407
|
time_list_query: "0",
|
|
3497
3408
|
whale_cut_token: "",
|
|
3498
3409
|
cut_version: "1",
|
|
3499
|
-
count: data
|
|
3410
|
+
count: data.number ?? 18,
|
|
3500
3411
|
publish_video_strategy_type: "2",
|
|
3501
3412
|
version_code: "170400",
|
|
3502
3413
|
version_name: "17.4.0",
|
|
@@ -3507,15 +3418,15 @@ var DouyinAPI = class {
|
|
|
3507
3418
|
})}`;
|
|
3508
3419
|
}
|
|
3509
3420
|
/** 获取用户喜欢列表数据 */
|
|
3510
|
-
getUserFavoriteList(data
|
|
3421
|
+
getUserFavoriteList(data) {
|
|
3511
3422
|
return `https://www-hj.douyin.com/aweme/v1/web/aweme/favorite/?${buildQueryString({
|
|
3512
3423
|
...this.getBaseParams(),
|
|
3513
|
-
sec_user_id: data
|
|
3514
|
-
max_cursor: data
|
|
3424
|
+
sec_user_id: data.sec_uid,
|
|
3425
|
+
max_cursor: data.max_cursor ?? "0",
|
|
3515
3426
|
min_cursor: "0",
|
|
3516
3427
|
whale_cut_token: "",
|
|
3517
3428
|
cut_version: "1",
|
|
3518
|
-
count: data
|
|
3429
|
+
count: data.number ?? 18,
|
|
3519
3430
|
publish_video_strategy_type: "2",
|
|
3520
3431
|
update_version_code: "170400",
|
|
3521
3432
|
pc_libra_divert: "Windows",
|
|
@@ -3530,16 +3441,16 @@ var DouyinAPI = class {
|
|
|
3530
3441
|
})}`;
|
|
3531
3442
|
}
|
|
3532
3443
|
/** 获取用户推荐列表数据 */
|
|
3533
|
-
getUserRecommendList(data
|
|
3444
|
+
getUserRecommendList(data) {
|
|
3534
3445
|
return `https://www.douyin.com/aweme/v1/web/familiar/recommend/feed/?${buildQueryString({
|
|
3535
3446
|
device_platform: "",
|
|
3536
3447
|
aid: "6383",
|
|
3537
3448
|
channel: "channel_pc_web",
|
|
3538
|
-
sec_user_id: data
|
|
3539
|
-
max_cursor: data
|
|
3449
|
+
sec_user_id: data.sec_uid,
|
|
3450
|
+
max_cursor: data.max_cursor ?? "0",
|
|
3540
3451
|
min_cursor: "0",
|
|
3541
3452
|
whale_cut_token: "",
|
|
3542
|
-
count: data
|
|
3453
|
+
count: data.number ?? 18,
|
|
3543
3454
|
from: "1",
|
|
3544
3455
|
update_version_code: "170400",
|
|
3545
3456
|
pc_client_type: "1",
|
|
@@ -3573,12 +3484,12 @@ var DouyinAPI = class {
|
|
|
3573
3484
|
})}`;
|
|
3574
3485
|
}
|
|
3575
3486
|
/** 获取用户主页信息 */
|
|
3576
|
-
getUserProfile(data
|
|
3487
|
+
getUserProfile(data) {
|
|
3577
3488
|
return `https://www.douyin.com/aweme/v1/web/user/profile/other/?${buildQueryString({
|
|
3578
3489
|
...this.getBaseParams(),
|
|
3579
3490
|
publish_video_strategy_type: "2",
|
|
3580
3491
|
source: "channel_pc_web",
|
|
3581
|
-
sec_user_id: data
|
|
3492
|
+
sec_user_id: data.sec_uid,
|
|
3582
3493
|
personal_center_strategy: "1",
|
|
3583
3494
|
version_code: "170400",
|
|
3584
3495
|
version_name: "17.4.0",
|
|
@@ -3589,10 +3500,10 @@ var DouyinAPI = class {
|
|
|
3589
3500
|
})}`;
|
|
3590
3501
|
}
|
|
3591
3502
|
/** 获取热点词数据 */
|
|
3592
|
-
getSuggestWords(data
|
|
3503
|
+
getSuggestWords(data) {
|
|
3593
3504
|
return `https://www.douyin.com/aweme/v1/web/api/suggest_words/?${buildQueryString({
|
|
3594
3505
|
...this.getBaseParams(),
|
|
3595
|
-
query: data
|
|
3506
|
+
query: data.query,
|
|
3596
3507
|
business_id: "30088",
|
|
3597
3508
|
from_group_id: "7129543174929812767",
|
|
3598
3509
|
version_code: "170400",
|
|
@@ -3604,16 +3515,16 @@ var DouyinAPI = class {
|
|
|
3604
3515
|
})}`;
|
|
3605
3516
|
}
|
|
3606
3517
|
/** 获取搜索数据 */
|
|
3607
|
-
search(data
|
|
3608
|
-
const searchType = data
|
|
3609
|
-
const { verifyFp, fp
|
|
3518
|
+
search(data) {
|
|
3519
|
+
const searchType = data.type ?? "general";
|
|
3520
|
+
const { verifyFp, fp, ...baseParamsWithoutFp } = this.getBaseParams();
|
|
3610
3521
|
if (searchType === "user") return `https://www.douyin.com/aweme/v1/web/discover/search/?${buildQueryString({
|
|
3611
3522
|
...baseParamsWithoutFp,
|
|
3612
|
-
count: data
|
|
3523
|
+
count: data.number ?? 10,
|
|
3613
3524
|
disable_rs: "0",
|
|
3614
3525
|
from_group_id: "",
|
|
3615
3526
|
is_filter_search: "0",
|
|
3616
|
-
keyword: data
|
|
3527
|
+
keyword: data.query,
|
|
3617
3528
|
list_type: "single",
|
|
3618
3529
|
need_filter_settings: "1",
|
|
3619
3530
|
offset: "0",
|
|
@@ -3630,16 +3541,16 @@ var DouyinAPI = class {
|
|
|
3630
3541
|
version_code: "170400",
|
|
3631
3542
|
version_name: "17.4.0",
|
|
3632
3543
|
webid: "7521399115230610959",
|
|
3633
|
-
...data
|
|
3544
|
+
...data.search_id && { search_id: data.search_id }
|
|
3634
3545
|
})}`;
|
|
3635
3546
|
else if (searchType === "video") return `https://www.douyin.com/aweme/v1/web/search/item/?${buildQueryString({
|
|
3636
3547
|
...baseParamsWithoutFp,
|
|
3637
|
-
count: data
|
|
3548
|
+
count: data.number ?? 10,
|
|
3638
3549
|
disable_rs: "0",
|
|
3639
3550
|
enable_history: "1",
|
|
3640
3551
|
from_group_id: "",
|
|
3641
3552
|
is_filter_search: "0",
|
|
3642
|
-
keyword: data
|
|
3553
|
+
keyword: data.query,
|
|
3643
3554
|
list_type: "single",
|
|
3644
3555
|
need_filter_settings: "1",
|
|
3645
3556
|
offset: "0",
|
|
@@ -3656,15 +3567,15 @@ var DouyinAPI = class {
|
|
|
3656
3567
|
version_code: "170400",
|
|
3657
3568
|
version_name: "17.4.0",
|
|
3658
3569
|
webid: "7521399115230610959",
|
|
3659
|
-
...data
|
|
3570
|
+
...data.search_id && { search_id: data.search_id }
|
|
3660
3571
|
})}`;
|
|
3661
3572
|
else return `https://www.douyin.com/aweme/v1/web/general/search/stream/?${buildQueryString({
|
|
3662
3573
|
...baseParamsWithoutFp,
|
|
3663
|
-
count: data
|
|
3574
|
+
count: data.number ?? 10,
|
|
3664
3575
|
disable_rs: "0",
|
|
3665
3576
|
enable_history: "1",
|
|
3666
3577
|
is_filter_search: "0",
|
|
3667
|
-
keyword: data
|
|
3578
|
+
keyword: data.query,
|
|
3668
3579
|
list_type: "",
|
|
3669
3580
|
need_filter_settings: "1",
|
|
3670
3581
|
offset: "0",
|
|
@@ -3720,12 +3631,12 @@ var DouyinAPI = class {
|
|
|
3720
3631
|
})}`;
|
|
3721
3632
|
}
|
|
3722
3633
|
/** 获取背景音乐数据 */
|
|
3723
|
-
getMusicInfo(data
|
|
3634
|
+
getMusicInfo(data) {
|
|
3724
3635
|
return `https://www.douyin.com/aweme/v1/web/music/detail/?${buildQueryString({
|
|
3725
3636
|
device_platform: "webapp",
|
|
3726
3637
|
aid: "6383",
|
|
3727
3638
|
channel: "channel_pc_web",
|
|
3728
|
-
music_id: data
|
|
3639
|
+
music_id: data.music_id,
|
|
3729
3640
|
scene: "1",
|
|
3730
3641
|
pc_client_type: "1",
|
|
3731
3642
|
version_code: "170400",
|
|
@@ -3755,7 +3666,7 @@ var DouyinAPI = class {
|
|
|
3755
3666
|
})}`;
|
|
3756
3667
|
}
|
|
3757
3668
|
/** 获取直播间信息 */
|
|
3758
|
-
getLiveRoomInfo(data
|
|
3669
|
+
getLiveRoomInfo(data) {
|
|
3759
3670
|
return `https://live.douyin.com/webcast/room/web/enter/?${buildQueryString({
|
|
3760
3671
|
aid: "6383",
|
|
3761
3672
|
app_name: "douyin_web",
|
|
@@ -3770,8 +3681,8 @@ var DouyinAPI = class {
|
|
|
3770
3681
|
browser_platform: "Win32",
|
|
3771
3682
|
browser_name: "Chrome",
|
|
3772
3683
|
browser_version: "125.0.0.0",
|
|
3773
|
-
web_rid: data
|
|
3774
|
-
room_id_str: data
|
|
3684
|
+
web_rid: data.web_rid,
|
|
3685
|
+
room_id_str: data.room_id,
|
|
3775
3686
|
enter_source: "",
|
|
3776
3687
|
is_need_double_stream: "false",
|
|
3777
3688
|
insert_task_id: "",
|
|
@@ -3782,23 +3693,23 @@ var DouyinAPI = class {
|
|
|
3782
3693
|
})}`;
|
|
3783
3694
|
}
|
|
3784
3695
|
/** 申请登录二维码 */
|
|
3785
|
-
getLoginQrcode(data
|
|
3696
|
+
getLoginQrcode(data) {
|
|
3786
3697
|
return `https://sso.douyin.com/get_qrcode/?${buildQueryString({
|
|
3787
|
-
verifyFp: data
|
|
3788
|
-
fp: data
|
|
3698
|
+
verifyFp: data.verify_fp,
|
|
3699
|
+
fp: data.verify_fp
|
|
3789
3700
|
})}`;
|
|
3790
3701
|
}
|
|
3791
3702
|
/** 获取弹幕数据 */
|
|
3792
|
-
getDanmakuList(data
|
|
3703
|
+
getDanmakuList(data) {
|
|
3793
3704
|
return `https://www-hj.douyin.com/aweme/v1/web/danmaku/get_v2/?${buildQueryString({
|
|
3794
3705
|
...this.getBaseParams(),
|
|
3795
3706
|
app_name: "aweme",
|
|
3796
3707
|
format: "json",
|
|
3797
|
-
group_id: data
|
|
3798
|
-
item_id: data
|
|
3799
|
-
start_time: data
|
|
3800
|
-
end_time: data
|
|
3801
|
-
duration: data
|
|
3708
|
+
group_id: data.aweme_id,
|
|
3709
|
+
item_id: data.aweme_id,
|
|
3710
|
+
start_time: data.start_time ?? "0",
|
|
3711
|
+
end_time: data.end_time ?? "32000",
|
|
3712
|
+
duration: data.duration,
|
|
3802
3713
|
update_version_code: "170400",
|
|
3803
3714
|
pc_libra_divert: "Windows",
|
|
3804
3715
|
support_h265: "1",
|
|
@@ -3831,7 +3742,6 @@ const createDouyinApiUrls = (userAgent) => {
|
|
|
3831
3742
|
};
|
|
3832
3743
|
/** 默认的 DouyinAPI 实例(使用默认浏览器版本 125.0.0.0) */
|
|
3833
3744
|
const douyinApiUrls = new DouyinAPI();
|
|
3834
|
-
|
|
3835
3745
|
//#endregion
|
|
3836
3746
|
//#region src/platform/douyin/getdata.ts
|
|
3837
3747
|
/**
|
|
@@ -3855,7 +3765,6 @@ const douyinApiUrls = new DouyinAPI();
|
|
|
3855
3765
|
const getSignature = (url, signType = "a_bogus", userAgent) => {
|
|
3856
3766
|
switch (signType) {
|
|
3857
3767
|
case "x_bogus": return douyinSign.XB(url, userAgent);
|
|
3858
|
-
case "a_bogus":
|
|
3859
3768
|
default: return douyinSign.AB(url, userAgent);
|
|
3860
3769
|
}
|
|
3861
3770
|
};
|
|
@@ -3868,7 +3777,6 @@ const getSignature = (url, signType = "a_bogus", userAgent) => {
|
|
|
3868
3777
|
const getSignParamName = (signType = "a_bogus") => {
|
|
3869
3778
|
switch (signType) {
|
|
3870
3779
|
case "x_bogus": return "X-Bogus";
|
|
3871
|
-
case "a_bogus":
|
|
3872
3780
|
default: return "a_bogus";
|
|
3873
3781
|
}
|
|
3874
3782
|
};
|
|
@@ -3892,7 +3800,7 @@ const buildSignedUrl = (url, signType = "a_bogus", userAgent) => {
|
|
|
3892
3800
|
* @param requestConfig - 外部请求配置(优先级最高)
|
|
3893
3801
|
* @returns 返回抖音数据
|
|
3894
3802
|
*/
|
|
3895
|
-
const DouyinData = async (data
|
|
3803
|
+
const DouyinData = async (data, cookie, requestConfig) => {
|
|
3896
3804
|
const defHeaders = getDouyinDefaultConfig(cookie)["headers"];
|
|
3897
3805
|
const baseRequestConfig = {
|
|
3898
3806
|
method: "GET",
|
|
@@ -3904,28 +3812,28 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
3904
3812
|
}
|
|
3905
3813
|
};
|
|
3906
3814
|
const userAgent = baseRequestConfig.headers?.["User-Agent"];
|
|
3907
|
-
const douyinApiUrls
|
|
3908
|
-
const signType = data
|
|
3909
|
-
switch (data
|
|
3815
|
+
const douyinApiUrls = createDouyinApiUrls(userAgent);
|
|
3816
|
+
const signType = data.signType ?? "a_bogus";
|
|
3817
|
+
switch (data.methodType) {
|
|
3910
3818
|
case "textWork":
|
|
3911
3819
|
case "parseWork":
|
|
3912
3820
|
case "videoWork":
|
|
3913
3821
|
case "imageAlbumWork":
|
|
3914
3822
|
case "slidesWork": {
|
|
3915
|
-
const url = douyinApiUrls
|
|
3916
|
-
return await GlobalGetData$3(data
|
|
3823
|
+
const url = douyinApiUrls.getWorkDetail({ aweme_id: data.aweme_id });
|
|
3824
|
+
return await GlobalGetData$3(data.methodType, {
|
|
3917
3825
|
...baseRequestConfig,
|
|
3918
3826
|
url: buildSignedUrl(url, signType, userAgent)
|
|
3919
3827
|
});
|
|
3920
3828
|
}
|
|
3921
3829
|
case "comments": {
|
|
3922
|
-
const urlGenerator = (params) => douyinApiUrls
|
|
3830
|
+
const urlGenerator = (params) => douyinApiUrls.getComments(params);
|
|
3923
3831
|
return await fetchPaginatedData({
|
|
3924
|
-
type: data
|
|
3832
|
+
type: data.methodType,
|
|
3925
3833
|
apiUrlGenerator: urlGenerator,
|
|
3926
3834
|
params: {
|
|
3927
|
-
...data
|
|
3928
|
-
cursor: data
|
|
3835
|
+
...data,
|
|
3836
|
+
cursor: data.cursor ?? 0
|
|
3929
3837
|
},
|
|
3930
3838
|
maxPageSize: 50,
|
|
3931
3839
|
requestConfig: baseRequestConfig,
|
|
@@ -3944,13 +3852,13 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
3944
3852
|
});
|
|
3945
3853
|
}
|
|
3946
3854
|
case "commentReplies": {
|
|
3947
|
-
const urlGenerator = (params) => douyinApiUrls
|
|
3855
|
+
const urlGenerator = (params) => douyinApiUrls.getCommentReplies(params);
|
|
3948
3856
|
return await fetchPaginatedData({
|
|
3949
|
-
type: data
|
|
3857
|
+
type: data.methodType,
|
|
3950
3858
|
apiUrlGenerator: urlGenerator,
|
|
3951
3859
|
params: {
|
|
3952
|
-
...data
|
|
3953
|
-
cursor: data
|
|
3860
|
+
...data,
|
|
3861
|
+
cursor: data.cursor ?? 0
|
|
3954
3862
|
},
|
|
3955
3863
|
maxPageSize: 3,
|
|
3956
3864
|
requestConfig: baseRequestConfig,
|
|
@@ -3969,41 +3877,41 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
3969
3877
|
});
|
|
3970
3878
|
}
|
|
3971
3879
|
case "userProfile": {
|
|
3972
|
-
const url = douyinApiUrls
|
|
3880
|
+
const url = douyinApiUrls.getUserProfile({ sec_uid: data.sec_uid });
|
|
3973
3881
|
const customConfig = {
|
|
3974
3882
|
...baseRequestConfig,
|
|
3975
3883
|
headers: {
|
|
3976
3884
|
...baseRequestConfig.headers,
|
|
3977
|
-
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data
|
|
3885
|
+
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data.sec_uid}` }
|
|
3978
3886
|
}
|
|
3979
3887
|
};
|
|
3980
|
-
return await GlobalGetData$3(data
|
|
3888
|
+
return await GlobalGetData$3(data.methodType, {
|
|
3981
3889
|
...customConfig,
|
|
3982
3890
|
url: buildSignedUrl(url, signType, userAgent)
|
|
3983
3891
|
});
|
|
3984
3892
|
}
|
|
3985
3893
|
case "emojiList": {
|
|
3986
|
-
const url = douyinApiUrls
|
|
3987
|
-
return await GlobalGetData$3(data
|
|
3894
|
+
const url = douyinApiUrls.getEmojiList();
|
|
3895
|
+
return await GlobalGetData$3(data.methodType, {
|
|
3988
3896
|
...baseRequestConfig,
|
|
3989
3897
|
url
|
|
3990
3898
|
});
|
|
3991
3899
|
}
|
|
3992
3900
|
case "userVideoList": {
|
|
3993
|
-
const urlGenerator = (params) => douyinApiUrls
|
|
3901
|
+
const urlGenerator = (params) => douyinApiUrls.getUserVideoList(params);
|
|
3994
3902
|
return await fetchPaginatedData({
|
|
3995
|
-
type: data
|
|
3903
|
+
type: data.methodType,
|
|
3996
3904
|
apiUrlGenerator: urlGenerator,
|
|
3997
3905
|
params: {
|
|
3998
|
-
...data
|
|
3999
|
-
max_cursor: data
|
|
3906
|
+
...data,
|
|
3907
|
+
max_cursor: data.max_cursor
|
|
4000
3908
|
},
|
|
4001
3909
|
maxPageSize: 18,
|
|
4002
3910
|
requestConfig: {
|
|
4003
3911
|
...baseRequestConfig,
|
|
4004
3912
|
headers: {
|
|
4005
3913
|
...baseRequestConfig.headers,
|
|
4006
|
-
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data
|
|
3914
|
+
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data.sec_uid}` }
|
|
4007
3915
|
}
|
|
4008
3916
|
},
|
|
4009
3917
|
signType,
|
|
@@ -4020,20 +3928,20 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4020
3928
|
});
|
|
4021
3929
|
}
|
|
4022
3930
|
case "userFavoriteList": {
|
|
4023
|
-
const urlGenerator = (params) => douyinApiUrls
|
|
3931
|
+
const urlGenerator = (params) => douyinApiUrls.getUserFavoriteList(params);
|
|
4024
3932
|
return await fetchPaginatedData({
|
|
4025
|
-
type: data
|
|
3933
|
+
type: data.methodType,
|
|
4026
3934
|
apiUrlGenerator: urlGenerator,
|
|
4027
3935
|
params: {
|
|
4028
|
-
...data
|
|
4029
|
-
max_cursor: data
|
|
3936
|
+
...data,
|
|
3937
|
+
max_cursor: data.max_cursor
|
|
4030
3938
|
},
|
|
4031
3939
|
maxPageSize: 18,
|
|
4032
3940
|
requestConfig: {
|
|
4033
3941
|
...baseRequestConfig,
|
|
4034
3942
|
headers: {
|
|
4035
3943
|
...baseRequestConfig.headers,
|
|
4036
|
-
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data
|
|
3944
|
+
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data.sec_uid}` }
|
|
4037
3945
|
}
|
|
4038
3946
|
},
|
|
4039
3947
|
signType,
|
|
@@ -4050,20 +3958,20 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4050
3958
|
});
|
|
4051
3959
|
}
|
|
4052
3960
|
case "userRecommendList": {
|
|
4053
|
-
const urlGenerator = (params) => douyinApiUrls
|
|
3961
|
+
const urlGenerator = (params) => douyinApiUrls.getUserRecommendList(params);
|
|
4054
3962
|
return await fetchPaginatedData({
|
|
4055
|
-
type: data
|
|
3963
|
+
type: data.methodType,
|
|
4056
3964
|
apiUrlGenerator: urlGenerator,
|
|
4057
3965
|
params: {
|
|
4058
|
-
...data
|
|
4059
|
-
max_cursor: data
|
|
3966
|
+
...data,
|
|
3967
|
+
max_cursor: data.max_cursor
|
|
4060
3968
|
},
|
|
4061
3969
|
maxPageSize: 18,
|
|
4062
3970
|
requestConfig: {
|
|
4063
3971
|
...baseRequestConfig,
|
|
4064
3972
|
headers: {
|
|
4065
3973
|
...baseRequestConfig.headers,
|
|
4066
|
-
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data
|
|
3974
|
+
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data.sec_uid}` }
|
|
4067
3975
|
}
|
|
4068
3976
|
},
|
|
4069
3977
|
signType,
|
|
@@ -4080,22 +3988,22 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4080
3988
|
});
|
|
4081
3989
|
}
|
|
4082
3990
|
case "suggestWords": {
|
|
4083
|
-
const url = douyinApiUrls
|
|
3991
|
+
const url = douyinApiUrls.getSuggestWords({ query: data.query });
|
|
4084
3992
|
const customConfig = {
|
|
4085
3993
|
...baseRequestConfig,
|
|
4086
3994
|
headers: {
|
|
4087
3995
|
...baseRequestConfig.headers,
|
|
4088
|
-
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/search/${encodeURIComponent(String(data
|
|
3996
|
+
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/search/${encodeURIComponent(String(data.query))}` }
|
|
4089
3997
|
}
|
|
4090
3998
|
};
|
|
4091
|
-
return await GlobalGetData$3(data
|
|
3999
|
+
return await GlobalGetData$3(data.methodType, {
|
|
4092
4000
|
...customConfig,
|
|
4093
4001
|
url: buildSignedUrl(url, signType, userAgent)
|
|
4094
4002
|
});
|
|
4095
4003
|
}
|
|
4096
4004
|
case "search": {
|
|
4097
|
-
const searchType = data
|
|
4098
|
-
const refererUrl = searchType === "user" ? `https://www.douyin.com/search/${encodeURIComponent(String(data
|
|
4005
|
+
const searchType = data.type ?? "general";
|
|
4006
|
+
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))}`;
|
|
4099
4007
|
const customConfig = {
|
|
4100
4008
|
...baseRequestConfig,
|
|
4101
4009
|
headers: {
|
|
@@ -4106,12 +4014,12 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4106
4014
|
const isUserSearch = searchType === "user";
|
|
4107
4015
|
const isVideoSearch = searchType === "video";
|
|
4108
4016
|
return await fetchPaginatedData({
|
|
4109
|
-
type: data
|
|
4110
|
-
apiUrlGenerator: (params) => douyinApiUrls
|
|
4017
|
+
type: data.methodType,
|
|
4018
|
+
apiUrlGenerator: (params) => douyinApiUrls.search(params),
|
|
4111
4019
|
params: {
|
|
4112
|
-
query: data
|
|
4113
|
-
type: data
|
|
4114
|
-
number: data
|
|
4020
|
+
query: data.query,
|
|
4021
|
+
type: data.type,
|
|
4022
|
+
number: data.number ?? 10,
|
|
4115
4023
|
search_id: ""
|
|
4116
4024
|
},
|
|
4117
4025
|
maxPageSize: 15,
|
|
@@ -4162,16 +4070,16 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4162
4070
|
const desc = `抖音${typeStr}搜索返回无有效数据,疑似触发反爬机制,你的抖音Cookie可能已经失效!`;
|
|
4163
4071
|
const warningMessage = `
|
|
4164
4072
|
获取响应数据失败!原因:${logger.yellow(`${typeStr}搜索返回无有效数据,疑似触发反爬机制`)}
|
|
4165
|
-
请求类型:「${data
|
|
4166
|
-
搜索关键词:「${data
|
|
4073
|
+
请求类型:「${data.methodType}」
|
|
4074
|
+
搜索关键词:「${data.query}」
|
|
4167
4075
|
请求URL:${url}
|
|
4168
4076
|
`;
|
|
4169
4077
|
return {
|
|
4170
|
-
code:
|
|
4078
|
+
code: "INVALID_COOKIE",
|
|
4171
4079
|
data: raw,
|
|
4172
4080
|
amagiError: {
|
|
4173
4081
|
errorDescription: desc,
|
|
4174
|
-
requestType: data
|
|
4082
|
+
requestType: data.methodType ?? "未知请求类型",
|
|
4175
4083
|
requestUrl: url
|
|
4176
4084
|
},
|
|
4177
4085
|
amagiMessage: warningMessage
|
|
@@ -4181,8 +4089,8 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4181
4089
|
const desc = `抖音${typeStr}搜索接口第一次请求就返回空数组,可能该关键词无搜索结果或触发风控限制,你的抖音Cookie可能已经失效!`;
|
|
4182
4090
|
const warningMessage = `
|
|
4183
4091
|
获取响应数据失败!原因:${logger.yellow(`${typeStr}搜索接口第一次请求就返回空数组,你的抖音Cookie可能已经失效!`)}
|
|
4184
|
-
请求类型:「${data
|
|
4185
|
-
搜索关键词:「${data
|
|
4092
|
+
请求类型:「${data.methodType}」
|
|
4093
|
+
搜索关键词:「${data.query}」
|
|
4186
4094
|
请求URL:${url}
|
|
4187
4095
|
`;
|
|
4188
4096
|
logger.warn(warningMessage);
|
|
@@ -4190,7 +4098,7 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4190
4098
|
data: raw,
|
|
4191
4099
|
amagiError: {
|
|
4192
4100
|
errorDescription: desc,
|
|
4193
|
-
requestType: data
|
|
4101
|
+
requestType: data.methodType ?? "未知请求类型",
|
|
4194
4102
|
requestUrl: url
|
|
4195
4103
|
},
|
|
4196
4104
|
amagiMessage: warningMessage
|
|
@@ -4211,57 +4119,57 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4211
4119
|
});
|
|
4212
4120
|
}
|
|
4213
4121
|
case "dynamicEmojiList": {
|
|
4214
|
-
const url = douyinApiUrls
|
|
4215
|
-
return await GlobalGetData$3(data
|
|
4122
|
+
const url = douyinApiUrls.getDynamicEmojiList();
|
|
4123
|
+
return await GlobalGetData$3(data.methodType, {
|
|
4216
4124
|
...baseRequestConfig,
|
|
4217
4125
|
url: buildSignedUrl(url, signType, userAgent)
|
|
4218
4126
|
});
|
|
4219
4127
|
}
|
|
4220
4128
|
case "musicInfo": {
|
|
4221
|
-
const url = douyinApiUrls
|
|
4222
|
-
return await GlobalGetData$3(data
|
|
4129
|
+
const url = douyinApiUrls.getMusicInfo({ music_id: data.music_id });
|
|
4130
|
+
return await GlobalGetData$3(data.methodType, {
|
|
4223
4131
|
...baseRequestConfig,
|
|
4224
4132
|
url: buildSignedUrl(url, signType, userAgent)
|
|
4225
4133
|
});
|
|
4226
4134
|
}
|
|
4227
4135
|
case "liveRoomInfo": {
|
|
4228
|
-
let url = douyinApiUrls
|
|
4229
|
-
room_id: data
|
|
4230
|
-
web_rid: data
|
|
4136
|
+
let url = douyinApiUrls.getLiveRoomInfo({
|
|
4137
|
+
room_id: data.room_id,
|
|
4138
|
+
web_rid: data.web_rid
|
|
4231
4139
|
});
|
|
4232
4140
|
const liveCustomConfig = {
|
|
4233
4141
|
...baseRequestConfig,
|
|
4234
4142
|
url: buildSignedUrl(url, signType, userAgent),
|
|
4235
4143
|
headers: {
|
|
4236
4144
|
...baseRequestConfig.headers,
|
|
4237
|
-
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://live.douyin.com/${data
|
|
4145
|
+
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://live.douyin.com/${data.web_rid}` }
|
|
4238
4146
|
}
|
|
4239
4147
|
};
|
|
4240
|
-
return await GlobalGetData$3(data
|
|
4148
|
+
return await GlobalGetData$3(data.methodType, {
|
|
4241
4149
|
...liveCustomConfig,
|
|
4242
4150
|
url: buildSignedUrl(url, signType, userAgent)
|
|
4243
4151
|
});
|
|
4244
4152
|
}
|
|
4245
4153
|
case "loginQrcode": {
|
|
4246
|
-
const url = douyinApiUrls
|
|
4247
|
-
return await GlobalGetData$3(data
|
|
4154
|
+
const url = douyinApiUrls.getLoginQrcode({ verify_fp: data.verify_fp });
|
|
4155
|
+
return await GlobalGetData$3(data.methodType, {
|
|
4248
4156
|
...baseRequestConfig,
|
|
4249
4157
|
url: buildSignedUrl(url, signType, userAgent)
|
|
4250
4158
|
});
|
|
4251
4159
|
}
|
|
4252
4160
|
case "danmakuList": {
|
|
4253
4161
|
const MAX_SEGMENT_DURATION = 32e3;
|
|
4254
|
-
const startTime = data
|
|
4255
|
-
const endTime = data
|
|
4162
|
+
const startTime = data.start_time ?? 0;
|
|
4163
|
+
const endTime = data.end_time ?? data.duration;
|
|
4256
4164
|
const totalDuration = endTime - startTime;
|
|
4257
4165
|
if (totalDuration <= MAX_SEGMENT_DURATION) {
|
|
4258
|
-
const url = douyinApiUrls
|
|
4259
|
-
aweme_id: data
|
|
4166
|
+
const url = douyinApiUrls.getDanmakuList({
|
|
4167
|
+
aweme_id: data.aweme_id,
|
|
4260
4168
|
start_time: startTime,
|
|
4261
4169
|
end_time: endTime,
|
|
4262
|
-
duration: data
|
|
4170
|
+
duration: data.duration
|
|
4263
4171
|
});
|
|
4264
|
-
return await GlobalGetData$3(data
|
|
4172
|
+
return await GlobalGetData$3(data.methodType, {
|
|
4265
4173
|
...baseRequestConfig,
|
|
4266
4174
|
url: buildSignedUrl(url, signType, userAgent)
|
|
4267
4175
|
});
|
|
@@ -4278,14 +4186,14 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4278
4186
|
}
|
|
4279
4187
|
logger.debug(`弹幕数据需要分${segments.length}段获取,总时长:${totalDuration}ms`);
|
|
4280
4188
|
const segmentPromises = segments.map(async (segment, index) => {
|
|
4281
|
-
const url = douyinApiUrls
|
|
4282
|
-
aweme_id: data
|
|
4189
|
+
const url = douyinApiUrls.getDanmakuList({
|
|
4190
|
+
aweme_id: data.aweme_id,
|
|
4283
4191
|
start_time: segment.start,
|
|
4284
4192
|
end_time: segment.end,
|
|
4285
|
-
duration: data
|
|
4193
|
+
duration: data.duration
|
|
4286
4194
|
});
|
|
4287
4195
|
try {
|
|
4288
|
-
const segmentData = await GlobalGetData$3(`${data
|
|
4196
|
+
const segmentData = await GlobalGetData$3(`${data.methodType}-segment${index + 1}`, {
|
|
4289
4197
|
...baseRequestConfig,
|
|
4290
4198
|
url: buildSignedUrl(url, signType, userAgent)
|
|
4291
4199
|
});
|
|
@@ -4325,15 +4233,15 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4325
4233
|
return finalDanmakuData;
|
|
4326
4234
|
}
|
|
4327
4235
|
default: {
|
|
4328
|
-
const customUrl = data
|
|
4236
|
+
const customUrl = data.custom_url;
|
|
4329
4237
|
if (typeof customUrl === "string" && customUrl.length > 0) {
|
|
4330
4238
|
const url = buildSignedUrl(customUrl, signType, userAgent);
|
|
4331
|
-
return await GlobalGetData$3(data
|
|
4239
|
+
return await GlobalGetData$3(data.methodType ?? "customRequest", {
|
|
4332
4240
|
...baseRequestConfig,
|
|
4333
4241
|
url
|
|
4334
4242
|
});
|
|
4335
4243
|
}
|
|
4336
|
-
logger.warn(`未知的抖音数据接口:「${logger.red(data
|
|
4244
|
+
logger.warn(`未知的抖音数据接口:「${logger.red(data.methodType)}」`);
|
|
4337
4245
|
return null;
|
|
4338
4246
|
}
|
|
4339
4247
|
}
|
|
@@ -4408,7 +4316,7 @@ const GlobalGetData$3 = async (type, config) => {
|
|
|
4408
4316
|
logger.warn(warningMessage);
|
|
4409
4317
|
const cookieError = new Error(Err.errorDescription);
|
|
4410
4318
|
Object.assign(cookieError, {
|
|
4411
|
-
code:
|
|
4319
|
+
code: "INVALID_COOKIE",
|
|
4412
4320
|
data: result,
|
|
4413
4321
|
amagiError: Err
|
|
4414
4322
|
});
|
|
@@ -4429,7 +4337,7 @@ const GlobalGetData$3 = async (type, config) => {
|
|
|
4429
4337
|
logger.warn(warningMessage);
|
|
4430
4338
|
const filterError = new Error(Err.errorDescription);
|
|
4431
4339
|
Object.assign(filterError, {
|
|
4432
|
-
code:
|
|
4340
|
+
code: "CONTENT_FILTERED",
|
|
4433
4341
|
data: result,
|
|
4434
4342
|
amagiError: Err
|
|
4435
4343
|
});
|
|
@@ -4442,7 +4350,7 @@ const GlobalGetData$3 = async (type, config) => {
|
|
|
4442
4350
|
amagiMessage: warningMessage
|
|
4443
4351
|
};
|
|
4444
4352
|
return {
|
|
4445
|
-
code:
|
|
4353
|
+
code: "UNKNOWN_ERROR",
|
|
4446
4354
|
data: null,
|
|
4447
4355
|
amagiError: {
|
|
4448
4356
|
errorDescription: "未知错误",
|
|
@@ -4481,7 +4389,6 @@ const parseDouyinMultiJson = (raw) => {
|
|
|
4481
4389
|
const filterSearchResponses = (objs) => {
|
|
4482
4390
|
return objs.filter((o) => o && typeof o.cursor === "number" && typeof o.has_more === "number" && Array.isArray(o.data));
|
|
4483
4391
|
};
|
|
4484
|
-
|
|
4485
4392
|
//#endregion
|
|
4486
4393
|
//#region src/model/fetchers/douyin/internal.ts
|
|
4487
4394
|
/**
|
|
@@ -4533,7 +4440,6 @@ async function fetchDouyinInternal(methodType, options, config) {
|
|
|
4533
4440
|
throw new Error(`抖音数据获取失败: ${errorMessage}`);
|
|
4534
4441
|
}
|
|
4535
4442
|
}
|
|
4536
|
-
|
|
4537
4443
|
//#endregion
|
|
4538
4444
|
//#region src/model/fetchers/douyin/comment.ts
|
|
4539
4445
|
/**
|
|
@@ -4581,7 +4487,6 @@ async function fetchCommentReplies(options, cookie, requestConfig) {
|
|
|
4581
4487
|
requestConfig
|
|
4582
4488
|
});
|
|
4583
4489
|
}
|
|
4584
|
-
|
|
4585
4490
|
//#endregion
|
|
4586
4491
|
//#region src/model/fetchers/douyin/misc.ts
|
|
4587
4492
|
/**
|
|
@@ -4678,7 +4583,6 @@ async function fetchDynamicEmojiList(options, cookie, requestConfig) {
|
|
|
4678
4583
|
requestConfig
|
|
4679
4584
|
});
|
|
4680
4585
|
}
|
|
4681
|
-
|
|
4682
4586
|
//#endregion
|
|
4683
4587
|
//#region src/model/fetchers/douyin/search.ts
|
|
4684
4588
|
/**
|
|
@@ -4727,7 +4631,6 @@ async function fetchSuggestWords(options, cookie, requestConfig) {
|
|
|
4727
4631
|
requestConfig
|
|
4728
4632
|
});
|
|
4729
4633
|
}
|
|
4730
|
-
|
|
4731
4634
|
//#endregion
|
|
4732
4635
|
//#region src/model/fetchers/douyin/user.ts
|
|
4733
4636
|
/**
|
|
@@ -4812,7 +4715,6 @@ async function fetchUserRecommendList(options, cookie, requestConfig) {
|
|
|
4812
4715
|
requestConfig
|
|
4813
4716
|
});
|
|
4814
4717
|
}
|
|
4815
|
-
|
|
4816
4718
|
//#endregion
|
|
4817
4719
|
//#region src/model/fetchers/douyin/video.ts
|
|
4818
4720
|
/**
|
|
@@ -4929,7 +4831,6 @@ async function fetchDanmakuList(options, cookie, requestConfig) {
|
|
|
4929
4831
|
requestConfig
|
|
4930
4832
|
});
|
|
4931
4833
|
}
|
|
4932
|
-
|
|
4933
4834
|
//#endregion
|
|
4934
4835
|
//#region src/model/fetchers/douyin/bound.ts
|
|
4935
4836
|
/**
|
|
@@ -4968,7 +4869,6 @@ function createBoundDouyinFetcher(cookie, requestConfig) {
|
|
|
4968
4869
|
fetchDynamicEmojiList: (options, reqConfig) => fetchDynamicEmojiList(options, cookie, reqConfig ?? requestConfig)
|
|
4969
4870
|
};
|
|
4970
4871
|
}
|
|
4971
|
-
|
|
4972
4872
|
//#endregion
|
|
4973
4873
|
//#region src/model/fetchers/douyin/index.ts
|
|
4974
4874
|
/**
|
|
@@ -5006,7 +4906,6 @@ const douyinFetcher = {
|
|
|
5006
4906
|
fetchEmojiList: fetchEmojiList$2,
|
|
5007
4907
|
fetchDynamicEmojiList
|
|
5008
4908
|
};
|
|
5009
|
-
|
|
5010
4909
|
//#endregion
|
|
5011
4910
|
//#region src/platform/kuaishou/API.ts
|
|
5012
4911
|
/**
|
|
@@ -5044,14 +4943,19 @@ var API = class {
|
|
|
5044
4943
|
* @param data - 作品参数
|
|
5045
4944
|
* @returns 请求配置
|
|
5046
4945
|
*/
|
|
5047
|
-
videoWork(data
|
|
4946
|
+
videoWork(data) {
|
|
5048
4947
|
return {
|
|
4948
|
+
/** 接口类型 */
|
|
5049
4949
|
type: "visionVideoDetail",
|
|
4950
|
+
/** 请求url */
|
|
5050
4951
|
url: "https://www.kuaishou.com/graphql",
|
|
4952
|
+
/** 请求参数 */
|
|
5051
4953
|
body: {
|
|
4954
|
+
/** 接口类型 */
|
|
5052
4955
|
operationName: "visionVideoDetail",
|
|
5053
4956
|
variables: {
|
|
5054
|
-
|
|
4957
|
+
/** 作品ID */
|
|
4958
|
+
photoId: data.photoId,
|
|
5055
4959
|
page: "detail"
|
|
5056
4960
|
},
|
|
5057
4961
|
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"
|
|
@@ -5063,14 +4967,14 @@ var API = class {
|
|
|
5063
4967
|
* @param data - 评论参数
|
|
5064
4968
|
* @returns 请求配置
|
|
5065
4969
|
*/
|
|
5066
|
-
comments(data
|
|
4970
|
+
comments(data) {
|
|
5067
4971
|
return {
|
|
5068
4972
|
type: "commentListQuery",
|
|
5069
4973
|
url: "https://www.kuaishou.com/graphql",
|
|
5070
4974
|
body: {
|
|
5071
4975
|
operationName: "commentListQuery",
|
|
5072
4976
|
variables: {
|
|
5073
|
-
photoId: data
|
|
4977
|
+
photoId: data.photoId,
|
|
5074
4978
|
pcursor: ""
|
|
5075
4979
|
},
|
|
5076
4980
|
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"
|
|
@@ -5086,10 +4990,10 @@ var API = class {
|
|
|
5086
4990
|
* @param data - 用户主页参数
|
|
5087
4991
|
* @returns 请求配置
|
|
5088
4992
|
*/
|
|
5089
|
-
userInfoById(data
|
|
4993
|
+
userInfoById(data) {
|
|
5090
4994
|
return createKuaishouLiveApiRequest("userInfoById", "/live_api/baseuser/userinfo/byid", {
|
|
5091
4995
|
caver: 2,
|
|
5092
|
-
principalId: data
|
|
4996
|
+
principalId: data.principalId
|
|
5093
4997
|
}, { signPath: "/rest/k/user/info" });
|
|
5094
4998
|
}
|
|
5095
4999
|
/**
|
|
@@ -5097,10 +5001,10 @@ var API = class {
|
|
|
5097
5001
|
* @param data - 用户主页参数
|
|
5098
5002
|
* @returns 请求配置
|
|
5099
5003
|
*/
|
|
5100
|
-
userSensitiveInfo(data
|
|
5004
|
+
userSensitiveInfo(data) {
|
|
5101
5005
|
return createKuaishouLiveApiRequest("userSensitiveInfo", "/live_api/baseuser/userinfo/sensitive", {
|
|
5102
5006
|
caver: 2,
|
|
5103
|
-
principalId: data
|
|
5007
|
+
principalId: data.principalId
|
|
5104
5008
|
}, { signPath: "/rest/k/user/info/sensitive" });
|
|
5105
5009
|
}
|
|
5106
5010
|
/**
|
|
@@ -5108,13 +5012,13 @@ var API = class {
|
|
|
5108
5012
|
* @param data - 用户主页参数
|
|
5109
5013
|
* @returns 请求配置
|
|
5110
5014
|
*/
|
|
5111
|
-
profilePublic(data
|
|
5015
|
+
profilePublic(data) {
|
|
5112
5016
|
return createKuaishouLiveApiRequest("profilePublic", "/live_api/profile/public", {
|
|
5113
5017
|
caver: 2,
|
|
5114
|
-
count: "count" in data
|
|
5018
|
+
count: "count" in data ? data.count ?? 12 : 12,
|
|
5115
5019
|
hasMore: true,
|
|
5116
|
-
pcursor: "pcursor" in data
|
|
5117
|
-
principalId: data
|
|
5020
|
+
pcursor: "pcursor" in data ? data.pcursor ?? "" : "",
|
|
5021
|
+
principalId: data.principalId,
|
|
5118
5022
|
privacy: "public"
|
|
5119
5023
|
}, { signPath: "/rest/k/feed/profile" });
|
|
5120
5024
|
}
|
|
@@ -5127,9 +5031,9 @@ var API = class {
|
|
|
5127
5031
|
* @param data - 用户作品列表参数
|
|
5128
5032
|
* @returns 请求配置
|
|
5129
5033
|
*/
|
|
5130
|
-
userWorkList(data
|
|
5034
|
+
userWorkList(data) {
|
|
5131
5035
|
return {
|
|
5132
|
-
...this.profilePublic(data
|
|
5036
|
+
...this.profilePublic(data),
|
|
5133
5037
|
type: "userWorkList"
|
|
5134
5038
|
};
|
|
5135
5039
|
}
|
|
@@ -5141,13 +5045,13 @@ var API = class {
|
|
|
5141
5045
|
* @param data - 用户主页参数
|
|
5142
5046
|
* @returns 请求配置
|
|
5143
5047
|
*/
|
|
5144
|
-
profilePrivate(data
|
|
5048
|
+
profilePrivate(data) {
|
|
5145
5049
|
return createKuaishouLiveApiRequest("profilePrivate", "/live_api/profile/private", {
|
|
5146
5050
|
caver: 2,
|
|
5147
5051
|
count: 12,
|
|
5148
5052
|
hasMore: true,
|
|
5149
5053
|
pcursor: "",
|
|
5150
|
-
principalId: data
|
|
5054
|
+
principalId: data.principalId,
|
|
5151
5055
|
privacy: "private"
|
|
5152
5056
|
}, { requiresSign: false });
|
|
5153
5057
|
}
|
|
@@ -5157,13 +5061,13 @@ var API = class {
|
|
|
5157
5061
|
* @param data - 用户主页参数
|
|
5158
5062
|
* @returns 请求配置
|
|
5159
5063
|
*/
|
|
5160
|
-
profileLiked(data
|
|
5064
|
+
profileLiked(data) {
|
|
5161
5065
|
return createKuaishouLiveApiRequest("profileLiked", "/live_api/profile/liked", {
|
|
5162
5066
|
caver: 2,
|
|
5163
5067
|
count: 12,
|
|
5164
5068
|
hasMore: true,
|
|
5165
5069
|
pcursor: "",
|
|
5166
|
-
principalId: data
|
|
5070
|
+
principalId: data.principalId,
|
|
5167
5071
|
privacy: "liked"
|
|
5168
5072
|
}, { requiresSign: false });
|
|
5169
5073
|
}
|
|
@@ -5172,11 +5076,11 @@ var API = class {
|
|
|
5172
5076
|
* @param data - 用户主页参数
|
|
5173
5077
|
* @returns 请求配置
|
|
5174
5078
|
*/
|
|
5175
|
-
profileInterestList(data
|
|
5079
|
+
profileInterestList(data) {
|
|
5176
5080
|
return createKuaishouLiveApiRequest("profileInterestList", "/live_api/profile/interestlist", {
|
|
5177
5081
|
caver: 2,
|
|
5178
5082
|
limit: 4,
|
|
5179
|
-
principalId: data
|
|
5083
|
+
principalId: data.principalId
|
|
5180
5084
|
});
|
|
5181
5085
|
}
|
|
5182
5086
|
/**
|
|
@@ -5187,9 +5091,9 @@ var API = class {
|
|
|
5187
5091
|
* @param data - 用户主页参数
|
|
5188
5092
|
* @returns 请求配置
|
|
5189
5093
|
*/
|
|
5190
|
-
playbackList(data
|
|
5094
|
+
playbackList(data) {
|
|
5191
5095
|
return createKuaishouLiveApiRequest("playbackList", "/live_api/playback/list", {
|
|
5192
|
-
principalId: data
|
|
5096
|
+
principalId: data.principalId,
|
|
5193
5097
|
count: 12,
|
|
5194
5098
|
cursor: "",
|
|
5195
5099
|
hasMore: true
|
|
@@ -5251,8 +5155,8 @@ var API = class {
|
|
|
5251
5155
|
* @param authToken - 私密房间等场景下可能需要的 authToken
|
|
5252
5156
|
* @returns 请求配置
|
|
5253
5157
|
*/
|
|
5254
|
-
liveDetail(data
|
|
5255
|
-
const query = { principalId: data
|
|
5158
|
+
liveDetail(data, authToken) {
|
|
5159
|
+
const query = { principalId: data.principalId };
|
|
5256
5160
|
if (authToken?.trim()) query.authToken = authToken.trim();
|
|
5257
5161
|
return createKuaishouLiveApiRequest("liveDetail", "/live_api/liveroom/livedetail", query, { requiresSign: false });
|
|
5258
5162
|
}
|
|
@@ -5334,7 +5238,6 @@ var API = class {
|
|
|
5334
5238
|
* 该对象只负责返回请求描述,不直接发起网络请求。
|
|
5335
5239
|
*/
|
|
5336
5240
|
const kuaishouApiUrls = new API();
|
|
5337
|
-
|
|
5338
5241
|
//#endregion
|
|
5339
5242
|
//#region src/platform/kuaishou/sign/hudr.ts
|
|
5340
5243
|
const KUAISHOU_HUDR_PREFIX = "HUDR_";
|
|
@@ -5528,7 +5431,6 @@ const deriveKuaishouHudrBody = (context) => {
|
|
|
5528
5431
|
nextCount: context.count + 1
|
|
5529
5432
|
};
|
|
5530
5433
|
};
|
|
5531
|
-
|
|
5532
5434
|
//#endregion
|
|
5533
5435
|
//#region src/platform/kuaishou/sign/primitives.ts
|
|
5534
5436
|
const KUAISHOU_BLAKE2S_IV = [
|
|
@@ -6005,7 +5907,6 @@ const transformKuaishouHeHex = (prefixHex, checksumHex) => {
|
|
|
6005
5907
|
output[input.length - 1] = xorKey;
|
|
6006
5908
|
return bytesToLowerHex(output);
|
|
6007
5909
|
};
|
|
6008
|
-
|
|
6009
5910
|
//#endregion
|
|
6010
5911
|
//#region src/platform/kuaishou/sign/he.ts
|
|
6011
5912
|
const KUAISHOU_HE_HEADER_HEX = "4B54";
|
|
@@ -6089,7 +5990,6 @@ const deriveKuaishouPureSignature = (context) => {
|
|
|
6089
5990
|
signResult: `${hudr.full}$HE_${he.finalHex}`
|
|
6090
5991
|
};
|
|
6091
5992
|
};
|
|
6092
|
-
|
|
6093
5993
|
//#endregion
|
|
6094
5994
|
//#region src/platform/kuaishou/sign/helpers.ts
|
|
6095
5995
|
const SIGN_INPUT_SKIP_KEYWORD = "__NS";
|
|
@@ -6178,7 +6078,7 @@ const buildKuaishouHxfalconSignInput = (payload) => {
|
|
|
6178
6078
|
*/
|
|
6179
6079
|
const extractCookieValue = (cookie, key) => {
|
|
6180
6080
|
if (!cookie?.trim()) return "";
|
|
6181
|
-
const pattern =
|
|
6081
|
+
const pattern = new RegExp(`(?:^|;\\s*)${key}=([^;]*)`);
|
|
6182
6082
|
return cookie.match(pattern)?.[1] ?? "";
|
|
6183
6083
|
};
|
|
6184
6084
|
const generateKuaishouAnonymousKwwSeed = () => {
|
|
@@ -6221,7 +6121,6 @@ const deriveKuaishouKww = (cookie) => {
|
|
|
6221
6121
|
if (kwfv1) return kwfv1;
|
|
6222
6122
|
return deriveKuaishouAnonymousKww();
|
|
6223
6123
|
};
|
|
6224
|
-
|
|
6225
6124
|
//#endregion
|
|
6226
6125
|
//#region src/platform/kuaishou/sign/state.ts
|
|
6227
6126
|
const KUAISHOU_DEFAULT_CAT_VERSION = "2";
|
|
@@ -6277,7 +6176,6 @@ const getKuaishouPureRuntimeState = () => {
|
|
|
6277
6176
|
};
|
|
6278
6177
|
return pureRuntimeState;
|
|
6279
6178
|
};
|
|
6280
|
-
|
|
6281
6179
|
//#endregion
|
|
6282
6180
|
//#region src/platform/kuaishou/sign/index.ts
|
|
6283
6181
|
/**
|
|
@@ -6370,7 +6268,6 @@ var kuaishouSign = class {
|
|
|
6370
6268
|
return this.signLiveApiUrl(request.url, cookie, request.signPath);
|
|
6371
6269
|
}
|
|
6372
6270
|
};
|
|
6373
|
-
|
|
6374
6271
|
//#endregion
|
|
6375
6272
|
//#region src/platform/kuaishou/getdata.ts
|
|
6376
6273
|
/**
|
|
@@ -6930,7 +6827,7 @@ const dedupeLiveRoomPlayList = (items) => {
|
|
|
6930
6827
|
* @param requestConfig - 外部请求配置(优先级最高)
|
|
6931
6828
|
* @returns 返回快手数据;当前 user/live 能力已优先走纯协议聚合链路
|
|
6932
6829
|
*/
|
|
6933
|
-
const KuaishouData = async (data
|
|
6830
|
+
const KuaishouData = async (data, cookie, requestConfig) => {
|
|
6934
6831
|
const defHeaders = getKuaishouDefaultConfig(cookie)["headers"];
|
|
6935
6832
|
const baseRequestConfig = {
|
|
6936
6833
|
method: "POST",
|
|
@@ -6968,27 +6865,27 @@ const KuaishouData = async (data$1, cookie, requestConfig) => {
|
|
|
6968
6865
|
const fetchKuaishouLiveApiPayload = (type, request, refererPath, config) => {
|
|
6969
6866
|
return GlobalGetData$2(type, buildLiveApiRequestConfig(request, refererPath, cookie, requestConfig), config);
|
|
6970
6867
|
};
|
|
6971
|
-
switch (data
|
|
6972
|
-
case "videoWork": return fetchKuaishouGraphqlPayload(data
|
|
6973
|
-
case "comments": return fetchKuaishouGraphqlPayload(data
|
|
6868
|
+
switch (data.methodType) {
|
|
6869
|
+
case "videoWork": return fetchKuaishouGraphqlPayload(data.methodType, kuaishouApiUrls.videoWork({ photoId: data.photoId }));
|
|
6870
|
+
case "comments": return fetchKuaishouGraphqlPayload(data.methodType, kuaishouApiUrls.comments({ photoId: data.photoId }));
|
|
6974
6871
|
case "userProfile": {
|
|
6975
|
-
const refererPath = `profile/${encodeURIComponent(data
|
|
6872
|
+
const refererPath = `profile/${encodeURIComponent(data.principalId)}`;
|
|
6976
6873
|
const [userInfoPayload, sensitivePayload, publicPayload, privatePayload, likedPayload, playbackPayload, interestListPayload, interestMaskPayload, categoryConfigPayload, categoryDataPayload, categoryClassifyPayload, liveDetailPayload] = await Promise.all([
|
|
6977
|
-
fetchKuaishouLiveApiPayload(data
|
|
6978
|
-
fetchKuaishouLiveApiPayload(data
|
|
6979
|
-
fetchKuaishouLiveApiPayload(data
|
|
6980
|
-
fetchKuaishouLiveApiPayload(data
|
|
6981
|
-
fetchKuaishouLiveApiPayload(data
|
|
6982
|
-
fetchKuaishouLiveApiPayload(data
|
|
6983
|
-
fetchKuaishouLiveApiPayload(data
|
|
6984
|
-
fetchKuaishouLiveApiPayload(data
|
|
6985
|
-
fetchKuaishouLiveApiPayload(data
|
|
6986
|
-
fetchKuaishouLiveApiPayload(data
|
|
6987
|
-
fetchKuaishouLiveApiPayload(data
|
|
6988
|
-
fetchKuaishouLiveApiPayload(data
|
|
6874
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.userInfoById({ principalId: data.principalId }), refererPath),
|
|
6875
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.userSensitiveInfo({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
6876
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.profilePublic({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
6877
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.profilePrivate({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
6878
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.profileLiked({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
6879
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.playbackList({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
6880
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.profileInterestList({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
6881
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.interestMaskList(), refererPath, { allowResult2: true }),
|
|
6882
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.categoryConfig(), refererPath),
|
|
6883
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.categoryData(), refererPath),
|
|
6884
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.categoryClassify(), refererPath),
|
|
6885
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.liveDetail({ principalId: data.principalId }), refererPath, { allowResult2: true })
|
|
6989
6886
|
]);
|
|
6990
6887
|
if (isErrorDetailLike(userInfoPayload)) return userInfoPayload;
|
|
6991
|
-
const userProfile = createEmptyUserProfileResult(data
|
|
6888
|
+
const userProfile = createEmptyUserProfileResult(data.principalId);
|
|
6992
6889
|
const userInfo = userInfoPayload?.data?.userInfo;
|
|
6993
6890
|
const sensitiveInfo = isErrorDetailLike(sensitivePayload) ? null : sensitivePayload?.data?.sensitiveUserInfo ?? null;
|
|
6994
6891
|
const liveDetailData = resolveKuaishouLiveDetailData(liveDetailPayload);
|
|
@@ -7002,10 +6899,10 @@ const KuaishouData = async (data$1, cookie, requestConfig) => {
|
|
|
7002
6899
|
const nextInterestMask = !isErrorDetailLike(interestMaskPayload) && Array.isArray(interestMaskPayload?.data) ? interestMaskPayload.data : userProfile.interestMask;
|
|
7003
6900
|
return {
|
|
7004
6901
|
...userProfile,
|
|
7005
|
-
principalId: data
|
|
6902
|
+
principalId: data.principalId,
|
|
7006
6903
|
author: {
|
|
7007
6904
|
...userProfile.author,
|
|
7008
|
-
principalId: data
|
|
6905
|
+
principalId: data.principalId,
|
|
7009
6906
|
userInfo: normalizedAuthor,
|
|
7010
6907
|
sensitiveInfo,
|
|
7011
6908
|
followInfo: {},
|
|
@@ -7036,25 +6933,25 @@ const KuaishouData = async (data$1, cookie, requestConfig) => {
|
|
|
7036
6933
|
};
|
|
7037
6934
|
}
|
|
7038
6935
|
case "userWorkList": {
|
|
7039
|
-
const refererPath = `profile/${encodeURIComponent(data
|
|
7040
|
-
const publicPayload = await fetchKuaishouLiveApiPayload(data
|
|
7041
|
-
principalId: data
|
|
7042
|
-
pcursor: data
|
|
7043
|
-
count: data
|
|
6936
|
+
const refererPath = `profile/${encodeURIComponent(data.principalId)}`;
|
|
6937
|
+
const publicPayload = await fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.userWorkList({
|
|
6938
|
+
principalId: data.principalId,
|
|
6939
|
+
pcursor: data.pcursor,
|
|
6940
|
+
count: data.count
|
|
7044
6941
|
}), refererPath, { allowResult2: true });
|
|
7045
6942
|
if (isErrorDetailLike(publicPayload)) return publicPayload;
|
|
7046
|
-
return resolveKuaishouUserWorkList(data
|
|
6943
|
+
return resolveKuaishouUserWorkList(data.principalId, publicPayload);
|
|
7047
6944
|
}
|
|
7048
6945
|
case "liveRoomInfo": {
|
|
7049
|
-
const refererPath = `u/${encodeURIComponent(data
|
|
6946
|
+
const refererPath = `u/${encodeURIComponent(data.principalId)}`;
|
|
7050
6947
|
const [liveDetailPayload, userInfoPayload, sensitivePayload, emojiPayload] = await Promise.all([
|
|
7051
|
-
fetchKuaishouLiveApiPayload(data
|
|
7052
|
-
fetchKuaishouLiveApiPayload(data
|
|
7053
|
-
fetchKuaishouLiveApiPayload(data
|
|
7054
|
-
fetchKuaishouGraphqlPayload(data
|
|
6948
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.liveDetail({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
6949
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.userInfoById({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
6950
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.userSensitiveInfo({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
6951
|
+
fetchKuaishouGraphqlPayload(data.methodType, kuaishouApiUrls.emojiList(), { allowResult2: true })
|
|
7055
6952
|
]);
|
|
7056
6953
|
if (isErrorDetailLike(liveDetailPayload)) return liveDetailPayload;
|
|
7057
|
-
const liveRoomInfo = createEmptyLiveRoomInfoResult(data
|
|
6954
|
+
const liveRoomInfo = createEmptyLiveRoomInfoResult(data.principalId);
|
|
7058
6955
|
const liveDetailData = resolveKuaishouLiveDetailData(liveDetailPayload);
|
|
7059
6956
|
if (!liveDetailData) return liveRoomInfo;
|
|
7060
6957
|
const userInfo = isErrorDetailLike(userInfoPayload) ? void 0 : userInfoPayload?.data?.userInfo;
|
|
@@ -7072,15 +6969,15 @@ const KuaishouData = async (data$1, cookie, requestConfig) => {
|
|
|
7072
6969
|
const shouldFetchWebsocketInfo = liveDetailWebsocketMeta.websocketUrls.length === 0 || !liveDetailWebsocketMeta.token;
|
|
7073
6970
|
const shouldFetchRecommendList = liveDetailRecommendList.length === 0;
|
|
7074
6971
|
const [giftPayload, websocketPayload, recoPayload] = await Promise.all([
|
|
7075
|
-
fetchKuaishouLiveApiPayload(data
|
|
7076
|
-
shouldFetchWebsocketInfo ? fetchKuaishouLiveApiPayload(data
|
|
7077
|
-
shouldFetchRecommendList ? fetchKuaishouLiveApiPayload(data
|
|
6972
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.liveGiftList(liveStreamId), refererPath, { allowResult2: true }),
|
|
6973
|
+
shouldFetchWebsocketInfo ? fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.liveWebsocketInfo(liveStreamId), refererPath, { allowResult2: true }) : Promise.resolve(null),
|
|
6974
|
+
shouldFetchRecommendList ? fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.liveReco(currentGameId), refererPath, { allowResult2: true }) : Promise.resolve(null)
|
|
7078
6975
|
]);
|
|
7079
6976
|
const resolvedRecommendList = !isErrorDetailLike(recoPayload) && Array.isArray(recoPayload?.data?.list) ? recoPayload.data.list : liveDetailRecommendList;
|
|
7080
6977
|
const nextPlayList = dedupeLiveRoomPlayList([currentLiveRoomItem, ...Array.isArray(resolvedRecommendList) ? resolvedRecommendList.map((item) => mapRecoItemToLiveRoomPlayItem(item)) : []]);
|
|
7081
6978
|
return {
|
|
7082
6979
|
...liveRoomInfo,
|
|
7083
|
-
principalId: data
|
|
6980
|
+
principalId: data.principalId,
|
|
7084
6981
|
activeIndex: 0,
|
|
7085
6982
|
current: currentLiveRoomItem,
|
|
7086
6983
|
playList: nextPlayList,
|
|
@@ -7098,9 +6995,9 @@ const KuaishouData = async (data$1, cookie, requestConfig) => {
|
|
|
7098
6995
|
}
|
|
7099
6996
|
};
|
|
7100
6997
|
}
|
|
7101
|
-
case "emojiList": return fetchKuaishouGraphqlPayload(data
|
|
6998
|
+
case "emojiList": return fetchKuaishouGraphqlPayload(data.methodType, kuaishouApiUrls.emojiList());
|
|
7102
6999
|
default:
|
|
7103
|
-
logger.warn(`Unknown Kuaishou API method: "${logger.red(data
|
|
7000
|
+
logger.warn(`Unknown Kuaishou API method: "${logger.red(data.methodType)}"`);
|
|
7104
7001
|
return null;
|
|
7105
7002
|
}
|
|
7106
7003
|
};
|
|
@@ -7147,7 +7044,7 @@ const GlobalGetData$2 = async (type, options, config) => {
|
|
|
7147
7044
|
logger.warn(warningMessage);
|
|
7148
7045
|
const cookieError = new Error(Err.errorDescription);
|
|
7149
7046
|
Object.assign(cookieError, {
|
|
7150
|
-
code:
|
|
7047
|
+
code: "INVALID_COOKIE",
|
|
7151
7048
|
data: result,
|
|
7152
7049
|
amagiError: Err
|
|
7153
7050
|
});
|
|
@@ -7160,7 +7057,7 @@ const GlobalGetData$2 = async (type, options, config) => {
|
|
|
7160
7057
|
amagiMessage: warningMessage
|
|
7161
7058
|
};
|
|
7162
7059
|
return {
|
|
7163
|
-
code:
|
|
7060
|
+
code: "UNKNOWN_ERROR",
|
|
7164
7061
|
data: null,
|
|
7165
7062
|
amagiError: {
|
|
7166
7063
|
errorDescription: "未知错误",
|
|
@@ -7171,7 +7068,6 @@ const GlobalGetData$2 = async (type, options, config) => {
|
|
|
7171
7068
|
};
|
|
7172
7069
|
}
|
|
7173
7070
|
};
|
|
7174
|
-
|
|
7175
7071
|
//#endregion
|
|
7176
7072
|
//#region src/model/fetchers/kuaishou/internal.ts
|
|
7177
7073
|
/**
|
|
@@ -7223,7 +7119,6 @@ async function fetchKuaishouInternal(methodType, options, config) {
|
|
|
7223
7119
|
throw new Error(`快手数据获取失败: ${errorMessage}`);
|
|
7224
7120
|
}
|
|
7225
7121
|
}
|
|
7226
|
-
|
|
7227
7122
|
//#endregion
|
|
7228
7123
|
//#region src/model/fetchers/kuaishou/api.ts
|
|
7229
7124
|
/**
|
|
@@ -7328,7 +7223,6 @@ async function fetchEmojiList$1(options, cookie, requestConfig) {
|
|
|
7328
7223
|
requestConfig
|
|
7329
7224
|
});
|
|
7330
7225
|
}
|
|
7331
|
-
|
|
7332
7226
|
//#endregion
|
|
7333
7227
|
//#region src/model/fetchers/kuaishou/index.ts
|
|
7334
7228
|
/**
|
|
@@ -7372,7 +7266,6 @@ function createBoundKuaishouFetcher(cookie, requestConfig) {
|
|
|
7372
7266
|
fetchEmojiList: (options, reqConfig) => fetchEmojiList$1(options, cookie, reqConfig ?? requestConfig)
|
|
7373
7267
|
};
|
|
7374
7268
|
}
|
|
7375
|
-
|
|
7376
7269
|
//#endregion
|
|
7377
7270
|
//#region src/platform/xiaohongshu/getdata.ts
|
|
7378
7271
|
/**
|
|
@@ -7382,7 +7275,7 @@ function createBoundKuaishouFetcher(cookie, requestConfig) {
|
|
|
7382
7275
|
* @param requestConfig - 外部请求配置
|
|
7383
7276
|
* @returns 返回小红书数据
|
|
7384
7277
|
*/
|
|
7385
|
-
const XiaohongshuData = async (data
|
|
7278
|
+
const XiaohongshuData = async (data, cookie, requestConfig) => {
|
|
7386
7279
|
const defHeaders = getXiaohongshuDefaultConfig(cookie)["headers"];
|
|
7387
7280
|
const baseRequestConfig = {
|
|
7388
7281
|
method: "POST",
|
|
@@ -7393,32 +7286,32 @@ const XiaohongshuData = async (data$1, cookie, requestConfig) => {
|
|
|
7393
7286
|
...requestConfig?.headers ?? {}
|
|
7394
7287
|
}
|
|
7395
7288
|
};
|
|
7396
|
-
const xiaohongshuApiUrls
|
|
7397
|
-
switch (data
|
|
7398
|
-
case "homeFeed": return await GlobalGetData$1(data
|
|
7289
|
+
const xiaohongshuApiUrls = createXiaohongshuApiUrls();
|
|
7290
|
+
switch (data.methodType) {
|
|
7291
|
+
case "homeFeed": return await GlobalGetData$1(data.methodType, {
|
|
7399
7292
|
...baseRequestConfig,
|
|
7400
|
-
url: xiaohongshuApiUrls
|
|
7401
|
-
data: JSON.stringify(xiaohongshuApiUrls
|
|
7293
|
+
url: xiaohongshuApiUrls.homeFeed(data).Url,
|
|
7294
|
+
data: JSON.stringify(xiaohongshuApiUrls.homeFeed(data).Body),
|
|
7402
7295
|
headers: {
|
|
7403
7296
|
...baseRequestConfig.headers,
|
|
7404
|
-
"x-s": xiaohongshuSign.generateXSPost(xiaohongshuApiUrls
|
|
7297
|
+
"x-s": xiaohongshuSign.generateXSPost(xiaohongshuApiUrls.homeFeed(data).apiPath, xiaohongshuSign.extractA1FromCookie(cookie ?? ""), "xhs-pc-web", xiaohongshuApiUrls.homeFeed(data).Body),
|
|
7405
7298
|
"x-s-common": xiaohongshuSign.generateXSCommon(cookie ?? ""),
|
|
7406
7299
|
"x-t": xiaohongshuSign.generateXT()
|
|
7407
7300
|
}
|
|
7408
7301
|
});
|
|
7409
|
-
case "noteDetail": return await GlobalGetData$1(data
|
|
7302
|
+
case "noteDetail": return await GlobalGetData$1(data.methodType, {
|
|
7410
7303
|
...baseRequestConfig,
|
|
7411
|
-
url: xiaohongshuApiUrls
|
|
7412
|
-
data: xiaohongshuApiUrls
|
|
7304
|
+
url: xiaohongshuApiUrls.noteDetail(data).Url,
|
|
7305
|
+
data: xiaohongshuApiUrls.noteDetail(data).Body,
|
|
7413
7306
|
headers: {
|
|
7414
7307
|
...baseRequestConfig.headers,
|
|
7415
|
-
"x-s": xiaohongshuSign.generateXSPost(xiaohongshuApiUrls
|
|
7308
|
+
"x-s": xiaohongshuSign.generateXSPost(xiaohongshuApiUrls.noteDetail(data).apiPath, xiaohongshuSign.extractA1FromCookie(cookie ?? ""), "xhs-pc-web", xiaohongshuApiUrls.noteDetail(data).Body),
|
|
7416
7309
|
"x-s-common": xiaohongshuSign.generateXSCommon(cookie ?? ""),
|
|
7417
7310
|
"x-t": xiaohongshuSign.generateXT()
|
|
7418
7311
|
}
|
|
7419
7312
|
});
|
|
7420
7313
|
case "noteComments": {
|
|
7421
|
-
const baseRequestConfig
|
|
7314
|
+
const baseRequestConfig = {
|
|
7422
7315
|
method: "GET",
|
|
7423
7316
|
timeout: 1e4,
|
|
7424
7317
|
...requestConfig,
|
|
@@ -7427,19 +7320,19 @@ const XiaohongshuData = async (data$1, cookie, requestConfig) => {
|
|
|
7427
7320
|
...requestConfig?.headers ?? {}
|
|
7428
7321
|
}
|
|
7429
7322
|
};
|
|
7430
|
-
return await GlobalGetData$1(data
|
|
7431
|
-
...baseRequestConfig
|
|
7432
|
-
url: xiaohongshuApiUrls
|
|
7323
|
+
return await GlobalGetData$1(data.methodType, {
|
|
7324
|
+
...baseRequestConfig,
|
|
7325
|
+
url: xiaohongshuApiUrls.noteComments(data).Url,
|
|
7433
7326
|
headers: {
|
|
7434
|
-
...baseRequestConfig
|
|
7435
|
-
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls
|
|
7327
|
+
...baseRequestConfig.headers,
|
|
7328
|
+
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls.noteComments(data).apiPath, xiaohongshuSign.extractA1FromCookie(cookie ?? ""), "xhs-pc-web"),
|
|
7436
7329
|
"x-s-common": xiaohongshuSign.generateXSCommon(cookie ?? ""),
|
|
7437
7330
|
"x-t": xiaohongshuSign.generateXT()
|
|
7438
7331
|
}
|
|
7439
7332
|
});
|
|
7440
7333
|
}
|
|
7441
7334
|
case "userProfile": {
|
|
7442
|
-
const baseRequestConfig
|
|
7335
|
+
const baseRequestConfig = {
|
|
7443
7336
|
method: "GET",
|
|
7444
7337
|
timeout: 1e4,
|
|
7445
7338
|
...requestConfig,
|
|
@@ -7450,12 +7343,12 @@ const XiaohongshuData = async (data$1, cookie, requestConfig) => {
|
|
|
7450
7343
|
};
|
|
7451
7344
|
return {
|
|
7452
7345
|
code: 0,
|
|
7453
|
-
data: extractCreatorInfoFromHtml(await GlobalGetData$1(data
|
|
7454
|
-
...baseRequestConfig
|
|
7455
|
-
url: xiaohongshuApiUrls
|
|
7346
|
+
data: extractCreatorInfoFromHtml(await GlobalGetData$1(data.methodType, {
|
|
7347
|
+
...baseRequestConfig,
|
|
7348
|
+
url: xiaohongshuApiUrls.userProfile(data).Url,
|
|
7456
7349
|
headers: {
|
|
7457
|
-
...baseRequestConfig
|
|
7458
|
-
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls
|
|
7350
|
+
...baseRequestConfig.headers,
|
|
7351
|
+
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls.userProfile(data).apiPath, xiaohongshuSign.extractA1FromCookie(cookie ?? ""), "xhs-pc-web"),
|
|
7459
7352
|
"x-s-common": xiaohongshuSign.generateXSCommon(cookie ?? ""),
|
|
7460
7353
|
"x-t": xiaohongshuSign.generateXT()
|
|
7461
7354
|
}
|
|
@@ -7463,20 +7356,20 @@ const XiaohongshuData = async (data$1, cookie, requestConfig) => {
|
|
|
7463
7356
|
msg: "success"
|
|
7464
7357
|
};
|
|
7465
7358
|
}
|
|
7466
|
-
case "userNoteList": return await GlobalGetData$1(data
|
|
7359
|
+
case "userNoteList": return await GlobalGetData$1(data.methodType, {
|
|
7467
7360
|
...baseRequestConfig,
|
|
7468
7361
|
method: "GET",
|
|
7469
|
-
url: xiaohongshuApiUrls
|
|
7362
|
+
url: xiaohongshuApiUrls.userNoteList(data).Url,
|
|
7470
7363
|
headers: {
|
|
7471
7364
|
...baseRequestConfig.headers,
|
|
7472
7365
|
"x-b3-traceid": xiaohongshuSign.generateXB3Traceid(),
|
|
7473
|
-
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls
|
|
7366
|
+
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls.userNoteList(data).apiPath, xiaohongshuSign.extractA1FromCookie(cookie ?? ""), "xhs-pc-web"),
|
|
7474
7367
|
"x-s-common": xiaohongshuSign.generateXSCommon(cookie ?? ""),
|
|
7475
7368
|
"x-t": xiaohongshuSign.generateXT()
|
|
7476
7369
|
}
|
|
7477
7370
|
});
|
|
7478
7371
|
case "emojiList": {
|
|
7479
|
-
const baseRequestConfig
|
|
7372
|
+
const baseRequestConfig = {
|
|
7480
7373
|
method: "GET",
|
|
7481
7374
|
timeout: 1e4,
|
|
7482
7375
|
...requestConfig,
|
|
@@ -7485,29 +7378,29 @@ const XiaohongshuData = async (data$1, cookie, requestConfig) => {
|
|
|
7485
7378
|
...requestConfig?.headers ?? {}
|
|
7486
7379
|
}
|
|
7487
7380
|
};
|
|
7488
|
-
return await GlobalGetData$1(data
|
|
7489
|
-
...baseRequestConfig
|
|
7490
|
-
url: xiaohongshuApiUrls
|
|
7381
|
+
return await GlobalGetData$1(data.methodType, {
|
|
7382
|
+
...baseRequestConfig,
|
|
7383
|
+
url: xiaohongshuApiUrls.emojiList(data).Url,
|
|
7491
7384
|
headers: {
|
|
7492
|
-
...baseRequestConfig
|
|
7493
|
-
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls
|
|
7385
|
+
...baseRequestConfig.headers,
|
|
7386
|
+
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls.emojiList(data).apiPath, xiaohongshuSign.extractA1FromCookie(cookie ?? ""), "xhs-pc-web"),
|
|
7494
7387
|
"x-s-common": xiaohongshuSign.generateXSCommon(cookie ?? ""),
|
|
7495
7388
|
"x-t": xiaohongshuSign.generateXT()
|
|
7496
7389
|
}
|
|
7497
7390
|
});
|
|
7498
7391
|
}
|
|
7499
|
-
case "searchNotes": return await GlobalGetData$1(data
|
|
7392
|
+
case "searchNotes": return await GlobalGetData$1(data.methodType, {
|
|
7500
7393
|
...baseRequestConfig,
|
|
7501
|
-
url: xiaohongshuApiUrls
|
|
7502
|
-
data: xiaohongshuApiUrls
|
|
7394
|
+
url: xiaohongshuApiUrls.searchNotes(data).Url,
|
|
7395
|
+
data: xiaohongshuApiUrls.searchNotes(data).Body,
|
|
7503
7396
|
headers: {
|
|
7504
7397
|
...baseRequestConfig.headers,
|
|
7505
|
-
"x-s": xiaohongshuSign.generateXSPost(xiaohongshuApiUrls
|
|
7398
|
+
"x-s": xiaohongshuSign.generateXSPost(xiaohongshuApiUrls.searchNotes(data).apiPath, xiaohongshuSign.extractA1FromCookie(cookie ?? ""), "xhs-pc-web"),
|
|
7506
7399
|
"x-s-common": xiaohongshuSign.generateXSCommon(cookie ?? ""),
|
|
7507
7400
|
"x-t": xiaohongshuSign.generateXT()
|
|
7508
7401
|
}
|
|
7509
7402
|
});
|
|
7510
|
-
default: throw new Error(`Unknown Xiaohongshu API method: "${logger.red(data
|
|
7403
|
+
default: throw new Error(`Unknown Xiaohongshu API method: "${logger.red(data.methodType)}"`);
|
|
7511
7404
|
}
|
|
7512
7405
|
};
|
|
7513
7406
|
/**
|
|
@@ -7546,7 +7439,6 @@ const GlobalGetData$1 = async (methodType, config) => {
|
|
|
7546
7439
|
};
|
|
7547
7440
|
}
|
|
7548
7441
|
};
|
|
7549
|
-
|
|
7550
7442
|
//#endregion
|
|
7551
7443
|
//#region src/model/fetchers/xiaohongshu/internal.ts
|
|
7552
7444
|
/**
|
|
@@ -7557,9 +7449,9 @@ const GlobalGetData$1 = async (methodType, config) => {
|
|
|
7557
7449
|
* 搜索排序类型映射
|
|
7558
7450
|
*/
|
|
7559
7451
|
const sortTypeMapping = {
|
|
7560
|
-
general:
|
|
7561
|
-
time_descending:
|
|
7562
|
-
popularity_descending:
|
|
7452
|
+
general: "general",
|
|
7453
|
+
time_descending: "time_descending",
|
|
7454
|
+
popularity_descending: "popularity_descending"
|
|
7563
7455
|
};
|
|
7564
7456
|
/**
|
|
7565
7457
|
* 小红书 API 内部调用函数
|
|
@@ -7606,7 +7498,6 @@ async function fetchXiaohongshuInternal(methodType, options, config) {
|
|
|
7606
7498
|
throw new Error(`小红书数据获取失败: ${errorMessage}`);
|
|
7607
7499
|
}
|
|
7608
7500
|
}
|
|
7609
|
-
|
|
7610
7501
|
//#endregion
|
|
7611
7502
|
//#region src/model/fetchers/xiaohongshu/misc.ts
|
|
7612
7503
|
/**
|
|
@@ -7628,7 +7519,6 @@ async function fetchEmojiList(options, cookie, requestConfig) {
|
|
|
7628
7519
|
requestConfig
|
|
7629
7520
|
});
|
|
7630
7521
|
}
|
|
7631
|
-
|
|
7632
7522
|
//#endregion
|
|
7633
7523
|
//#region src/model/fetchers/xiaohongshu/note.ts
|
|
7634
7524
|
/**
|
|
@@ -7695,7 +7585,6 @@ async function fetchNoteComments(options, cookie, requestConfig) {
|
|
|
7695
7585
|
requestConfig
|
|
7696
7586
|
});
|
|
7697
7587
|
}
|
|
7698
|
-
|
|
7699
7588
|
//#endregion
|
|
7700
7589
|
//#region src/model/fetchers/xiaohongshu/search.ts
|
|
7701
7590
|
/**
|
|
@@ -7730,7 +7619,6 @@ async function searchNotes(options, cookie, requestConfig) {
|
|
|
7730
7619
|
requestConfig
|
|
7731
7620
|
});
|
|
7732
7621
|
}
|
|
7733
|
-
|
|
7734
7622
|
//#endregion
|
|
7735
7623
|
//#region src/model/fetchers/xiaohongshu/user.ts
|
|
7736
7624
|
/**
|
|
@@ -7771,7 +7659,6 @@ async function fetchUserNoteList(options, cookie, requestConfig) {
|
|
|
7771
7659
|
requestConfig
|
|
7772
7660
|
});
|
|
7773
7661
|
}
|
|
7774
|
-
|
|
7775
7662
|
//#endregion
|
|
7776
7663
|
//#region src/model/fetchers/xiaohongshu/index.ts
|
|
7777
7664
|
/**
|
|
@@ -7821,7 +7708,6 @@ function createBoundXiaohongshuFetcher(cookie, requestConfig) {
|
|
|
7821
7708
|
fetchEmojiList: (options, reqConfig) => fetchEmojiList(options, cookie, reqConfig ?? requestConfig)
|
|
7822
7709
|
};
|
|
7823
7710
|
}
|
|
7824
|
-
|
|
7825
7711
|
//#endregion
|
|
7826
7712
|
//#region src/model/networks.ts
|
|
7827
7713
|
/** 可恢复的错误代码列表 */
|
|
@@ -7852,7 +7738,7 @@ const isRecoverableError = (error) => {
|
|
|
7852
7738
|
* 延迟函数
|
|
7853
7739
|
* @param ms - 延迟毫秒数
|
|
7854
7740
|
*/
|
|
7855
|
-
const delay = (ms) => new Promise((resolve
|
|
7741
|
+
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
7856
7742
|
/**
|
|
7857
7743
|
* 创建网络错误响应
|
|
7858
7744
|
* @param error - 错误对象
|
|
@@ -7863,7 +7749,7 @@ const createNetworkErrorResult = (error, retries) => {
|
|
|
7863
7749
|
const errorCode = error.code ?? "UNKNOWN";
|
|
7864
7750
|
const message = `网络请求失败 [${errorCode}]: ${error.message} (已重试 ${retries} 次)`;
|
|
7865
7751
|
return createErrorResponse({
|
|
7866
|
-
code:
|
|
7752
|
+
code: "UNKNOWN_ERROR",
|
|
7867
7753
|
data: null,
|
|
7868
7754
|
amagiError: {
|
|
7869
7755
|
errorDescription: `${error.message} (已重试 ${retries} 次)`,
|
|
@@ -8000,7 +7886,6 @@ const getHeadersAndData = async (config, maxRetries = DEFAULT_MAX_RETRIES) => {
|
|
|
8000
7886
|
data: response.data
|
|
8001
7887
|
};
|
|
8002
7888
|
};
|
|
8003
|
-
|
|
8004
7889
|
//#endregion
|
|
8005
7890
|
//#region src/model/logger.ts
|
|
8006
7891
|
/**
|
|
@@ -8101,7 +7986,6 @@ const logMiddleware = (pathsToLog) => {
|
|
|
8101
7986
|
next();
|
|
8102
7987
|
};
|
|
8103
7988
|
};
|
|
8104
|
-
|
|
8105
7989
|
//#endregion
|
|
8106
7990
|
//#region src/platform/bilibili/qtparam.ts
|
|
8107
7991
|
/**
|
|
@@ -8147,7 +8031,6 @@ const qtparam = async (BASEURL, cookie) => {
|
|
|
8147
8031
|
isvip
|
|
8148
8032
|
};
|
|
8149
8033
|
};
|
|
8150
|
-
|
|
8151
8034
|
//#endregion
|
|
8152
8035
|
//#region src/platform/bilibili/sign/bv2av.ts
|
|
8153
8036
|
const XOR_CODE = 23442827791579n;
|
|
@@ -8199,7 +8082,6 @@ const bv2av = (bvid) => {
|
|
|
8199
8082
|
const tmp = bvidArr.reduce((pre, bvidChar) => pre * BASE + BigInt(data.indexOf(bvidChar)), 0n);
|
|
8200
8083
|
return Number(tmp & MASK_CODE ^ XOR_CODE);
|
|
8201
8084
|
};
|
|
8202
|
-
|
|
8203
8085
|
//#endregion
|
|
8204
8086
|
//#region src/platform/bilibili/sign/danmaku_proto.ts
|
|
8205
8087
|
/**
|
|
@@ -8285,16 +8167,15 @@ function getProtoType() {
|
|
|
8285
8167
|
* @param data - 二进制 protobuf 数据
|
|
8286
8168
|
* @returns 解析后的弹幕数据
|
|
8287
8169
|
*/
|
|
8288
|
-
function parseDmSegMobileReply(data
|
|
8170
|
+
function parseDmSegMobileReply(data) {
|
|
8289
8171
|
const messageType = getProtoType();
|
|
8290
|
-
const buffer = data
|
|
8172
|
+
const buffer = data instanceof Uint8Array ? data : new Uint8Array(data);
|
|
8291
8173
|
const message = messageType.decode(buffer);
|
|
8292
8174
|
return messageType.toObject(message, {
|
|
8293
8175
|
longs: String,
|
|
8294
8176
|
defaults: true
|
|
8295
8177
|
});
|
|
8296
8178
|
}
|
|
8297
|
-
|
|
8298
8179
|
//#endregion
|
|
8299
8180
|
//#region src/platform/bilibili/sign/wbi.ts
|
|
8300
8181
|
/**
|
|
@@ -8417,7 +8298,6 @@ const wbi_sign = async (BASEURL, cookie) => {
|
|
|
8417
8298
|
for (const [key, value] of url.searchParams.entries()) params[key] = value;
|
|
8418
8299
|
return encWbi(params, web_keys.img_key, web_keys.sub_key);
|
|
8419
8300
|
};
|
|
8420
|
-
|
|
8421
8301
|
//#endregion
|
|
8422
8302
|
//#region src/platform/bilibili/getdata.ts
|
|
8423
8303
|
/**
|
|
@@ -8438,28 +8318,28 @@ const wbi_sign = async (BASEURL, cookie) => {
|
|
|
8438
8318
|
* @param requestConfig - 外部请求配置(优先级最高)
|
|
8439
8319
|
* @returns 返回B站数据
|
|
8440
8320
|
*/
|
|
8441
|
-
const fetchBilibili = async (data
|
|
8321
|
+
const fetchBilibili = async (data, cookie, requestConfig) => {
|
|
8442
8322
|
const baseRequestConfig = getBilibiliDefaultConfig(cookie, requestConfig);
|
|
8443
|
-
switch (data
|
|
8444
|
-
case "videoInfo": return await GlobalGetData(data
|
|
8323
|
+
switch (data.methodType) {
|
|
8324
|
+
case "videoInfo": return await GlobalGetData(data.methodType, {
|
|
8445
8325
|
...baseRequestConfig,
|
|
8446
|
-
url: bilibiliApiUrls.getVideoInfo({ bvid: data
|
|
8326
|
+
url: bilibiliApiUrls.getVideoInfo({ bvid: data.bvid })
|
|
8447
8327
|
});
|
|
8448
8328
|
case "videoStream": {
|
|
8449
8329
|
const sign = await qtparam(bilibiliApiUrls.getVideoStream({
|
|
8450
|
-
avid: data
|
|
8451
|
-
cid: data
|
|
8330
|
+
avid: data.avid,
|
|
8331
|
+
cid: data.cid
|
|
8452
8332
|
}), baseRequestConfig.headers?.Cookie);
|
|
8453
|
-
return await GlobalGetData(data
|
|
8333
|
+
return await GlobalGetData(data.methodType, {
|
|
8454
8334
|
...baseRequestConfig,
|
|
8455
8335
|
url: bilibiliApiUrls.getVideoStream({
|
|
8456
|
-
avid: data
|
|
8457
|
-
cid: data
|
|
8336
|
+
avid: data.avid,
|
|
8337
|
+
cid: data.cid
|
|
8458
8338
|
}) + sign.QUERY
|
|
8459
8339
|
});
|
|
8460
8340
|
}
|
|
8461
8341
|
case "comments": {
|
|
8462
|
-
let { oid, number, type, mode, pagination_str, plat, seek_rpid, web_location } = data
|
|
8342
|
+
let { oid, number, type, mode, pagination_str, plat, seek_rpid, web_location } = data;
|
|
8463
8343
|
let fetchedComments = [];
|
|
8464
8344
|
const maxRequestCount = 100;
|
|
8465
8345
|
let requestCount = 0;
|
|
@@ -8470,7 +8350,7 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8470
8350
|
oid,
|
|
8471
8351
|
type
|
|
8472
8352
|
});
|
|
8473
|
-
if ((await GlobalGetData(data
|
|
8353
|
+
if ((await GlobalGetData(data.methodType, {
|
|
8474
8354
|
...baseRequestConfig,
|
|
8475
8355
|
url: checkStatusUrl
|
|
8476
8356
|
})).data === null) {
|
|
@@ -8492,7 +8372,7 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8492
8372
|
web_location: web_location ?? "1315875"
|
|
8493
8373
|
});
|
|
8494
8374
|
const finalUrl = baseUrl + await wbi_sign(baseUrl, baseRequestConfig.headers?.cookie);
|
|
8495
|
-
const response = await GlobalGetData(data
|
|
8375
|
+
const response = await GlobalGetData(data.methodType, {
|
|
8496
8376
|
...baseRequestConfig,
|
|
8497
8377
|
url: finalUrl
|
|
8498
8378
|
});
|
|
@@ -8513,43 +8393,43 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8513
8393
|
...tmpresp,
|
|
8514
8394
|
data: {
|
|
8515
8395
|
...tmpresp.data,
|
|
8516
|
-
replies: Array.from(new Map(fetchedComments.map((item) => [item.rpid, item])).values()).slice(0, Number(data
|
|
8396
|
+
replies: Array.from(new Map(fetchedComments.map((item) => [item.rpid, item])).values()).slice(0, Number(data.number ?? 20))
|
|
8517
8397
|
}
|
|
8518
8398
|
};
|
|
8519
8399
|
}
|
|
8520
|
-
case "commentReplies": return await GlobalGetData(data
|
|
8400
|
+
case "commentReplies": return await GlobalGetData(data.methodType, {
|
|
8521
8401
|
...baseRequestConfig,
|
|
8522
|
-
url: bilibiliApiUrls.getCommentReplies(data
|
|
8402
|
+
url: bilibiliApiUrls.getCommentReplies(data)
|
|
8523
8403
|
});
|
|
8524
|
-
case "emojiList": return await GlobalGetData(data
|
|
8404
|
+
case "emojiList": return await GlobalGetData(data.methodType, {
|
|
8525
8405
|
...baseRequestConfig,
|
|
8526
8406
|
url: bilibiliApiUrls.getEmojiList()
|
|
8527
8407
|
});
|
|
8528
8408
|
case "bangumiInfo": {
|
|
8529
|
-
let id = data
|
|
8409
|
+
let id = data.ep_id ?? data.season_id;
|
|
8530
8410
|
if (!id) return false;
|
|
8531
8411
|
const idType = id ? id.startsWith("ep") ? "ep_id" : "season_id" : "ep_id";
|
|
8532
8412
|
const newId = idType === "ep_id" ? id.replace("ep", "") : id.replace("ss", "");
|
|
8533
|
-
return await GlobalGetData(data
|
|
8413
|
+
return await GlobalGetData(data.methodType, {
|
|
8534
8414
|
...baseRequestConfig,
|
|
8535
8415
|
url: bilibiliApiUrls.getBangumiInfo({ [idType]: newId })
|
|
8536
8416
|
});
|
|
8537
8417
|
}
|
|
8538
8418
|
case "bangumiStream": {
|
|
8539
8419
|
const sign = await qtparam(bilibiliApiUrls.getBangumiStream({
|
|
8540
|
-
cid: data
|
|
8541
|
-
ep_id: data
|
|
8420
|
+
cid: data.cid,
|
|
8421
|
+
ep_id: data.ep_id.replace("ep", "")
|
|
8542
8422
|
}), baseRequestConfig.headers?.cookie);
|
|
8543
|
-
return await GlobalGetData(data
|
|
8423
|
+
return await GlobalGetData(data.methodType, {
|
|
8544
8424
|
...baseRequestConfig,
|
|
8545
8425
|
url: bilibiliApiUrls.getBangumiStream({
|
|
8546
|
-
cid: data
|
|
8547
|
-
ep_id: data
|
|
8426
|
+
cid: data.cid,
|
|
8427
|
+
ep_id: data.ep_id.replace("ep", "")
|
|
8548
8428
|
}) + sign.QUERY
|
|
8549
8429
|
});
|
|
8550
8430
|
}
|
|
8551
8431
|
case "userDynamicList": {
|
|
8552
|
-
const { host_mid } = data
|
|
8432
|
+
const { host_mid } = data;
|
|
8553
8433
|
const hasExternalReferer = requestConfig?.headers && ("referer" in requestConfig.headers || "Referer" in requestConfig.headers);
|
|
8554
8434
|
const customHeaders = {
|
|
8555
8435
|
...baseRequestConfig.headers,
|
|
@@ -8557,7 +8437,7 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8557
8437
|
...!hasExternalReferer && { Referer: `https://space.bilibili.com/${host_mid}/dynamic` }
|
|
8558
8438
|
};
|
|
8559
8439
|
const wbiSignQuery = await wbi_sign(bilibiliApiUrls.getUserDynamicList({ host_mid }), baseRequestConfig.headers?.cookie);
|
|
8560
|
-
return await GlobalGetData(data
|
|
8440
|
+
return await GlobalGetData(data.methodType, {
|
|
8561
8441
|
...baseRequestConfig,
|
|
8562
8442
|
headers: customHeaders,
|
|
8563
8443
|
url: bilibiliApiUrls.getUserDynamicList({ host_mid }) + wbiSignQuery
|
|
@@ -8569,55 +8449,48 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8569
8449
|
...baseRequestConfig.headers,
|
|
8570
8450
|
...!hasExternalReferer && { Referer: void 0 }
|
|
8571
8451
|
};
|
|
8572
|
-
return await GlobalGetData(data
|
|
8573
|
-
...baseRequestConfig,
|
|
8574
|
-
headers: customHeaders,
|
|
8575
|
-
url: bilibiliApiUrls.getDynamicDetail({ dynamic_id: data$1.dynamic_id })
|
|
8576
|
-
});
|
|
8577
|
-
}
|
|
8578
|
-
case "dynamicCard": {
|
|
8579
|
-
const { dynamic_id } = data$1;
|
|
8580
|
-
const hasExternalReferer = requestConfig?.headers && "referer" in requestConfig.headers;
|
|
8581
|
-
const customHeaders = {
|
|
8582
|
-
...baseRequestConfig.headers,
|
|
8583
|
-
...!hasExternalReferer && { Referer: void 0 }
|
|
8584
|
-
};
|
|
8585
|
-
return await GlobalGetData(data$1.methodType, {
|
|
8452
|
+
return await GlobalGetData(data.methodType, {
|
|
8586
8453
|
...baseRequestConfig,
|
|
8587
8454
|
headers: customHeaders,
|
|
8588
|
-
url: bilibiliApiUrls.
|
|
8455
|
+
url: bilibiliApiUrls.getDynamicDetail({ dynamic_id: data.dynamic_id })
|
|
8589
8456
|
});
|
|
8590
8457
|
}
|
|
8458
|
+
case "dynamicCard": return {
|
|
8459
|
+
code: -404,
|
|
8460
|
+
message: "接口已停用:B站官方已于 `2025-08-09` 删除 dynamic_svr 接口,fetchDynamicCard 方法已废弃,调用讲返回错误信息",
|
|
8461
|
+
ttl: 1,
|
|
8462
|
+
data: null
|
|
8463
|
+
};
|
|
8591
8464
|
case "userCard": {
|
|
8592
|
-
const { host_mid } = data
|
|
8593
|
-
return await GlobalGetData(data
|
|
8465
|
+
const { host_mid } = data;
|
|
8466
|
+
return await GlobalGetData(data.methodType, {
|
|
8594
8467
|
...baseRequestConfig,
|
|
8595
8468
|
url: bilibiliApiUrls.getUserCard({ host_mid })
|
|
8596
8469
|
});
|
|
8597
8470
|
}
|
|
8598
8471
|
case "userSpaceInfo": {
|
|
8599
|
-
const wbiSignQuery = await wbi_sign(bilibiliApiUrls.getUserSpaceInfo({ host_mid: data
|
|
8600
|
-
return await GlobalGetData(data
|
|
8472
|
+
const wbiSignQuery = await wbi_sign(bilibiliApiUrls.getUserSpaceInfo({ host_mid: data.host_mid }), baseRequestConfig.headers?.cookie);
|
|
8473
|
+
return await GlobalGetData(data.methodType, {
|
|
8601
8474
|
...baseRequestConfig,
|
|
8602
|
-
url: bilibiliApiUrls.getUserSpaceInfo({ host_mid: data
|
|
8475
|
+
url: bilibiliApiUrls.getUserSpaceInfo({ host_mid: data.host_mid }) + wbiSignQuery
|
|
8603
8476
|
});
|
|
8604
8477
|
}
|
|
8605
|
-
case "liveRoomInfo": return await GlobalGetData(data
|
|
8478
|
+
case "liveRoomInfo": return await GlobalGetData(data.methodType, {
|
|
8606
8479
|
...baseRequestConfig,
|
|
8607
|
-
url: bilibiliApiUrls.getLiveRoomInfo({ room_id: data
|
|
8480
|
+
url: bilibiliApiUrls.getLiveRoomInfo({ room_id: data.room_id })
|
|
8608
8481
|
});
|
|
8609
|
-
case "liveRoomInit": return await GlobalGetData(data
|
|
8482
|
+
case "liveRoomInit": return await GlobalGetData(data.methodType, {
|
|
8610
8483
|
...baseRequestConfig,
|
|
8611
|
-
url: bilibiliApiUrls.getLiveRoomInit({ room_id: data
|
|
8484
|
+
url: bilibiliApiUrls.getLiveRoomInit({ room_id: data.room_id })
|
|
8612
8485
|
});
|
|
8613
|
-
case "loginQrcode": return await GlobalGetData(data
|
|
8486
|
+
case "loginQrcode": return await GlobalGetData(data.methodType, {
|
|
8614
8487
|
...baseRequestConfig,
|
|
8615
8488
|
url: bilibiliApiUrls.getLoginQrcode()
|
|
8616
8489
|
});
|
|
8617
8490
|
case "qrcodeStatus": try {
|
|
8618
8491
|
const result = await getHeadersAndData({
|
|
8619
8492
|
...baseRequestConfig,
|
|
8620
|
-
url: bilibiliApiUrls.getQrcodeStatus({ qrcode_key: data
|
|
8493
|
+
url: bilibiliApiUrls.getQrcodeStatus({ qrcode_key: data.qrcode_key })
|
|
8621
8494
|
});
|
|
8622
8495
|
if (isNetworkErrorResult(result)) {
|
|
8623
8496
|
const networkError = new Error(result.error.amagiError.errorDescription);
|
|
@@ -8626,7 +8499,7 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8626
8499
|
data: null,
|
|
8627
8500
|
amagiError: {
|
|
8628
8501
|
...result.error.amagiError,
|
|
8629
|
-
requestType: data
|
|
8502
|
+
requestType: data.methodType
|
|
8630
8503
|
}
|
|
8631
8504
|
});
|
|
8632
8505
|
throw networkError;
|
|
@@ -8634,8 +8507,8 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8634
8507
|
if (result.data.code !== 0) {
|
|
8635
8508
|
const Err = {
|
|
8636
8509
|
errorDescription: `获取响应数据失败!原因:${bilibiliErrorCodeMap[String(result.data.code)] || result.data.message || "未知错误"}!`,
|
|
8637
|
-
requestType: data
|
|
8638
|
-
requestUrl: bilibiliApiUrls.getQrcodeStatus({ qrcode_key: data
|
|
8510
|
+
requestType: data.methodType,
|
|
8511
|
+
requestUrl: bilibiliApiUrls.getQrcodeStatus({ qrcode_key: data.qrcode_key })
|
|
8639
8512
|
};
|
|
8640
8513
|
return {
|
|
8641
8514
|
code: result.data.code,
|
|
@@ -8654,65 +8527,65 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8654
8527
|
} catch (error) {
|
|
8655
8528
|
if (error && typeof error === "object") return error;
|
|
8656
8529
|
return {
|
|
8657
|
-
code:
|
|
8530
|
+
code: "UNKNOWN_ERROR",
|
|
8658
8531
|
data: error.data,
|
|
8659
8532
|
amagiError: {
|
|
8660
8533
|
errorDescription: "未知错误",
|
|
8661
|
-
requestType: data
|
|
8662
|
-
requestUrl: bilibiliApiUrls.getQrcodeStatus({ qrcode_key: data
|
|
8534
|
+
requestType: data.methodType,
|
|
8535
|
+
requestUrl: bilibiliApiUrls.getQrcodeStatus({ qrcode_key: data.qrcode_key })
|
|
8663
8536
|
}
|
|
8664
8537
|
};
|
|
8665
8538
|
}
|
|
8666
|
-
case "loginStatus": return await GlobalGetData(data
|
|
8539
|
+
case "loginStatus": return await GlobalGetData(data.methodType, {
|
|
8667
8540
|
...baseRequestConfig,
|
|
8668
8541
|
url: bilibiliApiUrls.getLoginStatus()
|
|
8669
8542
|
});
|
|
8670
|
-
case "uploaderTotalViews": return await GlobalGetData(data
|
|
8543
|
+
case "uploaderTotalViews": return await GlobalGetData(data.methodType, {
|
|
8671
8544
|
...baseRequestConfig,
|
|
8672
|
-
url: bilibiliApiUrls.getUploaderTotalViews({ host_mid: data
|
|
8545
|
+
url: bilibiliApiUrls.getUploaderTotalViews({ host_mid: data.host_mid })
|
|
8673
8546
|
});
|
|
8674
8547
|
case "avToBv": return {
|
|
8675
8548
|
code: 0,
|
|
8676
8549
|
message: "success",
|
|
8677
|
-
data: { bvid: av2bv(Number(data
|
|
8550
|
+
data: { bvid: av2bv(Number(data.avid.toString().replace(/^av/i, ""))) }
|
|
8678
8551
|
};
|
|
8679
8552
|
case "bvToAv": return {
|
|
8680
8553
|
code: 0,
|
|
8681
8554
|
message: "success",
|
|
8682
|
-
data: { aid: "av" + bv2av(data
|
|
8555
|
+
data: { aid: "av" + bv2av(data.bvid) }
|
|
8683
8556
|
};
|
|
8684
|
-
case "articleContent": return await GlobalGetData(data
|
|
8557
|
+
case "articleContent": return await GlobalGetData(data.methodType, {
|
|
8685
8558
|
...baseRequestConfig,
|
|
8686
|
-
url: bilibiliApiUrls.getArticleContent({ id: data
|
|
8559
|
+
url: bilibiliApiUrls.getArticleContent({ id: data.id })
|
|
8687
8560
|
});
|
|
8688
|
-
case "articleCards": return await GlobalGetData(data
|
|
8561
|
+
case "articleCards": return await GlobalGetData(data.methodType, {
|
|
8689
8562
|
...baseRequestConfig,
|
|
8690
|
-
url: bilibiliApiUrls.getArticleCards({ ids: data
|
|
8563
|
+
url: bilibiliApiUrls.getArticleCards({ ids: data.ids })
|
|
8691
8564
|
});
|
|
8692
|
-
case "articleInfo": return await GlobalGetData(data
|
|
8565
|
+
case "articleInfo": return await GlobalGetData(data.methodType, {
|
|
8693
8566
|
...baseRequestConfig,
|
|
8694
|
-
url: bilibiliApiUrls.getArticleInfo({ id: data
|
|
8567
|
+
url: bilibiliApiUrls.getArticleInfo({ id: data.id })
|
|
8695
8568
|
});
|
|
8696
|
-
case "articleListInfo": return await GlobalGetData(data
|
|
8569
|
+
case "articleListInfo": return await GlobalGetData(data.methodType, {
|
|
8697
8570
|
...baseRequestConfig,
|
|
8698
|
-
url: bilibiliApiUrls.getArticleListInfo({ id: data
|
|
8571
|
+
url: bilibiliApiUrls.getArticleListInfo({ id: data.id })
|
|
8699
8572
|
});
|
|
8700
|
-
case "captchaFromVoucher": return await GlobalGetData(data
|
|
8573
|
+
case "captchaFromVoucher": return await GlobalGetData(data.methodType, {
|
|
8701
8574
|
...baseRequestConfig,
|
|
8702
8575
|
method: "POST",
|
|
8703
|
-
url: bilibiliApiUrls.getCaptchaFromVoucher(data
|
|
8704
|
-
data: bilibiliApiUrls.getCaptchaFromVoucher(data
|
|
8576
|
+
url: bilibiliApiUrls.getCaptchaFromVoucher(data).Url,
|
|
8577
|
+
data: bilibiliApiUrls.getCaptchaFromVoucher(data).Body
|
|
8705
8578
|
});
|
|
8706
|
-
case "validateCaptcha": return await GlobalGetData(data
|
|
8579
|
+
case "validateCaptcha": return await GlobalGetData(data.methodType, {
|
|
8707
8580
|
...baseRequestConfig,
|
|
8708
8581
|
method: "POST",
|
|
8709
|
-
url: bilibiliApiUrls.validateCaptcha(data
|
|
8710
|
-
data: bilibiliApiUrls.validateCaptcha(data
|
|
8582
|
+
url: bilibiliApiUrls.validateCaptcha(data).Url,
|
|
8583
|
+
data: bilibiliApiUrls.validateCaptcha(data).Body
|
|
8711
8584
|
});
|
|
8712
8585
|
case "videoDanmaku": {
|
|
8713
8586
|
const url = bilibiliApiUrls.getVideoDanmaku({
|
|
8714
|
-
cid: data
|
|
8715
|
-
segment_index: data
|
|
8587
|
+
cid: data.cid,
|
|
8588
|
+
segment_index: data.segment_index
|
|
8716
8589
|
});
|
|
8717
8590
|
try {
|
|
8718
8591
|
const response = await fetchData({
|
|
@@ -8727,7 +8600,7 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8727
8600
|
data: null,
|
|
8728
8601
|
amagiError: {
|
|
8729
8602
|
...response.error.amagiError,
|
|
8730
|
-
requestType: data
|
|
8603
|
+
requestType: data.methodType
|
|
8731
8604
|
}
|
|
8732
8605
|
});
|
|
8733
8606
|
throw networkError;
|
|
@@ -8739,20 +8612,19 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8739
8612
|
};
|
|
8740
8613
|
} catch (error) {
|
|
8741
8614
|
if (error && typeof error === "object" && "code" in error) return error;
|
|
8742
|
-
const Err = {
|
|
8743
|
-
errorDescription: `获取弹幕数据失败:${error instanceof Error ? error.message : "未知错误"}`,
|
|
8744
|
-
requestType: data$1.methodType,
|
|
8745
|
-
requestUrl: url
|
|
8746
|
-
};
|
|
8747
8615
|
return {
|
|
8748
|
-
code:
|
|
8616
|
+
code: "UNKNOWN_ERROR",
|
|
8749
8617
|
data: null,
|
|
8750
|
-
amagiError:
|
|
8618
|
+
amagiError: {
|
|
8619
|
+
errorDescription: `获取弹幕数据失败:${error instanceof Error ? error.message : "未知错误"}`,
|
|
8620
|
+
requestType: data.methodType,
|
|
8621
|
+
requestUrl: url
|
|
8622
|
+
}
|
|
8751
8623
|
};
|
|
8752
8624
|
}
|
|
8753
8625
|
}
|
|
8754
8626
|
default:
|
|
8755
|
-
logger.warn(`未知的B站数据接口:「${logger.red(data
|
|
8627
|
+
logger.warn(`未知的B站数据接口:「${logger.red(data.methodType)}」`);
|
|
8756
8628
|
return null;
|
|
8757
8629
|
}
|
|
8758
8630
|
};
|
|
@@ -8795,15 +8667,18 @@ const GlobalGetData = async (type, options, retryCount = 0) => {
|
|
|
8795
8667
|
logger.warn(warningMessage);
|
|
8796
8668
|
const riskError = new Error(Err.errorDescription);
|
|
8797
8669
|
Object.assign(riskError, {
|
|
8798
|
-
code:
|
|
8670
|
+
code: "-352",
|
|
8799
8671
|
data: result,
|
|
8800
8672
|
amagiError: Err
|
|
8801
8673
|
});
|
|
8802
8674
|
throw riskError;
|
|
8803
8675
|
}
|
|
8804
|
-
|
|
8676
|
+
const payload = "data" in result ? result.data : "result" in result ? result.result : void 0;
|
|
8677
|
+
const hasPayload = payload !== null && payload !== void 0;
|
|
8678
|
+
const isEmptyObjectPayload = typeof payload === "object" && !Array.isArray(payload) && Object.keys(payload).length === 0;
|
|
8679
|
+
if (result.code !== 0 || !hasPayload || isEmptyObjectPayload) {
|
|
8805
8680
|
if (result.code === -412 && retryCount < MAX_RETRIES) return await GlobalGetData(type, options, retryCount + 1);
|
|
8806
|
-
const errorMessage = bilibiliErrorCodeMap[result.code] ||
|
|
8681
|
+
const errorMessage = bilibiliErrorCodeMap[result.code] || isEmptyObjectPayload && "请求成功但无返回内容" || (result.message ?? "未知错误");
|
|
8807
8682
|
const Err = {
|
|
8808
8683
|
errorDescription: `获取响应数据失败!原因:${errorMessage}!`,
|
|
8809
8684
|
requestType: type ?? "未知请求类型",
|
|
@@ -8832,7 +8707,7 @@ const GlobalGetData = async (type, options, retryCount = 0) => {
|
|
|
8832
8707
|
amagiMessage: warningMessage
|
|
8833
8708
|
};
|
|
8834
8709
|
return {
|
|
8835
|
-
code:
|
|
8710
|
+
code: "UNKNOWN_ERROR",
|
|
8836
8711
|
data: error.data,
|
|
8837
8712
|
amagiError: {
|
|
8838
8713
|
errorDescription: "未知错误",
|
|
@@ -8899,7 +8774,6 @@ const bilibiliErrorCodeMap = {
|
|
|
8899
8774
|
1e5: "验证码获取失败",
|
|
8900
8775
|
100003: "验证码过期"
|
|
8901
8776
|
};
|
|
8902
|
-
|
|
8903
8777
|
//#endregion
|
|
8904
8778
|
//#region src/utils/errors.ts
|
|
8905
8779
|
/**
|
|
@@ -8981,7 +8855,6 @@ const handleError = (error, requestPath) => {
|
|
|
8981
8855
|
requestPath
|
|
8982
8856
|
};
|
|
8983
8857
|
};
|
|
8984
|
-
|
|
8985
8858
|
//#endregion
|
|
8986
8859
|
//#region src/middleware/validation.ts
|
|
8987
8860
|
/**
|
|
@@ -9028,7 +8901,6 @@ const createKuaishouValidationMiddleware = (methodType) => createValidationMiddl
|
|
|
9028
8901
|
* @returns Express中间件函数
|
|
9029
8902
|
*/
|
|
9030
8903
|
const createXiaohongshuValidationMiddleware = (methodType) => createValidationMiddleware(validateXiaohongshuParams, methodType);
|
|
9031
|
-
|
|
9032
8904
|
//#endregion
|
|
9033
8905
|
//#region src/platform/bilibili/routes.ts
|
|
9034
8906
|
/**
|
|
@@ -9076,7 +8948,6 @@ const createBilibiliRoutes = (cookie, requestConfig = getBilibiliDefaultConfig(c
|
|
|
9076
8948
|
for (const [method, path] of Object.entries(BilibiliMethodRoutes)) router.get(path, createBilibiliValidationMiddleware(method), createBilibiliRouteHandler(method, cookie, requestConfig));
|
|
9077
8949
|
return router;
|
|
9078
8950
|
};
|
|
9079
|
-
|
|
9080
8951
|
//#endregion
|
|
9081
8952
|
//#region src/platform/bilibili/index.ts
|
|
9082
8953
|
/** B站相关功能模块 (工具集) */
|
|
@@ -9090,7 +8961,6 @@ const bilibiliUtils = {
|
|
|
9090
8961
|
bilibiliApiUrls,
|
|
9091
8962
|
api: bilibili
|
|
9092
8963
|
};
|
|
9093
|
-
|
|
9094
8964
|
//#endregion
|
|
9095
8965
|
//#region src/platform/douyin/DouyinApi.ts
|
|
9096
8966
|
/**
|
|
@@ -9108,22 +8978,39 @@ const createDeprecatedStub$2 = (methodName) => {
|
|
|
9108
8978
|
* @deprecated v6 已废弃,请使用 douyinFetcher 或 client.douyin.fetcher 替代
|
|
9109
8979
|
*/
|
|
9110
8980
|
const douyin = {
|
|
8981
|
+
/** @deprecated 请使用 douyinFetcher.fetchTextWork 替代 */
|
|
9111
8982
|
getTextWorkInfo: createDeprecatedStub$2("getTextWorkInfo"),
|
|
8983
|
+
/** @deprecated 请使用 douyinFetcher.parseWork 替代 */
|
|
9112
8984
|
getWorkInfo: createDeprecatedStub$2("getWorkInfo"),
|
|
8985
|
+
/** @deprecated 请使用 douyinFetcher.fetchVideoWork 替代 */
|
|
9113
8986
|
getVideoWorkInfo: createDeprecatedStub$2("getVideoWorkInfo"),
|
|
8987
|
+
/** @deprecated 请使用 douyinFetcher.fetchImageAlbumWork 替代 */
|
|
9114
8988
|
getImageAlbumWorkInfo: createDeprecatedStub$2("getImageAlbumWorkInfo"),
|
|
8989
|
+
/** @deprecated 请使用 douyinFetcher.fetchSlidesWork 替代 */
|
|
9115
8990
|
getSlidesWorkInfo: createDeprecatedStub$2("getSlidesWorkInfo"),
|
|
8991
|
+
/** @deprecated 请使用 douyinFetcher.fetchComments 替代 */
|
|
9116
8992
|
getComments: createDeprecatedStub$2("getComments"),
|
|
8993
|
+
/** @deprecated 请使用 douyinFetcher.fetchCommentReplies 替代 */
|
|
9117
8994
|
getCommentReplies: createDeprecatedStub$2("getCommentReplies"),
|
|
8995
|
+
/** @deprecated 请使用 douyinFetcher.fetchUserProfile 替代 */
|
|
9118
8996
|
getUserProfile: createDeprecatedStub$2("getUserProfile"),
|
|
8997
|
+
/** @deprecated 请使用 douyinFetcher.fetchEmojiList 替代 */
|
|
9119
8998
|
getEmojiList: createDeprecatedStub$2("getEmojiList"),
|
|
8999
|
+
/** @deprecated 请使用 douyinFetcher.fetchDynamicEmojiList 替代 */
|
|
9120
9000
|
getEmojiProList: createDeprecatedStub$2("getEmojiProList"),
|
|
9001
|
+
/** @deprecated 请使用 douyinFetcher.fetchUserVideoList 替代 */
|
|
9121
9002
|
getUserVideos: createDeprecatedStub$2("getUserVideos"),
|
|
9003
|
+
/** @deprecated 请使用 douyinFetcher.fetchMusicInfo 替代 */
|
|
9122
9004
|
getMusicInfo: createDeprecatedStub$2("getMusicInfo"),
|
|
9005
|
+
/** @deprecated 请使用 douyinFetcher.fetchSuggestWords 替代 */
|
|
9123
9006
|
getSuggestWords: createDeprecatedStub$2("getSuggestWords"),
|
|
9007
|
+
/** @deprecated 请使用 douyinFetcher.searchContent 替代 */
|
|
9124
9008
|
search: createDeprecatedStub$2("search"),
|
|
9009
|
+
/** @deprecated 请使用 douyinFetcher.fetchLiveRoomInfo 替代 */
|
|
9125
9010
|
getLiveRoomInfo: createDeprecatedStub$2("getLiveRoomInfo"),
|
|
9011
|
+
/** @deprecated 请使用 douyinFetcher.fetchDanmakuList 替代 */
|
|
9126
9012
|
getDanmaku: createDeprecatedStub$2("getDanmaku"),
|
|
9013
|
+
/** @deprecated 请使用 douyinFetcher 的具体方法替代 */
|
|
9127
9014
|
invoke: createDeprecatedStub$2("invoke")
|
|
9128
9015
|
};
|
|
9129
9016
|
/**
|
|
@@ -9137,7 +9024,6 @@ const createBoundDouyinApi = (_cookie, _requestConfig) => {
|
|
|
9137
9024
|
getSearchData: createDeprecatedStub$2("getSearchData")
|
|
9138
9025
|
};
|
|
9139
9026
|
};
|
|
9140
|
-
|
|
9141
9027
|
//#endregion
|
|
9142
9028
|
//#region src/platform/douyin/routes.ts
|
|
9143
9029
|
/**
|
|
@@ -9185,7 +9071,6 @@ const createDouyinRoutes = (cookie, requestConfig = getDouyinDefaultConfig(cooki
|
|
|
9185
9071
|
for (const [method, path] of Object.entries(DouyinMethodRoutes)) router.get(path, createDouyinValidationMiddleware(method), createDouyinRouteHandler(method, cookie, requestConfig));
|
|
9186
9072
|
return router;
|
|
9187
9073
|
};
|
|
9188
|
-
|
|
9189
9074
|
//#endregion
|
|
9190
9075
|
//#region src/platform/douyin/index.ts
|
|
9191
9076
|
/** 抖音相关功能模块 (工具集) */
|
|
@@ -9194,7 +9079,6 @@ const douyinUtils = {
|
|
|
9194
9079
|
douyinApiUrls,
|
|
9195
9080
|
api: douyin
|
|
9196
9081
|
};
|
|
9197
|
-
|
|
9198
9082
|
//#endregion
|
|
9199
9083
|
//#region src/platform/kuaishou/KuaishouApi.ts
|
|
9200
9084
|
/**
|
|
@@ -9212,11 +9096,17 @@ const createDeprecatedStub$1 = (methodName) => {
|
|
|
9212
9096
|
* @deprecated v6 已废弃,请使用 kuaishouFetcher 或 client.kuaishou.fetcher 替代
|
|
9213
9097
|
*/
|
|
9214
9098
|
const kuaishou = {
|
|
9099
|
+
/** @deprecated 请使用 kuaishouFetcher.fetchVideoWork 替代 */
|
|
9215
9100
|
getWorkInfo: createDeprecatedStub$1("getWorkInfo"),
|
|
9101
|
+
/** @deprecated 请使用 kuaishouFetcher.fetchWorkComments 替代 */
|
|
9216
9102
|
getComments: createDeprecatedStub$1("getComments"),
|
|
9103
|
+
/** @deprecated 请使用 kuaishouFetcher.fetchUserProfile 替代 */
|
|
9217
9104
|
getUserProfile: createDeprecatedStub$1("getUserProfile"),
|
|
9105
|
+
/** @deprecated 请使用 kuaishouFetcher.fetchUserWorkList 替代 */
|
|
9218
9106
|
getUserWorkList: createDeprecatedStub$1("getUserWorkList"),
|
|
9107
|
+
/** @deprecated 请使用 kuaishouFetcher.fetchLiveRoomInfo 替代 */
|
|
9219
9108
|
getLiveRoomInfo: createDeprecatedStub$1("getLiveRoomInfo"),
|
|
9109
|
+
/** @deprecated 请使用 kuaishouFetcher.fetchEmojiList 替代 */
|
|
9220
9110
|
getEmojiList: createDeprecatedStub$1("getEmojiList")
|
|
9221
9111
|
};
|
|
9222
9112
|
/**
|
|
@@ -9227,7 +9117,6 @@ const kuaishou = {
|
|
|
9227
9117
|
const createBoundKuaishouApi = (_cookie, _requestConfig) => {
|
|
9228
9118
|
return { ...kuaishou };
|
|
9229
9119
|
};
|
|
9230
|
-
|
|
9231
9120
|
//#endregion
|
|
9232
9121
|
//#region src/platform/kuaishou/routes.ts
|
|
9233
9122
|
/**
|
|
@@ -9275,7 +9164,6 @@ const createKuaishouRoutes = (cookie, requestConfig = getKuaishouDefaultConfig(c
|
|
|
9275
9164
|
for (const [method, path] of Object.entries(KuaishouMethodRoutes)) router.get(path, createKuaishouValidationMiddleware(method), createKuaishouRouteHandler(method, cookie, requestConfig));
|
|
9276
9165
|
return router;
|
|
9277
9166
|
};
|
|
9278
|
-
|
|
9279
9167
|
//#endregion
|
|
9280
9168
|
//#region src/platform/kuaishou/index.ts
|
|
9281
9169
|
/** 快手相关功能模块 (工具集) */
|
|
@@ -9284,7 +9172,6 @@ const kuaishouUtils = {
|
|
|
9284
9172
|
kuaishouApiUrls,
|
|
9285
9173
|
api: kuaishou
|
|
9286
9174
|
};
|
|
9287
|
-
|
|
9288
9175
|
//#endregion
|
|
9289
9176
|
//#region src/platform/xiaohongshu/XiaohongshuApi.ts
|
|
9290
9177
|
/**
|
|
@@ -9311,12 +9198,19 @@ const createDeprecatedStub = (methodName) => {
|
|
|
9311
9198
|
* @deprecated v6 已废弃,请使用 xiaohongshuFetcher 或 client.xiaohongshu.fetcher 替代
|
|
9312
9199
|
*/
|
|
9313
9200
|
const xiaohongshu = {
|
|
9201
|
+
/** @deprecated 请使用 xiaohongshuFetcher.fetchHomeFeed 替代 */
|
|
9314
9202
|
getHomeFeed: createDeprecatedStub("getHomeFeed"),
|
|
9203
|
+
/** @deprecated 请使用 xiaohongshuFetcher.fetchNoteDetail 替代 */
|
|
9315
9204
|
getNote: createDeprecatedStub("getNote"),
|
|
9205
|
+
/** @deprecated 请使用 xiaohongshuFetcher.fetchNoteComments 替代 */
|
|
9316
9206
|
getComments: createDeprecatedStub("getComments"),
|
|
9207
|
+
/** @deprecated 请使用 xiaohongshuFetcher.fetchUserProfile 替代 */
|
|
9317
9208
|
getUser: createDeprecatedStub("getUser"),
|
|
9209
|
+
/** @deprecated 请使用 xiaohongshuFetcher.fetchUserNoteList 替代 */
|
|
9318
9210
|
getUserNotes: createDeprecatedStub("getUserNotes"),
|
|
9211
|
+
/** @deprecated 请使用 xiaohongshuFetcher.searchNotes 替代 */
|
|
9319
9212
|
getSearchNotes: createDeprecatedStub("getSearchNotes"),
|
|
9213
|
+
/** @deprecated 请使用 xiaohongshuFetcher.fetchEmojiList 替代 */
|
|
9320
9214
|
getEmojiList: createDeprecatedStub("getEmojiList")
|
|
9321
9215
|
};
|
|
9322
9216
|
/**
|
|
@@ -9327,7 +9221,6 @@ const xiaohongshu = {
|
|
|
9327
9221
|
const createBoundXiaohongshuApi = (_cookie, _requestConfig) => {
|
|
9328
9222
|
return { ...xiaohongshu };
|
|
9329
9223
|
};
|
|
9330
|
-
|
|
9331
9224
|
//#endregion
|
|
9332
9225
|
//#region src/platform/xiaohongshu/routes.ts
|
|
9333
9226
|
/**
|
|
@@ -9375,7 +9268,6 @@ const createXiaohongshuRoutes = (cookie, requestConfig = getXiaohongshuDefaultCo
|
|
|
9375
9268
|
for (const [method, path] of Object.entries(XiaohongshuMethodRoutes)) router.get(path, createXiaohongshuValidationMiddleware(method), createXiaohongshuRouteHandler(method, cookie, requestConfig));
|
|
9376
9269
|
return router;
|
|
9377
9270
|
};
|
|
9378
|
-
|
|
9379
9271
|
//#endregion
|
|
9380
9272
|
//#region src/platform/xiaohongshu/index.ts
|
|
9381
9273
|
/** 小红书相关功能模块 (工具集) */
|
|
@@ -9384,7 +9276,6 @@ const xiaohongshuUtils = {
|
|
|
9384
9276
|
xiaohongshuApiUrls,
|
|
9385
9277
|
api: xiaohongshu
|
|
9386
9278
|
};
|
|
9387
|
-
|
|
9388
9279
|
//#endregion
|
|
9389
9280
|
//#region src/server/index.ts
|
|
9390
9281
|
/**
|
|
@@ -9434,7 +9325,7 @@ const createAmagiClient = (options) => {
|
|
|
9434
9325
|
* @deprecated v6 已废弃,请使用 douyin.fetcher 替代
|
|
9435
9326
|
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
9436
9327
|
*/
|
|
9437
|
-
const getDouyinData
|
|
9328
|
+
const getDouyinData = (..._args) => {
|
|
9438
9329
|
checkDeprecation("getDouyinData");
|
|
9439
9330
|
throw new Error("getDouyinData 已废弃");
|
|
9440
9331
|
};
|
|
@@ -9442,7 +9333,7 @@ const createAmagiClient = (options) => {
|
|
|
9442
9333
|
* @deprecated v6 已废弃,请使用 bilibili.fetcher 替代
|
|
9443
9334
|
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
9444
9335
|
*/
|
|
9445
|
-
const getBilibiliData
|
|
9336
|
+
const getBilibiliData = (..._args) => {
|
|
9446
9337
|
checkDeprecation("getBilibiliData");
|
|
9447
9338
|
throw new Error("getBilibiliData 已废弃");
|
|
9448
9339
|
};
|
|
@@ -9450,7 +9341,7 @@ const createAmagiClient = (options) => {
|
|
|
9450
9341
|
* @deprecated v6 已废弃,请使用 kuaishou.fetcher 替代
|
|
9451
9342
|
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
9452
9343
|
*/
|
|
9453
|
-
const getKuaishouData
|
|
9344
|
+
const getKuaishouData = (..._args) => {
|
|
9454
9345
|
checkDeprecation("getKuaishouData");
|
|
9455
9346
|
throw new Error("getKuaishouData 已废弃");
|
|
9456
9347
|
};
|
|
@@ -9458,42 +9349,65 @@ const createAmagiClient = (options) => {
|
|
|
9458
9349
|
* @deprecated v6 已废弃,请使用 xiaohongshu.fetcher 替代
|
|
9459
9350
|
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
9460
9351
|
*/
|
|
9461
|
-
const getXiaohongshuData
|
|
9352
|
+
const getXiaohongshuData = (..._args) => {
|
|
9462
9353
|
checkDeprecation("getXiaohongshuData");
|
|
9463
9354
|
throw new Error("getXiaohongshuData 已废弃");
|
|
9464
9355
|
};
|
|
9465
9356
|
return {
|
|
9357
|
+
/** 启动本地HTTP服务 */
|
|
9466
9358
|
startServer,
|
|
9359
|
+
/** 事件系统 */
|
|
9467
9360
|
events: amagiEvents,
|
|
9468
|
-
|
|
9469
|
-
|
|
9470
|
-
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
|
|
9361
|
+
/**
|
|
9362
|
+
* 注册事件监听器
|
|
9363
|
+
* @param event - 事件名称
|
|
9364
|
+
* @param listener - 事件处理函数
|
|
9365
|
+
*/
|
|
9366
|
+
on: (event, listener) => amagiEvents.on(event, listener),
|
|
9367
|
+
/**
|
|
9368
|
+
* 注册一次性事件监听器
|
|
9369
|
+
* @param event - 事件名称
|
|
9370
|
+
* @param listener - 事件处理函数 (只触发一次)
|
|
9371
|
+
*/
|
|
9372
|
+
once: (event, listener) => amagiEvents.once(event, listener),
|
|
9373
|
+
/** @deprecated v6 已废弃,请使用 douyin.fetcher 替代 */
|
|
9374
|
+
getDouyinData,
|
|
9375
|
+
/** @deprecated v6 已废弃,请使用 bilibili.fetcher 替代 */
|
|
9376
|
+
getBilibiliData,
|
|
9377
|
+
/** @deprecated v6 已废弃,请使用 kuaishou.fetcher 替代 */
|
|
9378
|
+
getKuaishouData,
|
|
9379
|
+
/** @deprecated v6 已废弃,请使用 xiaohongshu.fetcher 替代 */
|
|
9380
|
+
getXiaohongshuData,
|
|
9474
9381
|
douyin: {
|
|
9475
9382
|
...douyinUtils,
|
|
9383
|
+
/** @deprecated 请使用 fetcher 替代 */
|
|
9476
9384
|
api: createBoundDouyinApi(douyinCookie, requestConfig),
|
|
9385
|
+
/** fetcher */
|
|
9477
9386
|
fetcher: createBoundDouyinFetcher(douyinCookie, requestConfig)
|
|
9478
9387
|
},
|
|
9479
9388
|
bilibili: {
|
|
9480
9389
|
...bilibiliUtils,
|
|
9390
|
+
/** @deprecated 请使用 fetcher 替代 */
|
|
9481
9391
|
api: createBoundBilibiliApi(bilibiliCookie, requestConfig),
|
|
9392
|
+
/** fetcher */
|
|
9482
9393
|
fetcher: createBoundBilibiliFetcher(bilibiliCookie, requestConfig)
|
|
9483
9394
|
},
|
|
9484
9395
|
kuaishou: {
|
|
9485
9396
|
...kuaishouUtils,
|
|
9397
|
+
/** @deprecated 请使用 fetcher 替代 */
|
|
9486
9398
|
api: createBoundKuaishouApi(kuaishouCookie, requestConfig),
|
|
9399
|
+
/** fetcher */
|
|
9487
9400
|
fetcher: createBoundKuaishouFetcher(kuaishouCookie, requestConfig)
|
|
9488
9401
|
},
|
|
9489
9402
|
xiaohongshu: {
|
|
9490
9403
|
...xiaohongshuUtils,
|
|
9404
|
+
/** @deprecated 请使用 fetcher 替代 */
|
|
9491
9405
|
api: createBoundXiaohongshuApi(xiaohongshuCookie, requestConfig),
|
|
9406
|
+
/** fetcher */
|
|
9492
9407
|
fetcher: createBoundXiaohongshuFetcher(xiaohongshuCookie, requestConfig)
|
|
9493
9408
|
}
|
|
9494
9409
|
};
|
|
9495
9410
|
};
|
|
9496
|
-
|
|
9497
9411
|
//#endregion
|
|
9498
9412
|
//#region src/types/BilibiliAPIParams.ts
|
|
9499
9413
|
/**
|
|
@@ -9502,136 +9416,133 @@ const createAmagiClient = (options) => {
|
|
|
9502
9416
|
* 对应 CommentParams.type 与 CommentReplyParams.type
|
|
9503
9417
|
* @see https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/comment/readme.md#评论区类型代码
|
|
9504
9418
|
*/
|
|
9505
|
-
let CommentType = /* @__PURE__ */ function(CommentType
|
|
9419
|
+
let CommentType = /* @__PURE__ */ function(CommentType) {
|
|
9506
9420
|
/** 视频稿件:oid 为稿件 avid */
|
|
9507
|
-
CommentType
|
|
9421
|
+
CommentType[CommentType["Video"] = 1] = "Video";
|
|
9508
9422
|
/** 话题:oid 为话题 id */
|
|
9509
|
-
CommentType
|
|
9423
|
+
CommentType[CommentType["Topic"] = 2] = "Topic";
|
|
9510
9424
|
/** 活动:oid 为活动 id */
|
|
9511
|
-
CommentType
|
|
9425
|
+
CommentType[CommentType["Activity"] = 4] = "Activity";
|
|
9512
9426
|
/** 小视频:oid 为小视频 id */
|
|
9513
|
-
CommentType
|
|
9427
|
+
CommentType[CommentType["SmallVideo"] = 5] = "SmallVideo";
|
|
9514
9428
|
/** 小黑屋封禁信息:oid 为封禁公示 id */
|
|
9515
|
-
CommentType
|
|
9429
|
+
CommentType[CommentType["BlockInfo"] = 6] = "BlockInfo";
|
|
9516
9430
|
/** 公告信息:oid 为公告 id */
|
|
9517
|
-
CommentType
|
|
9431
|
+
CommentType[CommentType["Announcement"] = 7] = "Announcement";
|
|
9518
9432
|
/** 直播活动:oid 为直播间 id */
|
|
9519
|
-
CommentType
|
|
9433
|
+
CommentType[CommentType["LiveActivity"] = 8] = "LiveActivity";
|
|
9520
9434
|
/** 活动稿件:oid 含义未知 */
|
|
9521
|
-
CommentType
|
|
9435
|
+
CommentType[CommentType["ActivityVideo"] = 9] = "ActivityVideo";
|
|
9522
9436
|
/** 直播公告:oid 含义未知 */
|
|
9523
|
-
CommentType
|
|
9437
|
+
CommentType[CommentType["LiveAnnouncement"] = 10] = "LiveAnnouncement";
|
|
9524
9438
|
/** 相簿(图片动态):oid 为相簿 id */
|
|
9525
|
-
CommentType
|
|
9439
|
+
CommentType[CommentType["Album"] = 11] = "Album";
|
|
9526
9440
|
/** 专栏:oid 为专栏 cvid */
|
|
9527
|
-
CommentType
|
|
9441
|
+
CommentType[CommentType["Article"] = 12] = "Article";
|
|
9528
9442
|
/** 票务:oid 含义未知 */
|
|
9529
|
-
CommentType
|
|
9443
|
+
CommentType[CommentType["Ticket"] = 13] = "Ticket";
|
|
9530
9444
|
/** 音频:oid 为音频 auid */
|
|
9531
|
-
CommentType
|
|
9445
|
+
CommentType[CommentType["Audio"] = 14] = "Audio";
|
|
9532
9446
|
/** 风纪委员会:oid 为众裁项目 id */
|
|
9533
|
-
CommentType
|
|
9447
|
+
CommentType[CommentType["Jury"] = 15] = "Jury";
|
|
9534
9448
|
/** 点评:oid 含义未知 */
|
|
9535
|
-
CommentType
|
|
9449
|
+
CommentType[CommentType["Review"] = 16] = "Review";
|
|
9536
9450
|
/** 动态(纯文字动态&分享):oid 为动态 id */
|
|
9537
|
-
CommentType
|
|
9451
|
+
CommentType[CommentType["Dynamic"] = 17] = "Dynamic";
|
|
9538
9452
|
/** 播单:oid 含义未知 */
|
|
9539
|
-
CommentType
|
|
9453
|
+
CommentType[CommentType["Playlist"] = 18] = "Playlist";
|
|
9540
9454
|
/** 音乐播单:oid 含义未知 */
|
|
9541
|
-
CommentType
|
|
9455
|
+
CommentType[CommentType["MusicPlaylist"] = 19] = "MusicPlaylist";
|
|
9542
9456
|
/** 漫画:oid 含义未知 */
|
|
9543
|
-
CommentType
|
|
9457
|
+
CommentType[CommentType["Comic1"] = 20] = "Comic1";
|
|
9544
9458
|
/** 漫画:oid 含义未知 */
|
|
9545
|
-
CommentType
|
|
9459
|
+
CommentType[CommentType["Comic2"] = 21] = "Comic2";
|
|
9546
9460
|
/** 漫画:oid 为漫画 mcid */
|
|
9547
|
-
CommentType
|
|
9461
|
+
CommentType[CommentType["Comic"] = 22] = "Comic";
|
|
9548
9462
|
/** 课程:oid 为课程 epid */
|
|
9549
|
-
CommentType
|
|
9550
|
-
return CommentType
|
|
9463
|
+
CommentType[CommentType["Course"] = 33] = "Course";
|
|
9464
|
+
return CommentType;
|
|
9551
9465
|
}({});
|
|
9552
|
-
|
|
9553
9466
|
//#endregion
|
|
9554
9467
|
//#region src/types/ReturnDataType/Bilibili/Dynamic/index.ts
|
|
9555
9468
|
/**
|
|
9556
9469
|
* 转发动态种子动态主体类型枚举
|
|
9557
9470
|
*/
|
|
9558
|
-
let MajorType = /* @__PURE__ */ function(MajorType
|
|
9471
|
+
let MajorType = /* @__PURE__ */ function(MajorType) {
|
|
9559
9472
|
/** 动态失效 */
|
|
9560
|
-
MajorType
|
|
9473
|
+
MajorType["NONE"] = "MAJOR_TYPE_NONE";
|
|
9561
9474
|
/** 图文动态 */
|
|
9562
|
-
MajorType
|
|
9475
|
+
MajorType["OPUS"] = "MAJOR_TYPE_OPUS";
|
|
9563
9476
|
/** 视频 */
|
|
9564
|
-
MajorType
|
|
9477
|
+
MajorType["ARCHIVE"] = "MAJOR_TYPE_ARCHIVE";
|
|
9565
9478
|
/** 剧集更新 */
|
|
9566
|
-
MajorType
|
|
9479
|
+
MajorType["PGC"] = "MAJOR_TYPE_PGC";
|
|
9567
9480
|
/** 课程 */
|
|
9568
|
-
MajorType
|
|
9481
|
+
MajorType["COURSES"] = "MAJOR_TYPE_COURSES";
|
|
9569
9482
|
/** 带图动态 */
|
|
9570
|
-
MajorType
|
|
9483
|
+
MajorType["DRAW"] = "MAJOR_TYPE_DRAW";
|
|
9571
9484
|
/** 文章 */
|
|
9572
|
-
MajorType
|
|
9485
|
+
MajorType["ARTICLE"] = "MAJOR_TYPE_ARTICLE";
|
|
9573
9486
|
/** 音频更新 */
|
|
9574
|
-
MajorType
|
|
9487
|
+
MajorType["MUSIC"] = "MAJOR_TYPE_MUSIC";
|
|
9575
9488
|
/** 一般类型 */
|
|
9576
|
-
MajorType
|
|
9489
|
+
MajorType["COMMON"] = "MAJOR_TYPE_COMMON";
|
|
9577
9490
|
/** 直播间分享 */
|
|
9578
|
-
MajorType
|
|
9491
|
+
MajorType["LIVE"] = "MAJOR_TYPE_LIVE";
|
|
9579
9492
|
/** 媒体列表 */
|
|
9580
|
-
MajorType
|
|
9493
|
+
MajorType["MEDIALIST"] = "MAJOR_TYPE_MEDIALIST";
|
|
9581
9494
|
/** 小程序 */
|
|
9582
|
-
MajorType
|
|
9495
|
+
MajorType["APPLET"] = "MAJOR_TYPE_APPLET";
|
|
9583
9496
|
/** 订阅 */
|
|
9584
|
-
MajorType
|
|
9497
|
+
MajorType["SUBSCRIPTION"] = "MAJOR_TYPE_SUBSCRIPTION";
|
|
9585
9498
|
/** 直播状态 */
|
|
9586
|
-
MajorType
|
|
9499
|
+
MajorType["LIVE_RCMD"] = "MAJOR_TYPE_LIVE_RCMD";
|
|
9587
9500
|
/** 合集更新 */
|
|
9588
|
-
MajorType
|
|
9501
|
+
MajorType["UGC_SEASON"] = "MAJOR_TYPE_UGC_SEASON";
|
|
9589
9502
|
/** 新订阅 */
|
|
9590
|
-
MajorType
|
|
9503
|
+
MajorType["SUBSCRIPTION_NEW"] = "MAJOR_TYPE_SUBSCRIPTION_NEW";
|
|
9591
9504
|
/** 充电相关 */
|
|
9592
|
-
MajorType
|
|
9593
|
-
return MajorType
|
|
9505
|
+
MajorType["UPOWER_COMMON"] = "MAJOR_TYPE_UPOWER_COMMON";
|
|
9506
|
+
return MajorType;
|
|
9594
9507
|
}({});
|
|
9595
9508
|
/**
|
|
9596
9509
|
* 相关内容卡片类型枚举
|
|
9597
9510
|
* 用于标识动态中附加的相关内容卡片的类型
|
|
9598
9511
|
*/
|
|
9599
|
-
let AdditionalType = /* @__PURE__ */ function(AdditionalType
|
|
9512
|
+
let AdditionalType = /* @__PURE__ */ function(AdditionalType) {
|
|
9600
9513
|
/** 无相关内容 */
|
|
9601
|
-
AdditionalType
|
|
9514
|
+
AdditionalType["NONE"] = "ADDITIONAL_TYPE_NONE";
|
|
9602
9515
|
/** 剧集相关 */
|
|
9603
|
-
AdditionalType
|
|
9516
|
+
AdditionalType["PGC"] = "ADDITIONAL_TYPE_PGC";
|
|
9604
9517
|
/** 商品信息 */
|
|
9605
|
-
AdditionalType
|
|
9518
|
+
AdditionalType["GOODS"] = "ADDITIONAL_TYPE_GOODS";
|
|
9606
9519
|
/** 投票 */
|
|
9607
|
-
AdditionalType
|
|
9520
|
+
AdditionalType["VOTE"] = "ADDITIONAL_TYPE_VOTE";
|
|
9608
9521
|
/** 一般类型 */
|
|
9609
|
-
AdditionalType
|
|
9522
|
+
AdditionalType["COMMON"] = "ADDITIONAL_TYPE_COMMON";
|
|
9610
9523
|
/** 比赛信息 */
|
|
9611
|
-
AdditionalType
|
|
9524
|
+
AdditionalType["MATCH"] = "ADDITIONAL_TYPE_MATCH";
|
|
9612
9525
|
/** UP主推荐 */
|
|
9613
|
-
AdditionalType
|
|
9526
|
+
AdditionalType["UP_RCMD"] = "ADDITIONAL_TYPE_UP_RCMD";
|
|
9614
9527
|
/** 视频跳转 */
|
|
9615
|
-
AdditionalType
|
|
9528
|
+
AdditionalType["UGC"] = "ADDITIONAL_TYPE_UGC";
|
|
9616
9529
|
/** 直播预约 */
|
|
9617
|
-
AdditionalType
|
|
9530
|
+
AdditionalType["RESERVE"] = "ADDITIONAL_TYPE_RESERVE";
|
|
9618
9531
|
/** 充电专属抽奖 */
|
|
9619
|
-
AdditionalType
|
|
9620
|
-
return AdditionalType
|
|
9532
|
+
AdditionalType["UPOWER_LOTTERY"] = "ADDITIONAL_TYPE_UPOWER_LOTTERY";
|
|
9533
|
+
return AdditionalType;
|
|
9621
9534
|
}({});
|
|
9622
|
-
|
|
9623
9535
|
//#endregion
|
|
9624
|
-
//#region src/types/ReturnDataType/Bilibili/DynamicInfo.ts
|
|
9625
|
-
let DynamicType = /* @__PURE__ */ function(DynamicType
|
|
9626
|
-
DynamicType
|
|
9627
|
-
DynamicType
|
|
9628
|
-
DynamicType
|
|
9629
|
-
DynamicType
|
|
9630
|
-
DynamicType
|
|
9631
|
-
DynamicType
|
|
9632
|
-
return DynamicType
|
|
9536
|
+
//#region src/types/ReturnDataType/Bilibili/DynamicInfo/index.ts
|
|
9537
|
+
let DynamicType = /* @__PURE__ */ function(DynamicType) {
|
|
9538
|
+
DynamicType["AV"] = "DYNAMIC_TYPE_AV";
|
|
9539
|
+
DynamicType["DRAW"] = "DYNAMIC_TYPE_DRAW";
|
|
9540
|
+
DynamicType["WORD"] = "DYNAMIC_TYPE_WORD";
|
|
9541
|
+
DynamicType["LIVE_RCMD"] = "DYNAMIC_TYPE_LIVE_RCMD";
|
|
9542
|
+
DynamicType["FORWARD"] = "DYNAMIC_TYPE_FORWARD";
|
|
9543
|
+
DynamicType["ARTICLE"] = "DYNAMIC_TYPE_ARTICLE";
|
|
9544
|
+
return DynamicType;
|
|
9633
9545
|
}({});
|
|
9634
|
-
|
|
9635
9546
|
//#endregion
|
|
9636
9547
|
//#region src/types/method-keys.ts
|
|
9637
9548
|
/**
|
|
@@ -9890,7 +9801,6 @@ const MethodMaps = {
|
|
|
9890
9801
|
toFetcher: XiaohongshuMethodToFetcher
|
|
9891
9802
|
}
|
|
9892
9803
|
};
|
|
9893
|
-
|
|
9894
9804
|
//#endregion
|
|
9895
9805
|
//#region src/types/api-spec.ts
|
|
9896
9806
|
const DouyinMethodMapping = {
|
|
@@ -9912,8 +9822,7 @@ const DouyinMethodMapping = {
|
|
|
9912
9822
|
动态表情数据: "fetchDynamicEmojiList",
|
|
9913
9823
|
弹幕数据: "fetchDanmakuList"
|
|
9914
9824
|
};
|
|
9915
|
-
|
|
9916
|
-
const DouyinMethodReverseMapping = Object.fromEntries(Object.entries(DouyinMethodMapping).map(([k, v]) => [v, k]));
|
|
9825
|
+
Object.fromEntries(Object.entries(DouyinMethodMapping).map(([k, v]) => [v, k]));
|
|
9917
9826
|
const BilibiliMethodMapping = {
|
|
9918
9827
|
单个视频作品数据: "fetchVideoInfo",
|
|
9919
9828
|
单个视频下载信息数据: "fetchVideoStreamUrl",
|
|
@@ -9943,8 +9852,7 @@ const BilibiliMethodMapping = {
|
|
|
9943
9852
|
从_v_voucher_申请_captcha: "requestCaptchaFromVoucher",
|
|
9944
9853
|
验证验证码结果: "validateCaptchaResult"
|
|
9945
9854
|
};
|
|
9946
|
-
|
|
9947
|
-
const BilibiliMethodReverseMapping = Object.fromEntries(Object.entries(BilibiliMethodMapping).map(([k, v]) => [v, k]));
|
|
9855
|
+
Object.fromEntries(Object.entries(BilibiliMethodMapping).map(([k, v]) => [v, k]));
|
|
9948
9856
|
const KuaishouMethodMapping = {
|
|
9949
9857
|
单个视频作品数据: "fetchVideoWork",
|
|
9950
9858
|
评论数据: "fetchWorkComments",
|
|
@@ -9953,8 +9861,7 @@ const KuaishouMethodMapping = {
|
|
|
9953
9861
|
直播间信息数据: "fetchLiveRoomInfo",
|
|
9954
9862
|
Emoji数据: "fetchEmojiList"
|
|
9955
9863
|
};
|
|
9956
|
-
|
|
9957
|
-
const KuaishouMethodReverseMapping = Object.fromEntries(Object.entries(KuaishouMethodMapping).map(([k, v]) => [v, k]));
|
|
9864
|
+
Object.fromEntries(Object.entries(KuaishouMethodMapping).map(([k, v]) => [v, k]));
|
|
9958
9865
|
const XiaohongshuMethodMapping = {
|
|
9959
9866
|
首页推荐数据: "fetchHomeFeed",
|
|
9960
9867
|
单个笔记数据: "fetchNoteDetail",
|
|
@@ -9964,8 +9871,7 @@ const XiaohongshuMethodMapping = {
|
|
|
9964
9871
|
表情列表: "fetchEmojiList",
|
|
9965
9872
|
搜索笔记: "searchNotes"
|
|
9966
9873
|
};
|
|
9967
|
-
|
|
9968
|
-
const XiaohongshuMethodReverseMapping = Object.fromEntries(Object.entries(XiaohongshuMethodMapping).map(([k, v]) => [v, k]));
|
|
9874
|
+
Object.fromEntries(Object.entries(XiaohongshuMethodMapping).map(([k, v]) => [v, k]));
|
|
9969
9875
|
/**
|
|
9970
9876
|
* Douyin HTTP API 路由
|
|
9971
9877
|
*
|
|
@@ -10073,7 +9979,6 @@ function getApiRoute(platform, methodType) {
|
|
|
10073
9979
|
xiaohongshu: XiaohongshuApiRoutes
|
|
10074
9980
|
}[platform][methodType];
|
|
10075
9981
|
}
|
|
10076
|
-
|
|
10077
9982
|
//#endregion
|
|
10078
9983
|
//#region src/index.ts
|
|
10079
9984
|
/**
|
|
@@ -10081,7 +9986,7 @@ function getApiRoute(platform, methodType) {
|
|
|
10081
9986
|
* 构建后使用 __VERSION__,开发环境从 package.json 读取
|
|
10082
9987
|
*/
|
|
10083
9988
|
const getVersion = () => {
|
|
10084
|
-
return "6.1.
|
|
9989
|
+
return "6.1.3";
|
|
10085
9990
|
};
|
|
10086
9991
|
const VERSION = getVersion();
|
|
10087
9992
|
/**
|
|
@@ -10128,7 +10033,6 @@ const CreateApp = CreateAmagiApp;
|
|
|
10128
10033
|
/** After instantiation, it can interact with the specified platform API to quickly obtain data. */
|
|
10129
10034
|
const Client = CreateApp;
|
|
10130
10035
|
const amagi = Client;
|
|
10131
|
-
|
|
10132
10036
|
//#endregion
|
|
10133
10037
|
exports.AdditionalType = AdditionalType;
|
|
10134
10038
|
exports.ApiError = ApiError;
|
|
@@ -10285,4 +10189,4 @@ exports.xiaohongshu = xiaohongshu;
|
|
|
10285
10189
|
exports.xiaohongshuApiUrls = xiaohongshuApiUrls;
|
|
10286
10190
|
exports.xiaohongshuFetcher = xiaohongshuFetcher;
|
|
10287
10191
|
exports.xiaohongshuSign = xiaohongshuSign;
|
|
10288
|
-
exports.xiaohongshuUtils = xiaohongshuUtils;
|
|
10192
|
+
exports.xiaohongshuUtils = xiaohongshuUtils;
|