@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.mjs
CHANGED
|
@@ -7,7 +7,6 @@ import axios, { AxiosError } from "axios";
|
|
|
7
7
|
import { Chalk } from "chalk";
|
|
8
8
|
import protobuf from "protobufjs";
|
|
9
9
|
import express from "express";
|
|
10
|
-
|
|
11
10
|
//#region src/utils/deprecation.ts
|
|
12
11
|
/**
|
|
13
12
|
* 废弃 API 注册表
|
|
@@ -66,7 +65,9 @@ function checkDeprecation(apiName) {
|
|
|
66
65
|
* @returns 格式化的废弃提示消息字符串
|
|
67
66
|
*/
|
|
68
67
|
function buildDeprecationMessage(config) {
|
|
69
|
-
const lines = [`[DEPRECATED] "${config.name}" 已在 v${config.deprecatedIn}
|
|
68
|
+
const lines = [`[DEPRECATED] "${config.name}" 已在 v${config.deprecatedIn} 版本废弃。`];
|
|
69
|
+
if (config.replacement) lines.push(`请使用 "${config.replacement}" 替代。`);
|
|
70
|
+
else lines.push("此接口已被上游删除,无法继续使用,无可用替代方案。");
|
|
70
71
|
if (config.removedIn) lines.push(`此 API 将在 v${config.removedIn} 版本移除。`);
|
|
71
72
|
if (config.migrationGuide) lines.push(`迁移指南: ${config.migrationGuide}`);
|
|
72
73
|
return lines.join("\n");
|
|
@@ -174,10 +175,6 @@ registerDeprecatedApi({
|
|
|
174
175
|
name: "动态详情数据",
|
|
175
176
|
replacement: "fetchDynamicDetail"
|
|
176
177
|
},
|
|
177
|
-
{
|
|
178
|
-
name: "动态卡片数据",
|
|
179
|
-
replacement: "fetchDynamicCard"
|
|
180
|
-
},
|
|
181
178
|
{
|
|
182
179
|
name: "直播间信息",
|
|
183
180
|
replacement: "fetchLiveRoomInfo"
|
|
@@ -327,7 +324,20 @@ registerDeprecatedApi({
|
|
|
327
324
|
throwError: true
|
|
328
325
|
});
|
|
329
326
|
});
|
|
330
|
-
|
|
327
|
+
registerDeprecatedApi({
|
|
328
|
+
name: `methodType: '动态卡片数据'`,
|
|
329
|
+
deprecatedIn: "6.0.0",
|
|
330
|
+
removedIn: "7.0.0",
|
|
331
|
+
migrationGuide: "https://amagi-docs.vercel.app/docs/changelog/6.1.3",
|
|
332
|
+
throwError: false
|
|
333
|
+
});
|
|
334
|
+
registerDeprecatedApi({
|
|
335
|
+
name: "fetchDynamicCard",
|
|
336
|
+
deprecatedIn: "6.1.3",
|
|
337
|
+
removedIn: "7.0.0",
|
|
338
|
+
migrationGuide: "https://amagi-docs.vercel.app/docs/changelog/6.1.3",
|
|
339
|
+
throwError: false
|
|
340
|
+
});
|
|
331
341
|
//#endregion
|
|
332
342
|
//#region src/model/DataFetchers.ts
|
|
333
343
|
/**
|
|
@@ -435,7 +445,6 @@ function getXiaohongshuData(..._args) {
|
|
|
435
445
|
checkDeprecation("getXiaohongshuData");
|
|
436
446
|
throw new Error("getXiaohongshuData 已废弃");
|
|
437
447
|
}
|
|
438
|
-
|
|
439
448
|
//#endregion
|
|
440
449
|
//#region src/platform/bilibili/API.ts
|
|
441
450
|
/**
|
|
@@ -449,133 +458,138 @@ var BilibiliAPI = class {
|
|
|
449
458
|
return "https://api.bilibili.com/x/web-interface/nav";
|
|
450
459
|
}
|
|
451
460
|
/** 获取视频详细信息 */
|
|
452
|
-
getVideoInfo(data
|
|
453
|
-
return `https://api.bilibili.com/x/web-interface/view?bvid=${data
|
|
461
|
+
getVideoInfo(data) {
|
|
462
|
+
return `https://api.bilibili.com/x/web-interface/view?bvid=${data.bvid}`;
|
|
454
463
|
}
|
|
455
464
|
/** 获取视频流信息 */
|
|
456
|
-
getVideoStream(data
|
|
457
|
-
return `https://api.bilibili.com/x/player/playurl?avid=${data
|
|
465
|
+
getVideoStream(data) {
|
|
466
|
+
return `https://api.bilibili.com/x/player/playurl?avid=${data.avid}&cid=${data.cid}`;
|
|
458
467
|
}
|
|
459
468
|
/**
|
|
460
469
|
* 获取评论区明细
|
|
461
470
|
* @see https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/comment/readme.md#评论区类型代码
|
|
462
471
|
*/
|
|
463
|
-
getComments(data
|
|
472
|
+
getComments(data) {
|
|
464
473
|
const params = new URLSearchParams({
|
|
465
|
-
oid: data
|
|
466
|
-
type: data
|
|
467
|
-
mode: (data
|
|
474
|
+
oid: data.oid.toString(),
|
|
475
|
+
type: data.type.toString(),
|
|
476
|
+
mode: (data.mode ?? 3).toString(),
|
|
468
477
|
plat: "1",
|
|
469
478
|
seek_rpid: "",
|
|
470
479
|
web_location: "1315875"
|
|
471
480
|
});
|
|
472
|
-
if (data
|
|
481
|
+
if (data.pagination_str) params.append("pagination_str", JSON.stringify({ offset: data.pagination_str }));
|
|
473
482
|
else params.append("pagination_str", JSON.stringify({ offset: "" }));
|
|
474
483
|
return `https://api.bilibili.com/x/v2/reply/wbi/main?${params.toString()}`;
|
|
475
484
|
}
|
|
476
485
|
/** 获取评论区状态 */
|
|
477
|
-
getCommentStatus(data
|
|
478
|
-
return `https://api.bilibili.com/x/v2/reply/subject/description?type=${data
|
|
486
|
+
getCommentStatus(data) {
|
|
487
|
+
return `https://api.bilibili.com/x/v2/reply/subject/description?type=${data.type}&oid=${data.oid}`;
|
|
479
488
|
}
|
|
480
489
|
/** 获取指定评论的回复 */
|
|
481
|
-
getCommentReplies(data
|
|
482
|
-
return `https://api.bilibili.com/x/v2/reply/reply?type=${data
|
|
490
|
+
getCommentReplies(data) {
|
|
491
|
+
return `https://api.bilibili.com/x/v2/reply/reply?type=${data.type}&oid=${data.oid}&root=${data.root}&ps=${data.number}`;
|
|
483
492
|
}
|
|
484
493
|
/** 获取表情列表 */
|
|
485
494
|
getEmojiList() {
|
|
486
495
|
return "https://api.bilibili.com/x/emote/user/panel/web?business=reply&web_location=0.0";
|
|
487
496
|
}
|
|
488
497
|
/** 获取番剧明细 */
|
|
489
|
-
getBangumiInfo(data
|
|
490
|
-
if (data
|
|
491
|
-
else if (data
|
|
498
|
+
getBangumiInfo(data) {
|
|
499
|
+
if (data.ep_id) return `https://api.bilibili.com/pgc/view/web/season?ep_id=${data.ep_id}`;
|
|
500
|
+
else if (data.season_id) return `https://api.bilibili.com/pgc/view/web/season?season_id=${data.season_id}`;
|
|
492
501
|
else throw new Error("Missing required parameter: ep_id or season_id");
|
|
493
502
|
}
|
|
494
503
|
/** 获取番剧视频流信息 */
|
|
495
|
-
getBangumiStream(data
|
|
496
|
-
return `https://api.bilibili.com/pgc/player/web/playurl?cid=${data
|
|
504
|
+
getBangumiStream(data) {
|
|
505
|
+
return `https://api.bilibili.com/pgc/player/web/playurl?cid=${data.cid}&ep_id=${data.ep_id}`;
|
|
497
506
|
}
|
|
498
507
|
/** 获取用户空间动态 */
|
|
499
|
-
getUserDynamicList(data
|
|
508
|
+
getUserDynamicList(data) {
|
|
500
509
|
return `https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/space?${new URLSearchParams({
|
|
501
|
-
host_mid: data
|
|
510
|
+
host_mid: data.host_mid.toString(),
|
|
502
511
|
offset: "",
|
|
503
512
|
platform: "web",
|
|
504
513
|
features: "itemOpusStyle,listOnlyfans,opusBigCover,onlyfansVote,forwardListHidden,decorationCard,commentsNewVersion,onlyfansAssetsV2,ugcDelete,onlyfansQaCard,avatarAutoTheme,sunflowerStyle,eva3CardOpus,eva3CardVideo,eva3CardComment"
|
|
505
514
|
}).toString()}`;
|
|
506
515
|
}
|
|
507
516
|
/** 获取动态详情 */
|
|
508
|
-
getDynamicDetail(data
|
|
509
|
-
return `https://api.bilibili.com/x/polymer/web-dynamic/v1/detail?id=${data
|
|
517
|
+
getDynamicDetail(data) {
|
|
518
|
+
return `https://api.bilibili.com/x/polymer/web-dynamic/v1/detail?id=${data.dynamic_id}&features=itemOpusStyle,opusBigCover,onlyfansVote,endFooterHidden,decorationCard,onlyfansAssetsV2,ugcDelete,onlyfansQaCard,editable,opusPrivateVisible,avatarAutoTheme`;
|
|
510
519
|
}
|
|
511
|
-
/**
|
|
512
|
-
|
|
513
|
-
|
|
520
|
+
/**
|
|
521
|
+
* 获取动态卡片信息
|
|
522
|
+
*
|
|
523
|
+
* @deprecated B站官方已于 `2025-08-09` 删除原 `dynamic_svr` 接口,该接口已停用。
|
|
524
|
+
* 调用将返回错误信息,请使用 {@link getDynamicDetail} 替代。
|
|
525
|
+
*/
|
|
526
|
+
getDynamicCard(data) {
|
|
527
|
+
return this.getDynamicDetail(data);
|
|
514
528
|
}
|
|
515
529
|
/** 获取用户名片信息 */
|
|
516
|
-
getUserCard(data
|
|
517
|
-
return `https://api.bilibili.com/x/web-interface/card?mid=${data
|
|
530
|
+
getUserCard(data) {
|
|
531
|
+
return `https://api.bilibili.com/x/web-interface/card?mid=${data.host_mid}&photo=true`;
|
|
518
532
|
}
|
|
519
533
|
/** 获取直播间信息 */
|
|
520
|
-
getLiveRoomInfo(data
|
|
521
|
-
return `https://api.live.bilibili.com/room/v1/Room/get_info?room_id=${data
|
|
534
|
+
getLiveRoomInfo(data) {
|
|
535
|
+
return `https://api.live.bilibili.com/room/v1/Room/get_info?room_id=${data.room_id}`;
|
|
522
536
|
}
|
|
523
537
|
/** 获取直播间初始化信息 */
|
|
524
|
-
getLiveRoomInit(data
|
|
525
|
-
return `https://api.live.bilibili.com/room/v1/Room/room_init?id=${data
|
|
538
|
+
getLiveRoomInit(data) {
|
|
539
|
+
return `https://api.live.bilibili.com/room/v1/Room/room_init?id=${data.room_id}`;
|
|
526
540
|
}
|
|
527
541
|
/** 申请登录二维码 */
|
|
528
542
|
getLoginQrcode() {
|
|
529
543
|
return "https://passport.bilibili.com/x/passport-login/web/qrcode/generate";
|
|
530
544
|
}
|
|
531
545
|
/** 查询二维码状态 */
|
|
532
|
-
getQrcodeStatus(data
|
|
533
|
-
return `https://passport.bilibili.com/x/passport-login/web/qrcode/poll?qrcode_key=${data
|
|
546
|
+
getQrcodeStatus(data) {
|
|
547
|
+
return `https://passport.bilibili.com/x/passport-login/web/qrcode/poll?qrcode_key=${data.qrcode_key}`;
|
|
534
548
|
}
|
|
535
549
|
/** 获取UP主总播放量 */
|
|
536
|
-
getUploaderTotalViews(data
|
|
537
|
-
return `https://api.bilibili.com/x/space/upstat?mid=${data
|
|
550
|
+
getUploaderTotalViews(data) {
|
|
551
|
+
return `https://api.bilibili.com/x/space/upstat?mid=${data.host_mid}`;
|
|
538
552
|
}
|
|
539
553
|
/** 获取专栏正文内容 */
|
|
540
|
-
getArticleContent(data
|
|
541
|
-
return `https://api.bilibili.com/x/article/view?id=${data
|
|
554
|
+
getArticleContent(data) {
|
|
555
|
+
return `https://api.bilibili.com/x/article/view?id=${data.id}`;
|
|
542
556
|
}
|
|
543
557
|
/** 获取专栏显示卡片信息 */
|
|
544
|
-
getArticleCards(data
|
|
545
|
-
return `https://api.bilibili.com/x/article/cards?ids=${Array.isArray(data
|
|
558
|
+
getArticleCards(data) {
|
|
559
|
+
return `https://api.bilibili.com/x/article/cards?ids=${Array.isArray(data.ids) ? data.ids.join(",") : data.ids}`;
|
|
546
560
|
}
|
|
547
561
|
/** 获取专栏文章基本信息 */
|
|
548
|
-
getArticleInfo(data
|
|
549
|
-
return `https://api.bilibili.com/x/article/viewinfo?id=${data
|
|
562
|
+
getArticleInfo(data) {
|
|
563
|
+
return `https://api.bilibili.com/x/article/viewinfo?id=${data.id}`;
|
|
550
564
|
}
|
|
551
565
|
/** 获取文集基本信息 */
|
|
552
|
-
getArticleListInfo(data
|
|
553
|
-
return `https://api.bilibili.com/x/article/list/web/articles?id=${data
|
|
566
|
+
getArticleListInfo(data) {
|
|
567
|
+
return `https://api.bilibili.com/x/article/list/web/articles?id=${data.id}`;
|
|
554
568
|
}
|
|
555
569
|
/** 获取用户空间详细信息 */
|
|
556
|
-
getUserSpaceInfo(data
|
|
557
|
-
return `https://api.bilibili.com/x/space/wbi/acc/info?mid=${data
|
|
570
|
+
getUserSpaceInfo(data) {
|
|
571
|
+
return `https://api.bilibili.com/x/space/wbi/acc/info?mid=${data.host_mid}`;
|
|
558
572
|
}
|
|
559
573
|
/** 从 v_voucher 申请验证码 */
|
|
560
|
-
getCaptchaFromVoucher(data
|
|
574
|
+
getCaptchaFromVoucher(data) {
|
|
561
575
|
return {
|
|
562
576
|
Url: "https://api.bilibili.com/x/gaia-vgate/v1/register",
|
|
563
577
|
Body: {
|
|
564
|
-
...data
|
|
565
|
-
v_voucher: data
|
|
578
|
+
...data.csrf !== void 0 && { csrf: data.csrf },
|
|
579
|
+
v_voucher: data.v_voucher
|
|
566
580
|
}
|
|
567
581
|
};
|
|
568
582
|
}
|
|
569
583
|
/** 验证验证码结果 */
|
|
570
|
-
validateCaptcha(data
|
|
584
|
+
validateCaptcha(data) {
|
|
571
585
|
return {
|
|
572
586
|
Url: "https://api.bilibili.com/x/gaia-vgate/v1/validate",
|
|
573
587
|
Body: {
|
|
574
|
-
challenge: data
|
|
575
|
-
token: data
|
|
576
|
-
validate: data
|
|
577
|
-
seccode: data
|
|
578
|
-
...data
|
|
588
|
+
challenge: data.challenge,
|
|
589
|
+
token: data.token,
|
|
590
|
+
validate: data.validate,
|
|
591
|
+
seccode: data.seccode,
|
|
592
|
+
...data.csrf !== void 0 && { csrf: data.csrf }
|
|
579
593
|
}
|
|
580
594
|
};
|
|
581
595
|
}
|
|
@@ -583,17 +597,16 @@ var BilibiliAPI = class {
|
|
|
583
597
|
* 获取实时弹幕(web端 protobuf 接口)
|
|
584
598
|
* @see https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/danmaku/danmaku_proto.md
|
|
585
599
|
*/
|
|
586
|
-
getVideoDanmaku(data
|
|
600
|
+
getVideoDanmaku(data) {
|
|
587
601
|
return `https://api.bilibili.com/x/v2/dm/web/seg.so?${new URLSearchParams({
|
|
588
602
|
type: "1",
|
|
589
|
-
oid: data
|
|
590
|
-
segment_index: (data
|
|
603
|
+
oid: data.cid.toString(),
|
|
604
|
+
segment_index: (data.segment_index ?? 1).toString()
|
|
591
605
|
}).toString()}`;
|
|
592
606
|
}
|
|
593
607
|
};
|
|
594
608
|
/** B站 API URL 构建器实例 */
|
|
595
609
|
const bilibiliApiUrls = new BilibiliAPI();
|
|
596
|
-
|
|
597
610
|
//#endregion
|
|
598
611
|
//#region src/platform/bilibili/BilibiliApi.ts
|
|
599
612
|
/**
|
|
@@ -611,32 +624,59 @@ const createDeprecatedStub$3 = (methodName) => {
|
|
|
611
624
|
* @deprecated v6 已废弃,请使用 bilibiliFetcher 或 client.bilibili.fetcher 替代
|
|
612
625
|
*/
|
|
613
626
|
const bilibili = {
|
|
627
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchVideoInfo 替代 */
|
|
614
628
|
getVideoInfo: createDeprecatedStub$3("getVideoInfo"),
|
|
629
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchVideoStreamUrl 替代 */
|
|
615
630
|
getVideoStream: createDeprecatedStub$3("getVideoStream"),
|
|
631
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchComments 替代 */
|
|
616
632
|
getComments: createDeprecatedStub$3("getComments"),
|
|
633
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchCommentReplies 替代 */
|
|
617
634
|
getCommentReply: createDeprecatedStub$3("getCommentReply"),
|
|
635
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchUserCard 替代 */
|
|
618
636
|
getUserProfile: createDeprecatedStub$3("getUserProfile"),
|
|
637
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchUserDynamicList 替代 */
|
|
619
638
|
getUserDynamic: createDeprecatedStub$3("getUserDynamic"),
|
|
639
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchEmojiList 替代 */
|
|
620
640
|
getEmojiList: createDeprecatedStub$3("getEmojiList"),
|
|
641
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchBangumiInfo 替代 */
|
|
621
642
|
getBangumiInfo: createDeprecatedStub$3("getBangumiInfo"),
|
|
643
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchBangumiStreamUrl 替代 */
|
|
622
644
|
getBangumiStream: createDeprecatedStub$3("getBangumiStream"),
|
|
645
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchDynamicDetail 替代 */
|
|
623
646
|
getDynamicInfo: createDeprecatedStub$3("getDynamicInfo"),
|
|
647
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchDynamicCard 替代 */
|
|
624
648
|
getDynamicCard: createDeprecatedStub$3("getDynamicCard"),
|
|
649
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchLiveRoomInfo 替代 */
|
|
625
650
|
getLiveRoomDetail: createDeprecatedStub$3("getLiveRoomDetail"),
|
|
651
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchLiveRoomInitInfo 替代 */
|
|
626
652
|
getLiveRoomInitInfo: createDeprecatedStub$3("getLiveRoomInitInfo"),
|
|
653
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchLoginStatus 替代 */
|
|
627
654
|
getLoginBasicInfo: createDeprecatedStub$3("getLoginBasicInfo"),
|
|
655
|
+
/** @deprecated 请使用 bilibiliFetcher.requestLoginQrcode 替代 */
|
|
628
656
|
getLoginQrcode: createDeprecatedStub$3("getLoginQrcode"),
|
|
657
|
+
/** @deprecated 请使用 bilibiliFetcher.checkQrcodeStatus 替代 */
|
|
629
658
|
checkQrcodeStatus: createDeprecatedStub$3("checkQrcodeStatus"),
|
|
659
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchUploaderTotalViews 替代 */
|
|
630
660
|
getUserTotalPlayCount: createDeprecatedStub$3("getUserTotalPlayCount"),
|
|
661
|
+
/** @deprecated 请使用 bilibiliFetcher.convertAvToBv 替代 */
|
|
631
662
|
convertAvToBv: createDeprecatedStub$3("convertAvToBv"),
|
|
663
|
+
/** @deprecated 请使用 bilibiliFetcher.convertBvToAv 替代 */
|
|
632
664
|
convertBvToAv: createDeprecatedStub$3("convertBvToAv"),
|
|
665
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchArticleContent 替代 */
|
|
633
666
|
getArticleContent: createDeprecatedStub$3("getArticleContent"),
|
|
667
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchArticleCards 替代 */
|
|
634
668
|
getArticleCard: createDeprecatedStub$3("getArticleCard"),
|
|
669
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchArticleInfo 替代 */
|
|
635
670
|
getArticleInfo: createDeprecatedStub$3("getArticleInfo"),
|
|
671
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchArticleListInfo 替代 */
|
|
636
672
|
getColumnInfo: createDeprecatedStub$3("getColumnInfo"),
|
|
673
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchUserSpaceInfo 替代 */
|
|
637
674
|
getUserProfileDetail: createDeprecatedStub$3("getUserProfileDetail"),
|
|
675
|
+
/** @deprecated 请使用 bilibiliFetcher.requestCaptchaFromVoucher 替代 */
|
|
638
676
|
applyVoucherCaptcha: createDeprecatedStub$3("applyVoucherCaptcha"),
|
|
677
|
+
/** @deprecated 请使用 bilibiliFetcher.validateCaptchaResult 替代 */
|
|
639
678
|
validateCaptcha: createDeprecatedStub$3("validateCaptcha"),
|
|
679
|
+
/** @deprecated 请使用 bilibiliFetcher.fetchVideoDanmaku 替代 */
|
|
640
680
|
getDanmaku: createDeprecatedStub$3("getDanmaku")
|
|
641
681
|
};
|
|
642
682
|
/**
|
|
@@ -647,7 +687,6 @@ const bilibili = {
|
|
|
647
687
|
const createBoundBilibiliApi = (_cookie, _requestConfig) => {
|
|
648
688
|
return { ...bilibili };
|
|
649
689
|
};
|
|
650
|
-
|
|
651
690
|
//#endregion
|
|
652
691
|
//#region src/model/events.ts
|
|
653
692
|
/**
|
|
@@ -666,8 +705,8 @@ var TypedEventEmitter = class extends EventEmitter {
|
|
|
666
705
|
* @param data - 事件数据
|
|
667
706
|
* @returns 是否有监听器处理了该事件
|
|
668
707
|
*/
|
|
669
|
-
emit(event, data
|
|
670
|
-
return super.emit(event, data
|
|
708
|
+
emit(event, data) {
|
|
709
|
+
return super.emit(event, data);
|
|
671
710
|
}
|
|
672
711
|
/**
|
|
673
712
|
* 注册事件监听器
|
|
@@ -729,9 +768,9 @@ const emitLog = (level, message, ...args) => {
|
|
|
729
768
|
* 发射 HTTP 请求事件
|
|
730
769
|
* @param data - 请求数据 (不含 timestamp)
|
|
731
770
|
*/
|
|
732
|
-
const emitHttpRequest = (data
|
|
771
|
+
const emitHttpRequest = (data) => {
|
|
733
772
|
amagiEvents.emit("http:request", {
|
|
734
|
-
...data
|
|
773
|
+
...data,
|
|
735
774
|
timestamp: /* @__PURE__ */ new Date()
|
|
736
775
|
});
|
|
737
776
|
};
|
|
@@ -739,9 +778,9 @@ const emitHttpRequest = (data$1) => {
|
|
|
739
778
|
* 发射 HTTP 响应事件
|
|
740
779
|
* @param data - 响应数据 (不含 timestamp)
|
|
741
780
|
*/
|
|
742
|
-
const emitHttpResponse = (data
|
|
781
|
+
const emitHttpResponse = (data) => {
|
|
743
782
|
amagiEvents.emit("http:response", {
|
|
744
|
-
...data
|
|
783
|
+
...data,
|
|
745
784
|
timestamp: /* @__PURE__ */ new Date()
|
|
746
785
|
});
|
|
747
786
|
};
|
|
@@ -749,9 +788,9 @@ const emitHttpResponse = (data$1) => {
|
|
|
749
788
|
* 发射网络重试事件
|
|
750
789
|
* @param data - 重试数据 (不含 timestamp)
|
|
751
790
|
*/
|
|
752
|
-
const emitNetworkRetry = (data
|
|
791
|
+
const emitNetworkRetry = (data) => {
|
|
753
792
|
amagiEvents.emit("network:retry", {
|
|
754
|
-
...data
|
|
793
|
+
...data,
|
|
755
794
|
timestamp: /* @__PURE__ */ new Date()
|
|
756
795
|
});
|
|
757
796
|
};
|
|
@@ -759,9 +798,9 @@ const emitNetworkRetry = (data$1) => {
|
|
|
759
798
|
* 发射网络错误事件
|
|
760
799
|
* @param data - 错误数据 (不含 timestamp)
|
|
761
800
|
*/
|
|
762
|
-
const emitNetworkError = (data
|
|
801
|
+
const emitNetworkError = (data) => {
|
|
763
802
|
amagiEvents.emit("network:error", {
|
|
764
|
-
...data
|
|
803
|
+
...data,
|
|
765
804
|
timestamp: /* @__PURE__ */ new Date()
|
|
766
805
|
});
|
|
767
806
|
};
|
|
@@ -769,9 +808,9 @@ const emitNetworkError = (data$1) => {
|
|
|
769
808
|
* 发射 API 成功事件
|
|
770
809
|
* @param data - 成功数据 (不含 timestamp)
|
|
771
810
|
*/
|
|
772
|
-
const emitApiSuccess = (data
|
|
811
|
+
const emitApiSuccess = (data) => {
|
|
773
812
|
amagiEvents.emit("api:success", {
|
|
774
|
-
...data
|
|
813
|
+
...data,
|
|
775
814
|
timestamp: /* @__PURE__ */ new Date()
|
|
776
815
|
});
|
|
777
816
|
};
|
|
@@ -779,9 +818,9 @@ const emitApiSuccess = (data$1) => {
|
|
|
779
818
|
* 发射 API 错误事件
|
|
780
819
|
* @param data - 错误数据 (不含 timestamp)
|
|
781
820
|
*/
|
|
782
|
-
const emitApiError = (data
|
|
821
|
+
const emitApiError = (data) => {
|
|
783
822
|
amagiEvents.emit("api:error", {
|
|
784
|
-
...data
|
|
823
|
+
...data,
|
|
785
824
|
timestamp: /* @__PURE__ */ new Date()
|
|
786
825
|
});
|
|
787
826
|
};
|
|
@@ -825,7 +864,6 @@ const emitLogDebug = (message, ...args) => {
|
|
|
825
864
|
const emitLogMark = (message, ...args) => {
|
|
826
865
|
emitLog("mark", message, ...args);
|
|
827
866
|
};
|
|
828
|
-
|
|
829
867
|
//#endregion
|
|
830
868
|
//#region src/validation/utils.ts
|
|
831
869
|
function smartNumber(errorMessage, minValue = 1, isInteger = false) {
|
|
@@ -856,7 +894,6 @@ const extractCreatorInfoFromHtml = (html) => {
|
|
|
856
894
|
return null;
|
|
857
895
|
}
|
|
858
896
|
};
|
|
859
|
-
|
|
860
897
|
//#endregion
|
|
861
898
|
//#region src/validation/bilibili.ts
|
|
862
899
|
/** 视频信息参数验证 */
|
|
@@ -950,7 +987,7 @@ const BilibiliBangumiInfoParamsSchema = zod.object({
|
|
|
950
987
|
methodType: zod.literal("bangumiInfo", { error: "方法类型必须是\"bangumiInfo\"" }),
|
|
951
988
|
ep_id: zod.string({ error: "番剧EP ID必须是字符串" }).min(1, { error: "番剧EP ID不能为空" }).optional(),
|
|
952
989
|
season_id: zod.string({ error: "番剧季度ID必须是字符串" }).optional()
|
|
953
|
-
}).refine((data
|
|
990
|
+
}).refine((data) => data.ep_id ?? data.season_id, {
|
|
954
991
|
error: "ep_id 和 season_id 至少需要提供一个",
|
|
955
992
|
path: ["ep_id"]
|
|
956
993
|
});
|
|
@@ -1090,7 +1127,6 @@ const BilibiliMethodRoutes = {
|
|
|
1090
1127
|
validateCaptcha: "/validate_captcha",
|
|
1091
1128
|
videoDanmaku: "/fetch_danmaku"
|
|
1092
1129
|
};
|
|
1093
|
-
|
|
1094
1130
|
//#endregion
|
|
1095
1131
|
//#region src/validation/douyin.ts
|
|
1096
1132
|
/** 作品参数验证 */
|
|
@@ -1179,14 +1215,14 @@ const DouyinDanmakuParamsSchema = zod.object({
|
|
|
1179
1215
|
start_time: zod.coerce.number({ error: "开始时间必须是数字" }).int({ error: "开始时间必须是整数" }).min(0, { error: "开始时间不能小于0" }).optional(),
|
|
1180
1216
|
end_time: zod.coerce.number({ error: "结束时间必须是数字" }).int({ error: "结束时间必须是整数" }).min(0, { error: "结束时间不能小于0" }).optional(),
|
|
1181
1217
|
duration: zod.coerce.number({ error: "视频时长必须是数字" }).int({ error: "视频时长必须是整数" }).min(0, { error: "视频时长不能小于0" })
|
|
1182
|
-
}).refine((data
|
|
1183
|
-
if (data
|
|
1218
|
+
}).refine((data) => {
|
|
1219
|
+
if (data.end_time !== void 0) return data.end_time <= data.duration;
|
|
1184
1220
|
return true;
|
|
1185
1221
|
}, {
|
|
1186
1222
|
error: "获取弹幕区间的结束时间不能超过视频总时长",
|
|
1187
1223
|
path: ["end_time"]
|
|
1188
|
-
}).refine((data
|
|
1189
|
-
if (data
|
|
1224
|
+
}).refine((data) => {
|
|
1225
|
+
if (data.start_time !== void 0 && data.end_time !== void 0) return data.start_time < data.end_time;
|
|
1190
1226
|
return true;
|
|
1191
1227
|
}, {
|
|
1192
1228
|
error: "获取弹幕区间的开始时间必须小于结束时间",
|
|
@@ -1236,7 +1272,6 @@ const DouyinMethodRoutes = {
|
|
|
1236
1272
|
danmakuList: "/fetch_work_danmaku",
|
|
1237
1273
|
loginQrcode: "/fetch_login_qrcode"
|
|
1238
1274
|
};
|
|
1239
|
-
|
|
1240
1275
|
//#endregion
|
|
1241
1276
|
//#region src/validation/kuaishou.ts
|
|
1242
1277
|
/**
|
|
@@ -1302,7 +1337,6 @@ const KuaishouMethodRoutes = {
|
|
|
1302
1337
|
liveRoomInfo: "/fetch_live_room_info",
|
|
1303
1338
|
emojiList: "/fetch_emoji_list"
|
|
1304
1339
|
};
|
|
1305
|
-
|
|
1306
1340
|
//#endregion
|
|
1307
1341
|
//#region src/platform/xiaohongshu/sign/index.ts
|
|
1308
1342
|
/**
|
|
@@ -1369,44 +1403,43 @@ var xiaohongshuSign = class {
|
|
|
1369
1403
|
*/
|
|
1370
1404
|
static getSearchId = () => (BigInt(Date.now()) << 64n) + BigInt(Math.floor(Math.random() * 2147483646)).toString(36);
|
|
1371
1405
|
};
|
|
1372
|
-
|
|
1373
1406
|
//#endregion
|
|
1374
1407
|
//#region src/platform/xiaohongshu/API.ts
|
|
1375
1408
|
/**
|
|
1376
1409
|
* 搜索排序类型枚举
|
|
1377
1410
|
*/
|
|
1378
|
-
let SearchSortType = /* @__PURE__ */ function(SearchSortType
|
|
1411
|
+
let SearchSortType = /* @__PURE__ */ function(SearchSortType) {
|
|
1379
1412
|
/**
|
|
1380
1413
|
* 默认排序
|
|
1381
1414
|
*/
|
|
1382
|
-
SearchSortType
|
|
1415
|
+
SearchSortType["GENERAL"] = "general";
|
|
1383
1416
|
/**
|
|
1384
1417
|
* 最受欢迎(按热度降序)
|
|
1385
1418
|
*/
|
|
1386
|
-
SearchSortType
|
|
1419
|
+
SearchSortType["MOST_POPULAR"] = "popularity_descending";
|
|
1387
1420
|
/**
|
|
1388
1421
|
* 最新发布(按时间降序)
|
|
1389
1422
|
*/
|
|
1390
|
-
SearchSortType
|
|
1391
|
-
return SearchSortType
|
|
1423
|
+
SearchSortType["LATEST"] = "time_descending";
|
|
1424
|
+
return SearchSortType;
|
|
1392
1425
|
}({});
|
|
1393
1426
|
/**
|
|
1394
1427
|
* 搜索笔记类型枚举
|
|
1395
1428
|
*/
|
|
1396
|
-
let SearchNoteType = /* @__PURE__ */ function(SearchNoteType
|
|
1429
|
+
let SearchNoteType = /* @__PURE__ */ function(SearchNoteType) {
|
|
1397
1430
|
/**
|
|
1398
1431
|
* 默认(全部类型)
|
|
1399
1432
|
*/
|
|
1400
|
-
SearchNoteType
|
|
1433
|
+
SearchNoteType[SearchNoteType["ALL"] = 0] = "ALL";
|
|
1401
1434
|
/**
|
|
1402
1435
|
* 仅视频
|
|
1403
1436
|
*/
|
|
1404
|
-
SearchNoteType
|
|
1437
|
+
SearchNoteType[SearchNoteType["VIDEO"] = 1] = "VIDEO";
|
|
1405
1438
|
/**
|
|
1406
1439
|
* 仅图片
|
|
1407
1440
|
*/
|
|
1408
|
-
SearchNoteType
|
|
1409
|
-
return SearchNoteType
|
|
1441
|
+
SearchNoteType[SearchNoteType["IMAGE"] = 2] = "IMAGE";
|
|
1442
|
+
return SearchNoteType;
|
|
1410
1443
|
}({});
|
|
1411
1444
|
/**
|
|
1412
1445
|
* 构建查询字符串
|
|
@@ -1420,17 +1453,22 @@ const buildQueryString$1 = (params) => {
|
|
|
1420
1453
|
* 小红书API地址配置
|
|
1421
1454
|
*/
|
|
1422
1455
|
const xiaohongshuApiUrls = {
|
|
1423
|
-
|
|
1456
|
+
/**
|
|
1457
|
+
* 获取首页推荐数据的接口地址
|
|
1458
|
+
* @param data - 请求参数
|
|
1459
|
+
* @returns 完整的接口URL
|
|
1460
|
+
*/
|
|
1461
|
+
homeFeed(data = {}) {
|
|
1424
1462
|
return {
|
|
1425
1463
|
apiPath: "/api/sns/web/v1/homefeed",
|
|
1426
1464
|
Url: "https://edith.xiaohongshu.com/api/sns/web/v1/homefeed",
|
|
1427
1465
|
Body: {
|
|
1428
|
-
cursor_score: data
|
|
1429
|
-
num: data
|
|
1430
|
-
refresh_type: data
|
|
1431
|
-
note_index: data
|
|
1432
|
-
category: data
|
|
1433
|
-
search_key: data
|
|
1466
|
+
cursor_score: data.cursor_score ?? "1.7599348899670024E9",
|
|
1467
|
+
num: data.num ?? 33,
|
|
1468
|
+
refresh_type: data.refresh_type ?? 3,
|
|
1469
|
+
note_index: data.note_index ?? 33,
|
|
1470
|
+
category: data.category ?? "homefeed_recommend",
|
|
1471
|
+
search_key: data.search_key ?? "",
|
|
1434
1472
|
image_formats: [
|
|
1435
1473
|
"jpg",
|
|
1436
1474
|
"webp",
|
|
@@ -1439,12 +1477,17 @@ const xiaohongshuApiUrls = {
|
|
|
1439
1477
|
}
|
|
1440
1478
|
};
|
|
1441
1479
|
},
|
|
1442
|
-
|
|
1480
|
+
/**
|
|
1481
|
+
* 获取单个笔记数据的接口地址
|
|
1482
|
+
* @param data - 请求参数
|
|
1483
|
+
* @returns 完整的接口URL
|
|
1484
|
+
*/
|
|
1485
|
+
noteDetail(data) {
|
|
1443
1486
|
return {
|
|
1444
1487
|
apiPath: "/api/sns/web/v1/feed",
|
|
1445
1488
|
Url: "https://edith.xiaohongshu.com/api/sns/web/v1/feed",
|
|
1446
1489
|
Body: {
|
|
1447
|
-
source_note_id: data
|
|
1490
|
+
source_note_id: data.note_id,
|
|
1448
1491
|
image_formats: [
|
|
1449
1492
|
"jpg",
|
|
1450
1493
|
"webp",
|
|
@@ -1452,38 +1495,53 @@ const xiaohongshuApiUrls = {
|
|
|
1452
1495
|
],
|
|
1453
1496
|
extra: { need_body_topic: "1" },
|
|
1454
1497
|
xsec_source: "pc_feed",
|
|
1455
|
-
xsec_token: data
|
|
1498
|
+
xsec_token: data.xsec_token
|
|
1456
1499
|
}
|
|
1457
1500
|
};
|
|
1458
1501
|
},
|
|
1459
|
-
|
|
1502
|
+
/**
|
|
1503
|
+
* 获取评论数据的接口地址
|
|
1504
|
+
* @param data - 请求参数
|
|
1505
|
+
* @returns 完整的接口URL
|
|
1506
|
+
*/
|
|
1507
|
+
noteComments(data) {
|
|
1460
1508
|
return {
|
|
1461
1509
|
apiPath: "/api/sns/web/v2/comment/page",
|
|
1462
1510
|
Url: `https://edith.xiaohongshu.com/api/sns/web/v2/comment/page?${buildQueryString$1({
|
|
1463
|
-
note_id: data
|
|
1464
|
-
cursor: data
|
|
1511
|
+
note_id: data.note_id,
|
|
1512
|
+
cursor: data.cursor ?? "",
|
|
1465
1513
|
image_formats: [
|
|
1466
1514
|
"jpg",
|
|
1467
1515
|
"webp",
|
|
1468
1516
|
"avif"
|
|
1469
1517
|
].join(","),
|
|
1470
|
-
xsec_token: data
|
|
1518
|
+
xsec_token: data.xsec_token
|
|
1471
1519
|
})}`
|
|
1472
1520
|
};
|
|
1473
1521
|
},
|
|
1474
|
-
|
|
1522
|
+
/**
|
|
1523
|
+
* 获取用户数据的接口地址
|
|
1524
|
+
* @param data - 请求参数
|
|
1525
|
+
* @returns 完整的接口URL
|
|
1526
|
+
*/
|
|
1527
|
+
userProfile(data) {
|
|
1475
1528
|
return {
|
|
1476
1529
|
apiPath: "/api/sns/web/v1/user/otherinfo",
|
|
1477
|
-
Url: `https://www.xiaohongshu.com/user/profile/${data
|
|
1530
|
+
Url: `https://www.xiaohongshu.com/user/profile/${data.user_id}`
|
|
1478
1531
|
};
|
|
1479
1532
|
},
|
|
1480
|
-
|
|
1533
|
+
/**
|
|
1534
|
+
* 获取用户笔记数据的接口地址
|
|
1535
|
+
* @param data - 请求参数
|
|
1536
|
+
* @returns 完整的接口URL
|
|
1537
|
+
*/
|
|
1538
|
+
userNoteList(data) {
|
|
1481
1539
|
return {
|
|
1482
1540
|
apiPath: "/api/sns/web/v1/user_posted",
|
|
1483
1541
|
Url: `https://edith.xiaohongshu.com/api/sns/web/v1/user_posted?${buildQueryString$1({
|
|
1484
|
-
user_id: data
|
|
1485
|
-
cursor: data
|
|
1486
|
-
num: data
|
|
1542
|
+
user_id: data.user_id,
|
|
1543
|
+
cursor: data.cursor ?? "",
|
|
1544
|
+
num: data.num ?? 30,
|
|
1487
1545
|
image_formats: [
|
|
1488
1546
|
"jpg",
|
|
1489
1547
|
"webp",
|
|
@@ -1493,21 +1551,31 @@ const xiaohongshuApiUrls = {
|
|
|
1493
1551
|
})}`
|
|
1494
1552
|
};
|
|
1495
1553
|
},
|
|
1496
|
-
|
|
1554
|
+
/**
|
|
1555
|
+
* 获取笔记表情列表的接口地址
|
|
1556
|
+
* @param data - 请求参数
|
|
1557
|
+
* @returns 完整的接口URL
|
|
1558
|
+
*/
|
|
1559
|
+
emojiList(data) {
|
|
1497
1560
|
return {
|
|
1498
1561
|
apiPath: "/api/im/redmoji/detail",
|
|
1499
1562
|
Url: "https://edith.xiaohongshu.com/api/im/redmoji/detail"
|
|
1500
1563
|
};
|
|
1501
1564
|
},
|
|
1502
|
-
|
|
1565
|
+
/**
|
|
1566
|
+
* 搜索笔记的接口地址
|
|
1567
|
+
* @param data - 请求参数
|
|
1568
|
+
* @returns 完整的接口URL
|
|
1569
|
+
*/
|
|
1570
|
+
searchNotes(data) {
|
|
1503
1571
|
return {
|
|
1504
1572
|
apiPath: "/api/sns/web/v1/search/notes",
|
|
1505
1573
|
Body: {
|
|
1506
|
-
keyword: data
|
|
1507
|
-
page: data
|
|
1508
|
-
page_size: data
|
|
1509
|
-
sort:
|
|
1510
|
-
note_type:
|
|
1574
|
+
keyword: data.keyword,
|
|
1575
|
+
page: data.page ?? 1,
|
|
1576
|
+
page_size: data.page_size ?? 20,
|
|
1577
|
+
sort: "general",
|
|
1578
|
+
note_type: 0,
|
|
1511
1579
|
search_id: xiaohongshuSign.getSearchId(),
|
|
1512
1580
|
image_formats: [
|
|
1513
1581
|
"jpg",
|
|
@@ -1526,82 +1594,53 @@ const xiaohongshuApiUrls = {
|
|
|
1526
1594
|
const createXiaohongshuApiUrls = () => {
|
|
1527
1595
|
return xiaohongshuApiUrls;
|
|
1528
1596
|
};
|
|
1529
|
-
|
|
1530
1597
|
//#endregion
|
|
1531
1598
|
//#region src/validation/xiaohongshu.ts
|
|
1532
1599
|
const SearchSortTypeValues = Object.values(SearchSortType).filter((v) => typeof v === "string");
|
|
1533
1600
|
const SearchNoteTypeValues = Object.values(SearchNoteType).filter((v) => typeof v === "number");
|
|
1534
1601
|
/**
|
|
1535
|
-
* 小红书首页推荐数据参数验证模式
|
|
1536
|
-
*/
|
|
1537
|
-
const HomeFeedParamsSchema = zod.object({
|
|
1538
|
-
methodType: zod.literal("homeFeed", { error: "methodType must be \"homeFeed\"" }),
|
|
1539
|
-
cursor_score: zod.string({ error: "cursor_score must be a string" }).optional(),
|
|
1540
|
-
num: zod.coerce.number({ error: "num must be a number" }).int({ error: "num must be an integer" }).min(1, { error: "num cannot be less than 1" }).max(100, { error: "num cannot be greater than 100" }).optional(),
|
|
1541
|
-
refresh_type: zod.coerce.number({ error: "refresh_type must be a number" }).int({ error: "refresh_type must be an integer" }).optional(),
|
|
1542
|
-
note_index: zod.coerce.number({ error: "note_index must be a number" }).int({ error: "note_index must be an integer" }).optional(),
|
|
1543
|
-
category: zod.string({ error: "category must be a string" }).optional(),
|
|
1544
|
-
search_key: zod.string({ error: "search_key must be a string" }).optional()
|
|
1545
|
-
});
|
|
1546
|
-
/**
|
|
1547
|
-
* 小红书单个笔记数据参数验证模式
|
|
1548
|
-
*/
|
|
1549
|
-
const NoteParamsSchema = zod.object({
|
|
1550
|
-
methodType: zod.literal("noteDetail", { error: "methodType must be \"noteDetail\"" }),
|
|
1551
|
-
note_id: zod.string({ error: "note_id must be a string" }),
|
|
1552
|
-
xsec_token: zod.string({ error: "xsec_token must be a string" })
|
|
1553
|
-
});
|
|
1554
|
-
/**
|
|
1555
|
-
* 小红书评论数据参数验证模式
|
|
1556
|
-
*/
|
|
1557
|
-
const CommentParamsSchema = zod.object({
|
|
1558
|
-
methodType: zod.literal("noteComments", { error: "methodType must be \"noteComments\"" }),
|
|
1559
|
-
note_id: zod.string({ error: "note_id must be a string" }),
|
|
1560
|
-
cursor: zod.string({ error: "cursor must be a string" }).optional(),
|
|
1561
|
-
xsec_token: zod.string({ error: "xsec_token must be a string" })
|
|
1562
|
-
});
|
|
1563
|
-
/**
|
|
1564
|
-
* 小红书用户数据参数验证模式
|
|
1565
|
-
*/
|
|
1566
|
-
const UserParamsSchema = zod.object({
|
|
1567
|
-
methodType: zod.literal("userProfile", { error: "methodType must be \"userProfile\"" }),
|
|
1568
|
-
user_id: zod.string({ error: "user_id must be a string" })
|
|
1569
|
-
});
|
|
1570
|
-
/**
|
|
1571
|
-
* 小红书用户笔记数据参数验证模式
|
|
1572
|
-
*/
|
|
1573
|
-
const UserNoteParamsSchema = zod.object({
|
|
1574
|
-
methodType: zod.literal("userNoteList", { error: "methodType must be \"userNoteList\"" }),
|
|
1575
|
-
user_id: zod.string({ error: "user_id must be a string" }),
|
|
1576
|
-
cursor: zod.string({ error: "cursor must be a string" }).optional(),
|
|
1577
|
-
num: zod.coerce.number({ error: "num must be a number" }).int({ error: "num must be an integer" }).min(1, { error: "num cannot be less than 1" }).max(100, { error: "num cannot be greater than 100" }).optional()
|
|
1578
|
-
});
|
|
1579
|
-
/**
|
|
1580
|
-
* 小红书表情列表参数验证模式
|
|
1581
|
-
*/
|
|
1582
|
-
const EmojiListParamsSchema = zod.object({ methodType: zod.literal("emojiList", { error: "methodType must be \"emojiList\"" }) });
|
|
1583
|
-
/**
|
|
1584
|
-
* 小红书搜索笔记参数验证模式
|
|
1585
|
-
*/
|
|
1586
|
-
const SearchNoteParamsSchema = zod.object({
|
|
1587
|
-
methodType: zod.literal("searchNotes", { error: "methodType must be \"searchNotes\"" }),
|
|
1588
|
-
keyword: zod.string({ error: "keyword must be a string" }),
|
|
1589
|
-
page: zod.coerce.number({ error: "page must be a number" }).int({ error: "page must be an integer" }).min(1, { error: "page cannot be less than 1" }).optional(),
|
|
1590
|
-
page_size: zod.coerce.number({ error: "page_size must be a number" }).int({ error: "page_size must be an integer" }).min(1, { error: "page_size cannot be less than 1" }).max(100, { error: "page_size cannot be greater than 100" }).optional(),
|
|
1591
|
-
sort: zod.enum(SearchSortTypeValues, { error: "Invalid sort type" }).optional(),
|
|
1592
|
-
note_type: zod.coerce.number({ error: "note_type must be a number" }).int({ error: "note_type must be an integer" }).refine((val) => SearchNoteTypeValues.includes(val), { message: "Invalid note type" }).optional()
|
|
1593
|
-
});
|
|
1594
|
-
/**
|
|
1595
1602
|
* 小红书验证模式映射
|
|
1596
1603
|
*/
|
|
1597
1604
|
const XiaohongshuValidationSchemas = {
|
|
1598
|
-
homeFeed:
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
+
homeFeed: zod.object({
|
|
1606
|
+
methodType: zod.literal("homeFeed", { error: "methodType must be \"homeFeed\"" }),
|
|
1607
|
+
cursor_score: zod.string({ error: "cursor_score must be a string" }).optional(),
|
|
1608
|
+
num: zod.coerce.number({ error: "num must be a number" }).int({ error: "num must be an integer" }).min(1, { error: "num cannot be less than 1" }).max(100, { error: "num cannot be greater than 100" }).optional(),
|
|
1609
|
+
refresh_type: zod.coerce.number({ error: "refresh_type must be a number" }).int({ error: "refresh_type must be an integer" }).optional(),
|
|
1610
|
+
note_index: zod.coerce.number({ error: "note_index must be a number" }).int({ error: "note_index must be an integer" }).optional(),
|
|
1611
|
+
category: zod.string({ error: "category must be a string" }).optional(),
|
|
1612
|
+
search_key: zod.string({ error: "search_key must be a string" }).optional()
|
|
1613
|
+
}),
|
|
1614
|
+
noteDetail: zod.object({
|
|
1615
|
+
methodType: zod.literal("noteDetail", { error: "methodType must be \"noteDetail\"" }),
|
|
1616
|
+
note_id: zod.string({ error: "note_id must be a string" }),
|
|
1617
|
+
xsec_token: zod.string({ error: "xsec_token must be a string" })
|
|
1618
|
+
}),
|
|
1619
|
+
noteComments: zod.object({
|
|
1620
|
+
methodType: zod.literal("noteComments", { error: "methodType must be \"noteComments\"" }),
|
|
1621
|
+
note_id: zod.string({ error: "note_id must be a string" }),
|
|
1622
|
+
cursor: zod.string({ error: "cursor must be a string" }).optional(),
|
|
1623
|
+
xsec_token: zod.string({ error: "xsec_token must be a string" })
|
|
1624
|
+
}),
|
|
1625
|
+
userProfile: zod.object({
|
|
1626
|
+
methodType: zod.literal("userProfile", { error: "methodType must be \"userProfile\"" }),
|
|
1627
|
+
user_id: zod.string({ error: "user_id must be a string" })
|
|
1628
|
+
}),
|
|
1629
|
+
userNoteList: zod.object({
|
|
1630
|
+
methodType: zod.literal("userNoteList", { error: "methodType must be \"userNoteList\"" }),
|
|
1631
|
+
user_id: zod.string({ error: "user_id must be a string" }),
|
|
1632
|
+
cursor: zod.string({ error: "cursor must be a string" }).optional(),
|
|
1633
|
+
num: zod.coerce.number({ error: "num must be a number" }).int({ error: "num must be an integer" }).min(1, { error: "num cannot be less than 1" }).max(100, { error: "num cannot be greater than 100" }).optional()
|
|
1634
|
+
}),
|
|
1635
|
+
emojiList: zod.object({ methodType: zod.literal("emojiList", { error: "methodType must be \"emojiList\"" }) }),
|
|
1636
|
+
searchNotes: zod.object({
|
|
1637
|
+
methodType: zod.literal("searchNotes", { error: "methodType must be \"searchNotes\"" }),
|
|
1638
|
+
keyword: zod.string({ error: "keyword must be a string" }),
|
|
1639
|
+
page: zod.coerce.number({ error: "page must be a number" }).int({ error: "page must be an integer" }).min(1, { error: "page cannot be less than 1" }).optional(),
|
|
1640
|
+
page_size: zod.coerce.number({ error: "page_size must be a number" }).int({ error: "page_size must be an integer" }).min(1, { error: "page_size cannot be less than 1" }).max(100, { error: "page_size cannot be greater than 100" }).optional(),
|
|
1641
|
+
sort: zod.enum(SearchSortTypeValues, { error: "Invalid sort type" }).optional(),
|
|
1642
|
+
note_type: zod.coerce.number({ error: "note_type must be a number" }).int({ error: "note_type must be an integer" }).refine((val) => SearchNoteTypeValues.includes(val), { message: "Invalid note type" }).optional()
|
|
1643
|
+
})
|
|
1605
1644
|
};
|
|
1606
1645
|
/**
|
|
1607
1646
|
* 小红书方法路由映射
|
|
@@ -1615,7 +1654,6 @@ const XiaohongshuMethodRoutes = {
|
|
|
1615
1654
|
emojiList: "/fetch_emoji_list",
|
|
1616
1655
|
searchNotes: "/fetch_search_notes"
|
|
1617
1656
|
};
|
|
1618
|
-
|
|
1619
1657
|
//#endregion
|
|
1620
1658
|
//#region src/validation/index.ts
|
|
1621
1659
|
/**
|
|
@@ -1685,10 +1723,10 @@ const validateXiaohongshuParams = (methodType, params) => {
|
|
|
1685
1723
|
* @param code - 响应状态码(可选,默认200)
|
|
1686
1724
|
* @returns 格式化的成功API响应对象
|
|
1687
1725
|
*/
|
|
1688
|
-
const createSuccessResponse = (data
|
|
1726
|
+
const createSuccessResponse = (data, message, code = 200) => {
|
|
1689
1727
|
return {
|
|
1690
1728
|
success: true,
|
|
1691
|
-
data
|
|
1729
|
+
data,
|
|
1692
1730
|
message,
|
|
1693
1731
|
code,
|
|
1694
1732
|
error: void 0
|
|
@@ -1701,16 +1739,15 @@ const createSuccessResponse = (data$1, message, code = 200) => {
|
|
|
1701
1739
|
* @param code - 错误状态码(可选,默认500)
|
|
1702
1740
|
* @returns 格式化的错误响应对象
|
|
1703
1741
|
*/
|
|
1704
|
-
const createErrorResponse = (error, message, code = 500, data
|
|
1742
|
+
const createErrorResponse = (error, message, code = 500, data) => {
|
|
1705
1743
|
return {
|
|
1706
1744
|
success: false,
|
|
1707
1745
|
error,
|
|
1708
1746
|
message,
|
|
1709
1747
|
code,
|
|
1710
|
-
data
|
|
1748
|
+
data
|
|
1711
1749
|
};
|
|
1712
1750
|
};
|
|
1713
|
-
|
|
1714
1751
|
//#endregion
|
|
1715
1752
|
//#region src/model/fetchers/bilibili/internal.ts
|
|
1716
1753
|
/**
|
|
@@ -1731,15 +1768,20 @@ async function fetchBilibiliInternal(methodType, options, config) {
|
|
|
1731
1768
|
const rawData = await fetchBilibili({ ...validateBilibiliParams(methodType, options) }, config.cookie, config.requestConfig);
|
|
1732
1769
|
const duration = Date.now() - startTime;
|
|
1733
1770
|
if (rawData.code !== 0) {
|
|
1771
|
+
const errorMessage = rawData.message || "B站数据获取失败";
|
|
1734
1772
|
emitApiError({
|
|
1735
1773
|
platform: "bilibili",
|
|
1736
1774
|
methodType,
|
|
1737
1775
|
errorCode: rawData.code,
|
|
1738
|
-
errorMessage
|
|
1776
|
+
errorMessage,
|
|
1739
1777
|
url: void 0,
|
|
1740
1778
|
duration
|
|
1741
1779
|
});
|
|
1742
|
-
return createErrorResponse(rawData.amagiError
|
|
1780
|
+
return createErrorResponse(rawData.amagiError ?? {
|
|
1781
|
+
errorDescription: errorMessage,
|
|
1782
|
+
requestType: methodType,
|
|
1783
|
+
requestUrl: void 0
|
|
1784
|
+
}, errorMessage, rawData.code, rawData);
|
|
1743
1785
|
}
|
|
1744
1786
|
const result = createSuccessResponse(rawData, "获取成功", 200);
|
|
1745
1787
|
emitApiSuccess({
|
|
@@ -1762,7 +1804,6 @@ async function fetchBilibiliInternal(methodType, options, config) {
|
|
|
1762
1804
|
throw new Error(`B站数据获取失败: ${errorMessage}`);
|
|
1763
1805
|
}
|
|
1764
1806
|
}
|
|
1765
|
-
|
|
1766
1807
|
//#endregion
|
|
1767
1808
|
//#region src/model/fetchers/bilibili/article.ts
|
|
1768
1809
|
/**
|
|
@@ -1841,7 +1882,6 @@ async function fetchArticleListInfo(options, cookie, requestConfig) {
|
|
|
1841
1882
|
requestConfig
|
|
1842
1883
|
});
|
|
1843
1884
|
}
|
|
1844
|
-
|
|
1845
1885
|
//#endregion
|
|
1846
1886
|
//#region src/model/fetchers/bilibili/auth.ts
|
|
1847
1887
|
/**
|
|
@@ -1942,7 +1982,6 @@ async function validateCaptchaResult(options, cookie, requestConfig) {
|
|
|
1942
1982
|
requestConfig
|
|
1943
1983
|
});
|
|
1944
1984
|
}
|
|
1945
|
-
|
|
1946
1985
|
//#endregion
|
|
1947
1986
|
//#region src/model/fetchers/bilibili/bangumi.ts
|
|
1948
1987
|
/**
|
|
@@ -1985,7 +2024,6 @@ async function fetchBangumiStreamUrl(options, cookie, requestConfig) {
|
|
|
1985
2024
|
requestConfig
|
|
1986
2025
|
});
|
|
1987
2026
|
}
|
|
1988
|
-
|
|
1989
2027
|
//#endregion
|
|
1990
2028
|
//#region src/model/fetchers/bilibili/comment.ts
|
|
1991
2029
|
/**
|
|
@@ -2029,7 +2067,6 @@ async function fetchCommentReplies$1(options, cookie, requestConfig) {
|
|
|
2029
2067
|
requestConfig
|
|
2030
2068
|
});
|
|
2031
2069
|
}
|
|
2032
|
-
|
|
2033
2070
|
//#endregion
|
|
2034
2071
|
//#region src/model/fetchers/bilibili/dynamic.ts
|
|
2035
2072
|
/**
|
|
@@ -2053,24 +2090,29 @@ async function fetchDynamicDetail(options, cookie, requestConfig) {
|
|
|
2053
2090
|
}
|
|
2054
2091
|
/**
|
|
2055
2092
|
* 获取B站动态卡片信息
|
|
2093
|
+
*
|
|
2094
|
+
* @deprecated v6.1.3 已废弃,B站官方已于 `2025-08-09` 删除原 `dynamic_svr` 接口。
|
|
2095
|
+
* 调用将返回错误信息
|
|
2096
|
+
* 计划于 v7.0.0 移除。
|
|
2097
|
+
*
|
|
2056
2098
|
* @param options - 动态参数
|
|
2057
2099
|
* @param options.dynamic_id - 动态 ID
|
|
2058
2100
|
* @param cookie - B站 Cookie (可选)
|
|
2059
2101
|
* @param requestConfig - 请求配置 (可选)
|
|
2060
|
-
* @returns
|
|
2102
|
+
* @returns 动态卡片数据(已停用,返回错误信息)
|
|
2061
2103
|
* @example
|
|
2062
2104
|
* ```typescript
|
|
2063
2105
|
* const result = await fetchDynamicCard({ dynamic_id: '123456789' }, cookie)
|
|
2064
|
-
*
|
|
2106
|
+
* // result.success === false,错误信息提示接口已停用
|
|
2065
2107
|
* ```
|
|
2066
2108
|
*/
|
|
2067
2109
|
async function fetchDynamicCard(options, cookie, requestConfig) {
|
|
2110
|
+
checkDeprecation("fetchDynamicCard");
|
|
2068
2111
|
return fetchBilibiliInternal("dynamicCard", options, {
|
|
2069
2112
|
cookie,
|
|
2070
2113
|
requestConfig
|
|
2071
2114
|
});
|
|
2072
2115
|
}
|
|
2073
|
-
|
|
2074
2116
|
//#endregion
|
|
2075
2117
|
//#region src/model/fetchers/bilibili/live.ts
|
|
2076
2118
|
/**
|
|
@@ -2111,7 +2153,6 @@ async function fetchLiveRoomInitInfo(options, cookie, requestConfig) {
|
|
|
2111
2153
|
requestConfig
|
|
2112
2154
|
});
|
|
2113
2155
|
}
|
|
2114
|
-
|
|
2115
2156
|
//#endregion
|
|
2116
2157
|
//#region src/model/fetchers/bilibili/user.ts
|
|
2117
2158
|
/**
|
|
@@ -2190,7 +2231,6 @@ async function fetchUploaderTotalViews(options, cookie, requestConfig) {
|
|
|
2190
2231
|
requestConfig
|
|
2191
2232
|
});
|
|
2192
2233
|
}
|
|
2193
|
-
|
|
2194
2234
|
//#endregion
|
|
2195
2235
|
//#region src/model/fetchers/bilibili/utils.ts
|
|
2196
2236
|
/**
|
|
@@ -2250,7 +2290,6 @@ async function fetchEmojiList$3(options, cookie, requestConfig) {
|
|
|
2250
2290
|
requestConfig
|
|
2251
2291
|
});
|
|
2252
2292
|
}
|
|
2253
|
-
|
|
2254
2293
|
//#endregion
|
|
2255
2294
|
//#region src/model/fetchers/bilibili/video.ts
|
|
2256
2295
|
/**
|
|
@@ -2311,7 +2350,6 @@ async function fetchVideoDanmaku(options, cookie, requestConfig) {
|
|
|
2311
2350
|
requestConfig
|
|
2312
2351
|
});
|
|
2313
2352
|
}
|
|
2314
|
-
|
|
2315
2353
|
//#endregion
|
|
2316
2354
|
//#region src/model/fetchers/bilibili/bound.ts
|
|
2317
2355
|
/**
|
|
@@ -2339,6 +2377,7 @@ function createBoundBilibiliFetcher(cookie, requestConfig) {
|
|
|
2339
2377
|
fetchUserSpaceInfo: (options) => fetchUserSpaceInfo(options, cookie, requestConfig),
|
|
2340
2378
|
fetchUploaderTotalViews: (options) => fetchUploaderTotalViews(options, cookie, requestConfig),
|
|
2341
2379
|
fetchDynamicDetail: (options) => fetchDynamicDetail(options, cookie, requestConfig),
|
|
2380
|
+
/** @deprecated v6.1.3 已废弃,调用将返回错误信息 */
|
|
2342
2381
|
fetchDynamicCard: (options) => fetchDynamicCard(options, cookie, requestConfig),
|
|
2343
2382
|
fetchBangumiInfo: (options) => fetchBangumiInfo(options, cookie, requestConfig),
|
|
2344
2383
|
fetchBangumiStreamUrl: (options) => fetchBangumiStreamUrl(options, cookie, requestConfig),
|
|
@@ -2358,7 +2397,6 @@ function createBoundBilibiliFetcher(cookie, requestConfig) {
|
|
|
2358
2397
|
fetchEmojiList: (options) => fetchEmojiList$3(options, cookie, requestConfig)
|
|
2359
2398
|
};
|
|
2360
2399
|
}
|
|
2361
|
-
|
|
2362
2400
|
//#endregion
|
|
2363
2401
|
//#region src/model/fetchers/bilibili/index.ts
|
|
2364
2402
|
/**
|
|
@@ -2404,7 +2442,6 @@ const bilibiliFetcher = {
|
|
|
2404
2442
|
convertBvToAv,
|
|
2405
2443
|
fetchEmojiList: fetchEmojiList$3
|
|
2406
2444
|
};
|
|
2407
|
-
|
|
2408
2445
|
//#endregion
|
|
2409
2446
|
//#region src/platform/defaultConfigs.ts
|
|
2410
2447
|
/**
|
|
@@ -2539,158 +2576,34 @@ const getXiaohongshuDefaultConfig = (cookie) => {
|
|
|
2539
2576
|
cookie: cookie ?? ""
|
|
2540
2577
|
} };
|
|
2541
2578
|
};
|
|
2542
|
-
|
|
2543
2579
|
//#endregion
|
|
2544
2580
|
//#region src/types/NetworksConfigType.ts
|
|
2545
|
-
/** 未知错误 */
|
|
2546
|
-
let amagiAPIErrorCode = /* @__PURE__ */ function(amagiAPIErrorCode$1) {
|
|
2547
|
-
/** 未知错误 */
|
|
2548
|
-
amagiAPIErrorCode$1["UNKNOWN"] = "UNKNOWN_ERROR";
|
|
2549
|
-
return amagiAPIErrorCode$1;
|
|
2550
|
-
}({});
|
|
2551
|
-
/** 抖音平台API错误码 */
|
|
2552
|
-
let douoyinAPIErrorCode = /* @__PURE__ */ function(douoyinAPIErrorCode$1) {
|
|
2553
|
-
/** Cookie无效或已过期 */
|
|
2554
|
-
douoyinAPIErrorCode$1["COOKIE"] = "INVALID_COOKIE";
|
|
2555
|
-
/** 内容被隐藏或下架 */
|
|
2556
|
-
douoyinAPIErrorCode$1["FILTER"] = "CONTENT_FILTERED";
|
|
2557
|
-
/** 当前用户未开播 */
|
|
2558
|
-
douoyinAPIErrorCode$1["NOT_LIVE"] = "USER_NOT_LIVE";
|
|
2559
|
-
/** 未知错误 */
|
|
2560
|
-
douoyinAPIErrorCode$1["UNKNOWN"] = "UNKNOWN_ERROR";
|
|
2561
|
-
return douoyinAPIErrorCode$1;
|
|
2562
|
-
}({});
|
|
2563
|
-
/** B站平台API错误码 */
|
|
2564
|
-
let bilibiliAPIErrorCode = /* @__PURE__ */ function(bilibiliAPIErrorCode$1) {
|
|
2565
|
-
/** 应用程序不存在或已被封禁 */
|
|
2566
|
-
bilibiliAPIErrorCode$1["APP_NOT_FOUND"] = "-1";
|
|
2567
|
-
/** Access Key 错误 */
|
|
2568
|
-
bilibiliAPIErrorCode$1["ACCESS_KEY_ERROR"] = "-2";
|
|
2569
|
-
/** API 校验密匙错误 */
|
|
2570
|
-
bilibiliAPIErrorCode$1["API_KEY_ERROR"] = "-3";
|
|
2571
|
-
/** 调用方对该Method没有权限 */
|
|
2572
|
-
bilibiliAPIErrorCode$1["METHOD_NOT_PERMITTED"] = "-4";
|
|
2573
|
-
/** 账号未登录 */
|
|
2574
|
-
bilibiliAPIErrorCode$1["NOT_LOGGED_IN"] = "-101";
|
|
2575
|
-
/** 账号被封停 */
|
|
2576
|
-
bilibiliAPIErrorCode$1["ACCOUNT_BANNED"] = "-102";
|
|
2577
|
-
/** 积分不足 */
|
|
2578
|
-
bilibiliAPIErrorCode$1["POINTS_INSUFFICIENT"] = "-103";
|
|
2579
|
-
/** 硬币不足 */
|
|
2580
|
-
bilibiliAPIErrorCode$1["COINS_INSUFFICIENT"] = "-104";
|
|
2581
|
-
/** 验证码错误 */
|
|
2582
|
-
bilibiliAPIErrorCode$1["CAPTCHA_ERROR"] = "-105";
|
|
2583
|
-
/** 账号非正式会员或在适应期 */
|
|
2584
|
-
bilibiliAPIErrorCode$1["MEMBERSHIP_LIMITED"] = "-106";
|
|
2585
|
-
/** 应用不存在或者被封禁 */
|
|
2586
|
-
bilibiliAPIErrorCode$1["APP_BANNED"] = "-107";
|
|
2587
|
-
/** 未绑定手机 */
|
|
2588
|
-
bilibiliAPIErrorCode$1["PHONE_NOT_BOUND"] = "-108";
|
|
2589
|
-
/** 未绑定手机 */
|
|
2590
|
-
bilibiliAPIErrorCode$1["PHONE_NOT_BOUND_2"] = "-110";
|
|
2591
|
-
/** csrf 校验失败 */
|
|
2592
|
-
bilibiliAPIErrorCode$1["CSRF_ERROR"] = "-111";
|
|
2593
|
-
/** 系统升级中 */
|
|
2594
|
-
bilibiliAPIErrorCode$1["SYSTEM_UPDATING"] = "-112";
|
|
2595
|
-
/** 账号尚未实名认证 */
|
|
2596
|
-
bilibiliAPIErrorCode$1["NOT_REAL_NAME_VERIFIED"] = "-113";
|
|
2597
|
-
/** 请先绑定手机 */
|
|
2598
|
-
bilibiliAPIErrorCode$1["NEED_BIND_PHONE"] = "-114";
|
|
2599
|
-
/** 请先完成实名认证 */
|
|
2600
|
-
bilibiliAPIErrorCode$1["NEED_REAL_NAME_VERIFICATION"] = "-115";
|
|
2601
|
-
/** 木有改动 */
|
|
2602
|
-
bilibiliAPIErrorCode$1["NO_CHANGE"] = "-304";
|
|
2603
|
-
/** 撞车跳转 */
|
|
2604
|
-
bilibiliAPIErrorCode$1["CONFLICT_REDIRECT"] = "-307";
|
|
2605
|
-
/** 风控校验失败 (UA 或 wbi 参数不合法) */
|
|
2606
|
-
bilibiliAPIErrorCode$1["RISK_CONTROL_FAILED"] = "-352";
|
|
2607
|
-
/** 请求错误 */
|
|
2608
|
-
bilibiliAPIErrorCode$1["BAD_REQUEST"] = "-400";
|
|
2609
|
-
/** 未认证 (或非法请求) */
|
|
2610
|
-
bilibiliAPIErrorCode$1["UNAUTHORIZED"] = "-401";
|
|
2611
|
-
/** 访问权限不足 */
|
|
2612
|
-
bilibiliAPIErrorCode$1["FORBIDDEN"] = "-403";
|
|
2613
|
-
/** 啥都木有 */
|
|
2614
|
-
bilibiliAPIErrorCode$1["NOT_FOUND"] = "-404";
|
|
2615
|
-
/** 不支持该方法 */
|
|
2616
|
-
bilibiliAPIErrorCode$1["METHOD_NOT_ALLOWED"] = "-405";
|
|
2617
|
-
/** 冲突 */
|
|
2618
|
-
bilibiliAPIErrorCode$1["CONFLICT"] = "-409";
|
|
2619
|
-
/** 请求被拦截 (客户端 ip 被服务端风控) */
|
|
2620
|
-
bilibiliAPIErrorCode$1["IP_BLOCKED"] = "-412";
|
|
2621
|
-
/** 服务器错误 */
|
|
2622
|
-
bilibiliAPIErrorCode$1["SERVER_ERROR"] = "-500";
|
|
2623
|
-
/** 过载保护,服务暂不可用 */
|
|
2624
|
-
bilibiliAPIErrorCode$1["SERVICE_UNAVAILABLE"] = "-503";
|
|
2625
|
-
/** 服务调用超时 */
|
|
2626
|
-
bilibiliAPIErrorCode$1["GATEWAY_TIMEOUT"] = "-504";
|
|
2627
|
-
/** 超出限制 */
|
|
2628
|
-
bilibiliAPIErrorCode$1["RATE_LIMITED"] = "-509";
|
|
2629
|
-
/** 上传文件不存在 */
|
|
2630
|
-
bilibiliAPIErrorCode$1["FILE_NOT_FOUND"] = "-616";
|
|
2631
|
-
/** 上传文件太大 */
|
|
2632
|
-
bilibiliAPIErrorCode$1["FILE_TOO_LARGE"] = "-617";
|
|
2633
|
-
/** 登录失败次数太多 */
|
|
2634
|
-
bilibiliAPIErrorCode$1["LOGIN_ATTEMPTS_EXCEEDED"] = "-625";
|
|
2635
|
-
/** 用户不存在 */
|
|
2636
|
-
bilibiliAPIErrorCode$1["USER_NOT_FOUND"] = "-626";
|
|
2637
|
-
/** 密码太弱 */
|
|
2638
|
-
bilibiliAPIErrorCode$1["WEAK_PASSWORD"] = "-628";
|
|
2639
|
-
/** 用户名或密码错误 */
|
|
2640
|
-
bilibiliAPIErrorCode$1["INVALID_CREDENTIALS"] = "-629";
|
|
2641
|
-
/** 操作对象数量限制 */
|
|
2642
|
-
bilibiliAPIErrorCode$1["OBJECT_LIMIT_EXCEEDED"] = "-632";
|
|
2643
|
-
/** 被锁定 */
|
|
2644
|
-
bilibiliAPIErrorCode$1["ACCOUNT_LOCKED"] = "-643";
|
|
2645
|
-
/** 用户等级太低 */
|
|
2646
|
-
bilibiliAPIErrorCode$1["USER_LEVEL_TOO_LOW"] = "-650";
|
|
2647
|
-
/** 重复的用户 */
|
|
2648
|
-
bilibiliAPIErrorCode$1["DUPLICATE_USER"] = "-652";
|
|
2649
|
-
/** Token 过期 */
|
|
2650
|
-
bilibiliAPIErrorCode$1["TOKEN_EXPIRED"] = "-658";
|
|
2651
|
-
/** 密码时间戳过期 */
|
|
2652
|
-
bilibiliAPIErrorCode$1["PASSWORD_TIMESTAMP_EXPIRED"] = "-662";
|
|
2653
|
-
/** 地理区域限制 */
|
|
2654
|
-
bilibiliAPIErrorCode$1["GEO_RESTRICTED"] = "-688";
|
|
2655
|
-
/** 版权限制 */
|
|
2656
|
-
bilibiliAPIErrorCode$1["COPYRIGHT_RESTRICTED"] = "-689";
|
|
2657
|
-
/** 扣节操失败 */
|
|
2658
|
-
bilibiliAPIErrorCode$1["REPUTATION_DEDUCTION_FAILED"] = "-701";
|
|
2659
|
-
/** 请求过于频繁,请稍后再试 */
|
|
2660
|
-
bilibiliAPIErrorCode$1["TOO_MANY_REQUESTS"] = "-799";
|
|
2661
|
-
/** 服务器开小差了 */
|
|
2662
|
-
bilibiliAPIErrorCode$1["SERVER_TEMPORARILY_UNAVAILABLE"] = "-8888";
|
|
2663
|
-
/** 未知错误 */
|
|
2664
|
-
bilibiliAPIErrorCode$1["UNKNOWN"] = "UNKNOWN";
|
|
2665
|
-
return bilibiliAPIErrorCode$1;
|
|
2666
|
-
}({});
|
|
2667
2581
|
/** 快手平台API错误码 */
|
|
2668
|
-
let kuaishouAPIErrorCode = /* @__PURE__ */ function(kuaishouAPIErrorCode
|
|
2582
|
+
let kuaishouAPIErrorCode = /* @__PURE__ */ function(kuaishouAPIErrorCode) {
|
|
2669
2583
|
/** Cookie无效或已过期 */
|
|
2670
|
-
kuaishouAPIErrorCode
|
|
2584
|
+
kuaishouAPIErrorCode["COOKIE"] = "INVALID_COOKIE";
|
|
2671
2585
|
/** 未知错误 */
|
|
2672
|
-
kuaishouAPIErrorCode
|
|
2673
|
-
return kuaishouAPIErrorCode
|
|
2586
|
+
kuaishouAPIErrorCode["UNKNOWN"] = "UNKNOWN_ERROR";
|
|
2587
|
+
return kuaishouAPIErrorCode;
|
|
2674
2588
|
}({});
|
|
2675
2589
|
/** 小红书平台API错误码 */
|
|
2676
|
-
let xiaohongshuAPIErrorCode = /* @__PURE__ */ function(xiaohongshuAPIErrorCode
|
|
2590
|
+
let xiaohongshuAPIErrorCode = /* @__PURE__ */ function(xiaohongshuAPIErrorCode) {
|
|
2677
2591
|
/** Cookie无效或已过期 */
|
|
2678
|
-
xiaohongshuAPIErrorCode
|
|
2592
|
+
xiaohongshuAPIErrorCode["COOKIE"] = "INVALID_COOKIE";
|
|
2679
2593
|
/** 未知错误 */
|
|
2680
|
-
xiaohongshuAPIErrorCode
|
|
2594
|
+
xiaohongshuAPIErrorCode["UNKNOWN"] = "UNKNOWN_ERROR";
|
|
2681
2595
|
/** 非法请求 */
|
|
2682
|
-
xiaohongshuAPIErrorCode
|
|
2596
|
+
xiaohongshuAPIErrorCode[xiaohongshuAPIErrorCode["ILLEGAL_REQUEST"] = 500] = "ILLEGAL_REQUEST";
|
|
2683
2597
|
/** 检测到帐号异常,请稍后重试 */
|
|
2684
|
-
xiaohongshuAPIErrorCode
|
|
2598
|
+
xiaohongshuAPIErrorCode[xiaohongshuAPIErrorCode["ACCOUNT_ABNORMAL"] = 300011] = "ACCOUNT_ABNORMAL";
|
|
2685
2599
|
/** 网络连接异常,请检查网络设置后重试 */
|
|
2686
|
-
xiaohongshuAPIErrorCode
|
|
2600
|
+
xiaohongshuAPIErrorCode[xiaohongshuAPIErrorCode["NETWORK_ERROR"] = 300012] = "NETWORK_ERROR";
|
|
2687
2601
|
/** 访问频次异常,请勿频繁操作 */
|
|
2688
|
-
xiaohongshuAPIErrorCode
|
|
2602
|
+
xiaohongshuAPIErrorCode[xiaohongshuAPIErrorCode["FREQUENCY_ERROR"] = 300013] = "FREQUENCY_ERROR";
|
|
2689
2603
|
/** 浏览器异常,请尝试更换浏览器后重试 */
|
|
2690
|
-
xiaohongshuAPIErrorCode
|
|
2691
|
-
return xiaohongshuAPIErrorCode
|
|
2604
|
+
xiaohongshuAPIErrorCode[xiaohongshuAPIErrorCode["BROWSER_ERROR"] = 300015] = "BROWSER_ERROR";
|
|
2605
|
+
return xiaohongshuAPIErrorCode;
|
|
2692
2606
|
}({});
|
|
2693
|
-
|
|
2694
2607
|
//#endregion
|
|
2695
2608
|
//#region src/platform/douyin/sign/a_bogus.ts
|
|
2696
2609
|
var SM3 = class {
|
|
@@ -2760,7 +2673,7 @@ var SM3 = class {
|
|
|
2760
2673
|
if (t.length < 64) console.error("compress error: not enough data");
|
|
2761
2674
|
else {
|
|
2762
2675
|
for (var f = ((e) => {
|
|
2763
|
-
for (var r = new Array(132), t
|
|
2676
|
+
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;
|
|
2764
2677
|
for (var n = 16; n < 68; n++) {
|
|
2765
2678
|
let a = r[n - 16] ^ r[n - 9] ^ this.le(r[n - 3], 15);
|
|
2766
2679
|
a = a ^ this.le(a, 15) ^ this.le(a, 23), r[n] = (a ^ this.le(r[n - 13], 7) ^ r[n - 6]) >>> 0;
|
|
@@ -2839,18 +2752,17 @@ function rc4_encrypt(plaintext, key) {
|
|
|
2839
2752
|
return cipher.join("");
|
|
2840
2753
|
}
|
|
2841
2754
|
function result_encrypt(long_str, num) {
|
|
2842
|
-
const s_obj = {
|
|
2843
|
-
s0: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
|
2844
|
-
s1: "Dkdpgh4ZKsQB80/Mfvw36XI1R25+WUAlEi7NLboqYTOPuzmFjJnryx9HVGcaStCe=",
|
|
2845
|
-
s2: "Dkdpgh4ZKsQB80/Mfvw36XI1R25-WUAlEi7NLboqYTOPuzmFjJnryx9HVGcaStCe=",
|
|
2846
|
-
s3: "ckdp1h4ZKsUB80/Mfvw36XIgR25+WQAlEi7NLboqYTOPuzmFjJnryx9HVGDaStCe",
|
|
2847
|
-
s4: "Dkdpgh2ZmsQB80/MfvV36XI1R45-WUAlEixNLwoqYTOPuzKFjJnry79HbGcaStCe"
|
|
2848
|
-
};
|
|
2849
2755
|
const constant = {
|
|
2850
2756
|
0: 16515072,
|
|
2851
2757
|
1: 258048,
|
|
2852
2758
|
2: 4032,
|
|
2853
|
-
str:
|
|
2759
|
+
str: {
|
|
2760
|
+
s0: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
|
2761
|
+
s1: "Dkdpgh4ZKsQB80/Mfvw36XI1R25+WUAlEi7NLboqYTOPuzmFjJnryx9HVGcaStCe=",
|
|
2762
|
+
s2: "Dkdpgh4ZKsQB80/Mfvw36XI1R25-WUAlEi7NLboqYTOPuzmFjJnryx9HVGcaStCe=",
|
|
2763
|
+
s3: "ckdp1h4ZKsUB80/Mfvw36XIgR25+WQAlEi7NLboqYTOPuzmFjJnryx9HVGDaStCe",
|
|
2764
|
+
s4: "Dkdpgh2ZmsQB80/MfvV36XI1R45-WUAlEixNLwoqYTOPuzKFjJnry79HbGcaStCe"
|
|
2765
|
+
}[num]
|
|
2854
2766
|
};
|
|
2855
2767
|
let result = "";
|
|
2856
2768
|
let lound = 0;
|
|
@@ -2910,10 +2822,9 @@ function generate_rc4_bb_str(url_search_params, user_agent, window_env_str, suff
|
|
|
2910
2822
|
1,
|
|
2911
2823
|
14
|
|
2912
2824
|
])), "s3"));
|
|
2913
|
-
const end_time = Date.now();
|
|
2914
2825
|
let b = {
|
|
2915
2826
|
8: 3,
|
|
2916
|
-
10:
|
|
2827
|
+
10: Date.now(),
|
|
2917
2828
|
15: {
|
|
2918
2829
|
aid: 6383,
|
|
2919
2830
|
pageId: 6241,
|
|
@@ -3098,7 +3009,6 @@ var a_bogus_default = (url, user_agent) => {
|
|
|
3098
3009
|
const cleanedUserAgent = cleanUserAgentForSigning(user_agent);
|
|
3099
3010
|
return result_encrypt(generate_random_str() + generate_rc4_bb_str(new URLSearchParams(new URL(url).search).toString(), cleanedUserAgent, "1536|747|1536|834|0|30|0|0|1536|834|1536|864|1525|747|24|24|Win32"), "s4") + "=";
|
|
3100
3011
|
};
|
|
3101
|
-
|
|
3102
3012
|
//#endregion
|
|
3103
3013
|
//#region src/platform/douyin/sign/x_bogus.ts
|
|
3104
3014
|
/**
|
|
@@ -3163,14 +3073,14 @@ var XBogus = class {
|
|
|
3163
3073
|
encodingConversion2(a, b, c) {
|
|
3164
3074
|
return String.fromCharCode(a) + String.fromCharCode(b) + c;
|
|
3165
3075
|
}
|
|
3166
|
-
rc4Encrypt(key, data
|
|
3076
|
+
rc4Encrypt(key, data) {
|
|
3167
3077
|
const keyBuffer = typeof key === "string" ? Buffer.from(key, "latin1") : key;
|
|
3168
|
-
const dataBuffer = Buffer.from(data
|
|
3169
|
-
const S = Array.from({ length: 256 }, (_, i
|
|
3078
|
+
const dataBuffer = Buffer.from(data, "latin1");
|
|
3079
|
+
const S = Array.from({ length: 256 }, (_, i) => i);
|
|
3170
3080
|
let j = 0;
|
|
3171
|
-
for (let i
|
|
3172
|
-
j = (j + S[i
|
|
3173
|
-
[S[i
|
|
3081
|
+
for (let i = 0; i < 256; i++) {
|
|
3082
|
+
j = (j + S[i] + keyBuffer[i % keyBuffer.length]) % 256;
|
|
3083
|
+
[S[i], S[j]] = [S[j], S[i]];
|
|
3174
3084
|
}
|
|
3175
3085
|
const encryptedBuffer = Buffer.alloc(dataBuffer.length);
|
|
3176
3086
|
let i = 0;
|
|
@@ -3262,7 +3172,6 @@ var XBogus = class {
|
|
|
3262
3172
|
};
|
|
3263
3173
|
}
|
|
3264
3174
|
};
|
|
3265
|
-
|
|
3266
3175
|
//#endregion
|
|
3267
3176
|
//#region src/platform/douyin/sign/index.ts
|
|
3268
3177
|
const defaultUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36";
|
|
@@ -3311,7 +3220,6 @@ var douyinSign = class {
|
|
|
3311
3220
|
return "verify_" + n + "_" + r.join("");
|
|
3312
3221
|
}
|
|
3313
3222
|
};
|
|
3314
|
-
|
|
3315
3223
|
//#endregion
|
|
3316
3224
|
//#region src/platform/douyin/API.ts
|
|
3317
3225
|
/**
|
|
@@ -3385,10 +3293,10 @@ var DouyinAPI = class {
|
|
|
3385
3293
|
};
|
|
3386
3294
|
}
|
|
3387
3295
|
/** 获取视频或图集数据 */
|
|
3388
|
-
getWorkDetail(data
|
|
3296
|
+
getWorkDetail(data) {
|
|
3389
3297
|
return `https://www.douyin.com/aweme/v1/web/aweme/detail/?${buildQueryString({
|
|
3390
3298
|
...this.getBaseParams(),
|
|
3391
|
-
aweme_id: data
|
|
3299
|
+
aweme_id: data.aweme_id,
|
|
3392
3300
|
update_version_code: "170400",
|
|
3393
3301
|
version_code: "190500",
|
|
3394
3302
|
version_name: "19.5.0",
|
|
@@ -3399,12 +3307,12 @@ var DouyinAPI = class {
|
|
|
3399
3307
|
})}`;
|
|
3400
3308
|
}
|
|
3401
3309
|
/** 获取评论数据 */
|
|
3402
|
-
getComments(data
|
|
3310
|
+
getComments(data) {
|
|
3403
3311
|
return `https://www.douyin.com/aweme/v1/web/comment/list/?${buildQueryString({
|
|
3404
3312
|
...this.getBaseParams(),
|
|
3405
|
-
aweme_id: data
|
|
3406
|
-
cursor: data
|
|
3407
|
-
count: data
|
|
3313
|
+
aweme_id: data.aweme_id,
|
|
3314
|
+
cursor: data.cursor ?? 0,
|
|
3315
|
+
count: data.number ?? 50,
|
|
3408
3316
|
item_type: "0",
|
|
3409
3317
|
insert_ids: "",
|
|
3410
3318
|
whale_cut_token: "",
|
|
@@ -3418,16 +3326,16 @@ var DouyinAPI = class {
|
|
|
3418
3326
|
})}`;
|
|
3419
3327
|
}
|
|
3420
3328
|
/** 获取二级评论数据 */
|
|
3421
|
-
getCommentReplies(data
|
|
3329
|
+
getCommentReplies(data) {
|
|
3422
3330
|
return `https://www-hj.douyin.com/aweme/v1/web/comment/list/reply/?${buildQueryString({
|
|
3423
3331
|
device_platform: "webapp",
|
|
3424
3332
|
aid: "6383",
|
|
3425
3333
|
channel: "channel_pc_web",
|
|
3426
|
-
item_id: data
|
|
3427
|
-
comment_id: data
|
|
3334
|
+
item_id: data.aweme_id,
|
|
3335
|
+
comment_id: data.comment_id,
|
|
3428
3336
|
cut_version: "1",
|
|
3429
|
-
cursor: data
|
|
3430
|
-
count: data
|
|
3337
|
+
cursor: data.cursor,
|
|
3338
|
+
count: data.number,
|
|
3431
3339
|
item_type: "0",
|
|
3432
3340
|
update_version_code: "170400",
|
|
3433
3341
|
pc_client_type: "1",
|
|
@@ -3460,12 +3368,12 @@ var DouyinAPI = class {
|
|
|
3460
3368
|
})}`;
|
|
3461
3369
|
}
|
|
3462
3370
|
/** 获取动图数据 */
|
|
3463
|
-
getSlidesInfo(data
|
|
3371
|
+
getSlidesInfo(data) {
|
|
3464
3372
|
return `https://www.iesdouyin.com/web/api/v2/aweme/slidesinfo/?${buildQueryString({
|
|
3465
3373
|
reflow_source: "reflow_page",
|
|
3466
3374
|
web_id: "7326472315356857893",
|
|
3467
3375
|
device_id: "7326472315356857893",
|
|
3468
|
-
aweme_ids: `[${data
|
|
3376
|
+
aweme_ids: `[${data.aweme_id}]`,
|
|
3469
3377
|
request_source: "200",
|
|
3470
3378
|
msToken: douyinSign.Mstoken(116),
|
|
3471
3379
|
verifyFp: fp,
|
|
@@ -3477,18 +3385,18 @@ var DouyinAPI = class {
|
|
|
3477
3385
|
return "https://www.douyin.com/aweme/v1/web/emoji/list";
|
|
3478
3386
|
}
|
|
3479
3387
|
/** 获取用户主页视频数据 */
|
|
3480
|
-
getUserVideoList(data
|
|
3388
|
+
getUserVideoList(data) {
|
|
3481
3389
|
return `https://www.douyin.com/aweme/v1/web/aweme/post/?${buildQueryString({
|
|
3482
3390
|
...this.getBaseParams(),
|
|
3483
|
-
sec_user_id: data
|
|
3484
|
-
max_cursor: data
|
|
3391
|
+
sec_user_id: data.sec_uid,
|
|
3392
|
+
max_cursor: data.max_cursor ?? "0",
|
|
3485
3393
|
locate_query: "false",
|
|
3486
3394
|
show_live_replay_strategy: "1",
|
|
3487
3395
|
need_time_list: "1",
|
|
3488
3396
|
time_list_query: "0",
|
|
3489
3397
|
whale_cut_token: "",
|
|
3490
3398
|
cut_version: "1",
|
|
3491
|
-
count: data
|
|
3399
|
+
count: data.number ?? 18,
|
|
3492
3400
|
publish_video_strategy_type: "2",
|
|
3493
3401
|
version_code: "170400",
|
|
3494
3402
|
version_name: "17.4.0",
|
|
@@ -3499,15 +3407,15 @@ var DouyinAPI = class {
|
|
|
3499
3407
|
})}`;
|
|
3500
3408
|
}
|
|
3501
3409
|
/** 获取用户喜欢列表数据 */
|
|
3502
|
-
getUserFavoriteList(data
|
|
3410
|
+
getUserFavoriteList(data) {
|
|
3503
3411
|
return `https://www-hj.douyin.com/aweme/v1/web/aweme/favorite/?${buildQueryString({
|
|
3504
3412
|
...this.getBaseParams(),
|
|
3505
|
-
sec_user_id: data
|
|
3506
|
-
max_cursor: data
|
|
3413
|
+
sec_user_id: data.sec_uid,
|
|
3414
|
+
max_cursor: data.max_cursor ?? "0",
|
|
3507
3415
|
min_cursor: "0",
|
|
3508
3416
|
whale_cut_token: "",
|
|
3509
3417
|
cut_version: "1",
|
|
3510
|
-
count: data
|
|
3418
|
+
count: data.number ?? 18,
|
|
3511
3419
|
publish_video_strategy_type: "2",
|
|
3512
3420
|
update_version_code: "170400",
|
|
3513
3421
|
pc_libra_divert: "Windows",
|
|
@@ -3522,16 +3430,16 @@ var DouyinAPI = class {
|
|
|
3522
3430
|
})}`;
|
|
3523
3431
|
}
|
|
3524
3432
|
/** 获取用户推荐列表数据 */
|
|
3525
|
-
getUserRecommendList(data
|
|
3433
|
+
getUserRecommendList(data) {
|
|
3526
3434
|
return `https://www.douyin.com/aweme/v1/web/familiar/recommend/feed/?${buildQueryString({
|
|
3527
3435
|
device_platform: "",
|
|
3528
3436
|
aid: "6383",
|
|
3529
3437
|
channel: "channel_pc_web",
|
|
3530
|
-
sec_user_id: data
|
|
3531
|
-
max_cursor: data
|
|
3438
|
+
sec_user_id: data.sec_uid,
|
|
3439
|
+
max_cursor: data.max_cursor ?? "0",
|
|
3532
3440
|
min_cursor: "0",
|
|
3533
3441
|
whale_cut_token: "",
|
|
3534
|
-
count: data
|
|
3442
|
+
count: data.number ?? 18,
|
|
3535
3443
|
from: "1",
|
|
3536
3444
|
update_version_code: "170400",
|
|
3537
3445
|
pc_client_type: "1",
|
|
@@ -3565,12 +3473,12 @@ var DouyinAPI = class {
|
|
|
3565
3473
|
})}`;
|
|
3566
3474
|
}
|
|
3567
3475
|
/** 获取用户主页信息 */
|
|
3568
|
-
getUserProfile(data
|
|
3476
|
+
getUserProfile(data) {
|
|
3569
3477
|
return `https://www.douyin.com/aweme/v1/web/user/profile/other/?${buildQueryString({
|
|
3570
3478
|
...this.getBaseParams(),
|
|
3571
3479
|
publish_video_strategy_type: "2",
|
|
3572
3480
|
source: "channel_pc_web",
|
|
3573
|
-
sec_user_id: data
|
|
3481
|
+
sec_user_id: data.sec_uid,
|
|
3574
3482
|
personal_center_strategy: "1",
|
|
3575
3483
|
version_code: "170400",
|
|
3576
3484
|
version_name: "17.4.0",
|
|
@@ -3581,10 +3489,10 @@ var DouyinAPI = class {
|
|
|
3581
3489
|
})}`;
|
|
3582
3490
|
}
|
|
3583
3491
|
/** 获取热点词数据 */
|
|
3584
|
-
getSuggestWords(data
|
|
3492
|
+
getSuggestWords(data) {
|
|
3585
3493
|
return `https://www.douyin.com/aweme/v1/web/api/suggest_words/?${buildQueryString({
|
|
3586
3494
|
...this.getBaseParams(),
|
|
3587
|
-
query: data
|
|
3495
|
+
query: data.query,
|
|
3588
3496
|
business_id: "30088",
|
|
3589
3497
|
from_group_id: "7129543174929812767",
|
|
3590
3498
|
version_code: "170400",
|
|
@@ -3596,16 +3504,16 @@ var DouyinAPI = class {
|
|
|
3596
3504
|
})}`;
|
|
3597
3505
|
}
|
|
3598
3506
|
/** 获取搜索数据 */
|
|
3599
|
-
search(data
|
|
3600
|
-
const searchType = data
|
|
3601
|
-
const { verifyFp, fp
|
|
3507
|
+
search(data) {
|
|
3508
|
+
const searchType = data.type ?? "general";
|
|
3509
|
+
const { verifyFp, fp, ...baseParamsWithoutFp } = this.getBaseParams();
|
|
3602
3510
|
if (searchType === "user") return `https://www.douyin.com/aweme/v1/web/discover/search/?${buildQueryString({
|
|
3603
3511
|
...baseParamsWithoutFp,
|
|
3604
|
-
count: data
|
|
3512
|
+
count: data.number ?? 10,
|
|
3605
3513
|
disable_rs: "0",
|
|
3606
3514
|
from_group_id: "",
|
|
3607
3515
|
is_filter_search: "0",
|
|
3608
|
-
keyword: data
|
|
3516
|
+
keyword: data.query,
|
|
3609
3517
|
list_type: "single",
|
|
3610
3518
|
need_filter_settings: "1",
|
|
3611
3519
|
offset: "0",
|
|
@@ -3622,16 +3530,16 @@ var DouyinAPI = class {
|
|
|
3622
3530
|
version_code: "170400",
|
|
3623
3531
|
version_name: "17.4.0",
|
|
3624
3532
|
webid: "7521399115230610959",
|
|
3625
|
-
...data
|
|
3533
|
+
...data.search_id && { search_id: data.search_id }
|
|
3626
3534
|
})}`;
|
|
3627
3535
|
else if (searchType === "video") return `https://www.douyin.com/aweme/v1/web/search/item/?${buildQueryString({
|
|
3628
3536
|
...baseParamsWithoutFp,
|
|
3629
|
-
count: data
|
|
3537
|
+
count: data.number ?? 10,
|
|
3630
3538
|
disable_rs: "0",
|
|
3631
3539
|
enable_history: "1",
|
|
3632
3540
|
from_group_id: "",
|
|
3633
3541
|
is_filter_search: "0",
|
|
3634
|
-
keyword: data
|
|
3542
|
+
keyword: data.query,
|
|
3635
3543
|
list_type: "single",
|
|
3636
3544
|
need_filter_settings: "1",
|
|
3637
3545
|
offset: "0",
|
|
@@ -3648,15 +3556,15 @@ var DouyinAPI = class {
|
|
|
3648
3556
|
version_code: "170400",
|
|
3649
3557
|
version_name: "17.4.0",
|
|
3650
3558
|
webid: "7521399115230610959",
|
|
3651
|
-
...data
|
|
3559
|
+
...data.search_id && { search_id: data.search_id }
|
|
3652
3560
|
})}`;
|
|
3653
3561
|
else return `https://www.douyin.com/aweme/v1/web/general/search/stream/?${buildQueryString({
|
|
3654
3562
|
...baseParamsWithoutFp,
|
|
3655
|
-
count: data
|
|
3563
|
+
count: data.number ?? 10,
|
|
3656
3564
|
disable_rs: "0",
|
|
3657
3565
|
enable_history: "1",
|
|
3658
3566
|
is_filter_search: "0",
|
|
3659
|
-
keyword: data
|
|
3567
|
+
keyword: data.query,
|
|
3660
3568
|
list_type: "",
|
|
3661
3569
|
need_filter_settings: "1",
|
|
3662
3570
|
offset: "0",
|
|
@@ -3712,12 +3620,12 @@ var DouyinAPI = class {
|
|
|
3712
3620
|
})}`;
|
|
3713
3621
|
}
|
|
3714
3622
|
/** 获取背景音乐数据 */
|
|
3715
|
-
getMusicInfo(data
|
|
3623
|
+
getMusicInfo(data) {
|
|
3716
3624
|
return `https://www.douyin.com/aweme/v1/web/music/detail/?${buildQueryString({
|
|
3717
3625
|
device_platform: "webapp",
|
|
3718
3626
|
aid: "6383",
|
|
3719
3627
|
channel: "channel_pc_web",
|
|
3720
|
-
music_id: data
|
|
3628
|
+
music_id: data.music_id,
|
|
3721
3629
|
scene: "1",
|
|
3722
3630
|
pc_client_type: "1",
|
|
3723
3631
|
version_code: "170400",
|
|
@@ -3747,7 +3655,7 @@ var DouyinAPI = class {
|
|
|
3747
3655
|
})}`;
|
|
3748
3656
|
}
|
|
3749
3657
|
/** 获取直播间信息 */
|
|
3750
|
-
getLiveRoomInfo(data
|
|
3658
|
+
getLiveRoomInfo(data) {
|
|
3751
3659
|
return `https://live.douyin.com/webcast/room/web/enter/?${buildQueryString({
|
|
3752
3660
|
aid: "6383",
|
|
3753
3661
|
app_name: "douyin_web",
|
|
@@ -3762,8 +3670,8 @@ var DouyinAPI = class {
|
|
|
3762
3670
|
browser_platform: "Win32",
|
|
3763
3671
|
browser_name: "Chrome",
|
|
3764
3672
|
browser_version: "125.0.0.0",
|
|
3765
|
-
web_rid: data
|
|
3766
|
-
room_id_str: data
|
|
3673
|
+
web_rid: data.web_rid,
|
|
3674
|
+
room_id_str: data.room_id,
|
|
3767
3675
|
enter_source: "",
|
|
3768
3676
|
is_need_double_stream: "false",
|
|
3769
3677
|
insert_task_id: "",
|
|
@@ -3774,23 +3682,23 @@ var DouyinAPI = class {
|
|
|
3774
3682
|
})}`;
|
|
3775
3683
|
}
|
|
3776
3684
|
/** 申请登录二维码 */
|
|
3777
|
-
getLoginQrcode(data
|
|
3685
|
+
getLoginQrcode(data) {
|
|
3778
3686
|
return `https://sso.douyin.com/get_qrcode/?${buildQueryString({
|
|
3779
|
-
verifyFp: data
|
|
3780
|
-
fp: data
|
|
3687
|
+
verifyFp: data.verify_fp,
|
|
3688
|
+
fp: data.verify_fp
|
|
3781
3689
|
})}`;
|
|
3782
3690
|
}
|
|
3783
3691
|
/** 获取弹幕数据 */
|
|
3784
|
-
getDanmakuList(data
|
|
3692
|
+
getDanmakuList(data) {
|
|
3785
3693
|
return `https://www-hj.douyin.com/aweme/v1/web/danmaku/get_v2/?${buildQueryString({
|
|
3786
3694
|
...this.getBaseParams(),
|
|
3787
3695
|
app_name: "aweme",
|
|
3788
3696
|
format: "json",
|
|
3789
|
-
group_id: data
|
|
3790
|
-
item_id: data
|
|
3791
|
-
start_time: data
|
|
3792
|
-
end_time: data
|
|
3793
|
-
duration: data
|
|
3697
|
+
group_id: data.aweme_id,
|
|
3698
|
+
item_id: data.aweme_id,
|
|
3699
|
+
start_time: data.start_time ?? "0",
|
|
3700
|
+
end_time: data.end_time ?? "32000",
|
|
3701
|
+
duration: data.duration,
|
|
3794
3702
|
update_version_code: "170400",
|
|
3795
3703
|
pc_libra_divert: "Windows",
|
|
3796
3704
|
support_h265: "1",
|
|
@@ -3823,7 +3731,6 @@ const createDouyinApiUrls = (userAgent) => {
|
|
|
3823
3731
|
};
|
|
3824
3732
|
/** 默认的 DouyinAPI 实例(使用默认浏览器版本 125.0.0.0) */
|
|
3825
3733
|
const douyinApiUrls = new DouyinAPI();
|
|
3826
|
-
|
|
3827
3734
|
//#endregion
|
|
3828
3735
|
//#region src/platform/douyin/getdata.ts
|
|
3829
3736
|
/**
|
|
@@ -3847,7 +3754,6 @@ const douyinApiUrls = new DouyinAPI();
|
|
|
3847
3754
|
const getSignature = (url, signType = "a_bogus", userAgent) => {
|
|
3848
3755
|
switch (signType) {
|
|
3849
3756
|
case "x_bogus": return douyinSign.XB(url, userAgent);
|
|
3850
|
-
case "a_bogus":
|
|
3851
3757
|
default: return douyinSign.AB(url, userAgent);
|
|
3852
3758
|
}
|
|
3853
3759
|
};
|
|
@@ -3860,7 +3766,6 @@ const getSignature = (url, signType = "a_bogus", userAgent) => {
|
|
|
3860
3766
|
const getSignParamName = (signType = "a_bogus") => {
|
|
3861
3767
|
switch (signType) {
|
|
3862
3768
|
case "x_bogus": return "X-Bogus";
|
|
3863
|
-
case "a_bogus":
|
|
3864
3769
|
default: return "a_bogus";
|
|
3865
3770
|
}
|
|
3866
3771
|
};
|
|
@@ -3884,7 +3789,7 @@ const buildSignedUrl = (url, signType = "a_bogus", userAgent) => {
|
|
|
3884
3789
|
* @param requestConfig - 外部请求配置(优先级最高)
|
|
3885
3790
|
* @returns 返回抖音数据
|
|
3886
3791
|
*/
|
|
3887
|
-
const DouyinData = async (data
|
|
3792
|
+
const DouyinData = async (data, cookie, requestConfig) => {
|
|
3888
3793
|
const defHeaders = getDouyinDefaultConfig(cookie)["headers"];
|
|
3889
3794
|
const baseRequestConfig = {
|
|
3890
3795
|
method: "GET",
|
|
@@ -3896,28 +3801,28 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
3896
3801
|
}
|
|
3897
3802
|
};
|
|
3898
3803
|
const userAgent = baseRequestConfig.headers?.["User-Agent"];
|
|
3899
|
-
const douyinApiUrls
|
|
3900
|
-
const signType = data
|
|
3901
|
-
switch (data
|
|
3804
|
+
const douyinApiUrls = createDouyinApiUrls(userAgent);
|
|
3805
|
+
const signType = data.signType ?? "a_bogus";
|
|
3806
|
+
switch (data.methodType) {
|
|
3902
3807
|
case "textWork":
|
|
3903
3808
|
case "parseWork":
|
|
3904
3809
|
case "videoWork":
|
|
3905
3810
|
case "imageAlbumWork":
|
|
3906
3811
|
case "slidesWork": {
|
|
3907
|
-
const url = douyinApiUrls
|
|
3908
|
-
return await GlobalGetData$3(data
|
|
3812
|
+
const url = douyinApiUrls.getWorkDetail({ aweme_id: data.aweme_id });
|
|
3813
|
+
return await GlobalGetData$3(data.methodType, {
|
|
3909
3814
|
...baseRequestConfig,
|
|
3910
3815
|
url: buildSignedUrl(url, signType, userAgent)
|
|
3911
3816
|
});
|
|
3912
3817
|
}
|
|
3913
3818
|
case "comments": {
|
|
3914
|
-
const urlGenerator = (params) => douyinApiUrls
|
|
3819
|
+
const urlGenerator = (params) => douyinApiUrls.getComments(params);
|
|
3915
3820
|
return await fetchPaginatedData({
|
|
3916
|
-
type: data
|
|
3821
|
+
type: data.methodType,
|
|
3917
3822
|
apiUrlGenerator: urlGenerator,
|
|
3918
3823
|
params: {
|
|
3919
|
-
...data
|
|
3920
|
-
cursor: data
|
|
3824
|
+
...data,
|
|
3825
|
+
cursor: data.cursor ?? 0
|
|
3921
3826
|
},
|
|
3922
3827
|
maxPageSize: 50,
|
|
3923
3828
|
requestConfig: baseRequestConfig,
|
|
@@ -3936,13 +3841,13 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
3936
3841
|
});
|
|
3937
3842
|
}
|
|
3938
3843
|
case "commentReplies": {
|
|
3939
|
-
const urlGenerator = (params) => douyinApiUrls
|
|
3844
|
+
const urlGenerator = (params) => douyinApiUrls.getCommentReplies(params);
|
|
3940
3845
|
return await fetchPaginatedData({
|
|
3941
|
-
type: data
|
|
3846
|
+
type: data.methodType,
|
|
3942
3847
|
apiUrlGenerator: urlGenerator,
|
|
3943
3848
|
params: {
|
|
3944
|
-
...data
|
|
3945
|
-
cursor: data
|
|
3849
|
+
...data,
|
|
3850
|
+
cursor: data.cursor ?? 0
|
|
3946
3851
|
},
|
|
3947
3852
|
maxPageSize: 3,
|
|
3948
3853
|
requestConfig: baseRequestConfig,
|
|
@@ -3961,41 +3866,41 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
3961
3866
|
});
|
|
3962
3867
|
}
|
|
3963
3868
|
case "userProfile": {
|
|
3964
|
-
const url = douyinApiUrls
|
|
3869
|
+
const url = douyinApiUrls.getUserProfile({ sec_uid: data.sec_uid });
|
|
3965
3870
|
const customConfig = {
|
|
3966
3871
|
...baseRequestConfig,
|
|
3967
3872
|
headers: {
|
|
3968
3873
|
...baseRequestConfig.headers,
|
|
3969
|
-
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data
|
|
3874
|
+
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data.sec_uid}` }
|
|
3970
3875
|
}
|
|
3971
3876
|
};
|
|
3972
|
-
return await GlobalGetData$3(data
|
|
3877
|
+
return await GlobalGetData$3(data.methodType, {
|
|
3973
3878
|
...customConfig,
|
|
3974
3879
|
url: buildSignedUrl(url, signType, userAgent)
|
|
3975
3880
|
});
|
|
3976
3881
|
}
|
|
3977
3882
|
case "emojiList": {
|
|
3978
|
-
const url = douyinApiUrls
|
|
3979
|
-
return await GlobalGetData$3(data
|
|
3883
|
+
const url = douyinApiUrls.getEmojiList();
|
|
3884
|
+
return await GlobalGetData$3(data.methodType, {
|
|
3980
3885
|
...baseRequestConfig,
|
|
3981
3886
|
url
|
|
3982
3887
|
});
|
|
3983
3888
|
}
|
|
3984
3889
|
case "userVideoList": {
|
|
3985
|
-
const urlGenerator = (params) => douyinApiUrls
|
|
3890
|
+
const urlGenerator = (params) => douyinApiUrls.getUserVideoList(params);
|
|
3986
3891
|
return await fetchPaginatedData({
|
|
3987
|
-
type: data
|
|
3892
|
+
type: data.methodType,
|
|
3988
3893
|
apiUrlGenerator: urlGenerator,
|
|
3989
3894
|
params: {
|
|
3990
|
-
...data
|
|
3991
|
-
max_cursor: data
|
|
3895
|
+
...data,
|
|
3896
|
+
max_cursor: data.max_cursor
|
|
3992
3897
|
},
|
|
3993
3898
|
maxPageSize: 18,
|
|
3994
3899
|
requestConfig: {
|
|
3995
3900
|
...baseRequestConfig,
|
|
3996
3901
|
headers: {
|
|
3997
3902
|
...baseRequestConfig.headers,
|
|
3998
|
-
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data
|
|
3903
|
+
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data.sec_uid}` }
|
|
3999
3904
|
}
|
|
4000
3905
|
},
|
|
4001
3906
|
signType,
|
|
@@ -4012,20 +3917,20 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4012
3917
|
});
|
|
4013
3918
|
}
|
|
4014
3919
|
case "userFavoriteList": {
|
|
4015
|
-
const urlGenerator = (params) => douyinApiUrls
|
|
3920
|
+
const urlGenerator = (params) => douyinApiUrls.getUserFavoriteList(params);
|
|
4016
3921
|
return await fetchPaginatedData({
|
|
4017
|
-
type: data
|
|
3922
|
+
type: data.methodType,
|
|
4018
3923
|
apiUrlGenerator: urlGenerator,
|
|
4019
3924
|
params: {
|
|
4020
|
-
...data
|
|
4021
|
-
max_cursor: data
|
|
3925
|
+
...data,
|
|
3926
|
+
max_cursor: data.max_cursor
|
|
4022
3927
|
},
|
|
4023
3928
|
maxPageSize: 18,
|
|
4024
3929
|
requestConfig: {
|
|
4025
3930
|
...baseRequestConfig,
|
|
4026
3931
|
headers: {
|
|
4027
3932
|
...baseRequestConfig.headers,
|
|
4028
|
-
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data
|
|
3933
|
+
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data.sec_uid}` }
|
|
4029
3934
|
}
|
|
4030
3935
|
},
|
|
4031
3936
|
signType,
|
|
@@ -4042,20 +3947,20 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4042
3947
|
});
|
|
4043
3948
|
}
|
|
4044
3949
|
case "userRecommendList": {
|
|
4045
|
-
const urlGenerator = (params) => douyinApiUrls
|
|
3950
|
+
const urlGenerator = (params) => douyinApiUrls.getUserRecommendList(params);
|
|
4046
3951
|
return await fetchPaginatedData({
|
|
4047
|
-
type: data
|
|
3952
|
+
type: data.methodType,
|
|
4048
3953
|
apiUrlGenerator: urlGenerator,
|
|
4049
3954
|
params: {
|
|
4050
|
-
...data
|
|
4051
|
-
max_cursor: data
|
|
3955
|
+
...data,
|
|
3956
|
+
max_cursor: data.max_cursor
|
|
4052
3957
|
},
|
|
4053
3958
|
maxPageSize: 18,
|
|
4054
3959
|
requestConfig: {
|
|
4055
3960
|
...baseRequestConfig,
|
|
4056
3961
|
headers: {
|
|
4057
3962
|
...baseRequestConfig.headers,
|
|
4058
|
-
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data
|
|
3963
|
+
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/user/${data.sec_uid}` }
|
|
4059
3964
|
}
|
|
4060
3965
|
},
|
|
4061
3966
|
signType,
|
|
@@ -4072,22 +3977,22 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4072
3977
|
});
|
|
4073
3978
|
}
|
|
4074
3979
|
case "suggestWords": {
|
|
4075
|
-
const url = douyinApiUrls
|
|
3980
|
+
const url = douyinApiUrls.getSuggestWords({ query: data.query });
|
|
4076
3981
|
const customConfig = {
|
|
4077
3982
|
...baseRequestConfig,
|
|
4078
3983
|
headers: {
|
|
4079
3984
|
...baseRequestConfig.headers,
|
|
4080
|
-
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/search/${encodeURIComponent(String(data
|
|
3985
|
+
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://www.douyin.com/search/${encodeURIComponent(String(data.query))}` }
|
|
4081
3986
|
}
|
|
4082
3987
|
};
|
|
4083
|
-
return await GlobalGetData$3(data
|
|
3988
|
+
return await GlobalGetData$3(data.methodType, {
|
|
4084
3989
|
...customConfig,
|
|
4085
3990
|
url: buildSignedUrl(url, signType, userAgent)
|
|
4086
3991
|
});
|
|
4087
3992
|
}
|
|
4088
3993
|
case "search": {
|
|
4089
|
-
const searchType = data
|
|
4090
|
-
const refererUrl = searchType === "user" ? `https://www.douyin.com/search/${encodeURIComponent(String(data
|
|
3994
|
+
const searchType = data.type ?? "general";
|
|
3995
|
+
const refererUrl = searchType === "user" ? `https://www.douyin.com/search/${encodeURIComponent(String(data.query))}?type=user` : searchType === "video" ? `https://www.douyin.com/search/${encodeURIComponent(String(data.query))}?type=video` : `https://www.douyin.com/root/search/${encodeURIComponent(String(data.query))}`;
|
|
4091
3996
|
const customConfig = {
|
|
4092
3997
|
...baseRequestConfig,
|
|
4093
3998
|
headers: {
|
|
@@ -4098,12 +4003,12 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4098
4003
|
const isUserSearch = searchType === "user";
|
|
4099
4004
|
const isVideoSearch = searchType === "video";
|
|
4100
4005
|
return await fetchPaginatedData({
|
|
4101
|
-
type: data
|
|
4102
|
-
apiUrlGenerator: (params) => douyinApiUrls
|
|
4006
|
+
type: data.methodType,
|
|
4007
|
+
apiUrlGenerator: (params) => douyinApiUrls.search(params),
|
|
4103
4008
|
params: {
|
|
4104
|
-
query: data
|
|
4105
|
-
type: data
|
|
4106
|
-
number: data
|
|
4009
|
+
query: data.query,
|
|
4010
|
+
type: data.type,
|
|
4011
|
+
number: data.number ?? 10,
|
|
4107
4012
|
search_id: ""
|
|
4108
4013
|
},
|
|
4109
4014
|
maxPageSize: 15,
|
|
@@ -4154,16 +4059,16 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4154
4059
|
const desc = `抖音${typeStr}搜索返回无有效数据,疑似触发反爬机制,你的抖音Cookie可能已经失效!`;
|
|
4155
4060
|
const warningMessage = `
|
|
4156
4061
|
获取响应数据失败!原因:${logger.yellow(`${typeStr}搜索返回无有效数据,疑似触发反爬机制`)}
|
|
4157
|
-
请求类型:「${data
|
|
4158
|
-
搜索关键词:「${data
|
|
4062
|
+
请求类型:「${data.methodType}」
|
|
4063
|
+
搜索关键词:「${data.query}」
|
|
4159
4064
|
请求URL:${url}
|
|
4160
4065
|
`;
|
|
4161
4066
|
return {
|
|
4162
|
-
code:
|
|
4067
|
+
code: "INVALID_COOKIE",
|
|
4163
4068
|
data: raw,
|
|
4164
4069
|
amagiError: {
|
|
4165
4070
|
errorDescription: desc,
|
|
4166
|
-
requestType: data
|
|
4071
|
+
requestType: data.methodType ?? "未知请求类型",
|
|
4167
4072
|
requestUrl: url
|
|
4168
4073
|
},
|
|
4169
4074
|
amagiMessage: warningMessage
|
|
@@ -4173,8 +4078,8 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4173
4078
|
const desc = `抖音${typeStr}搜索接口第一次请求就返回空数组,可能该关键词无搜索结果或触发风控限制,你的抖音Cookie可能已经失效!`;
|
|
4174
4079
|
const warningMessage = `
|
|
4175
4080
|
获取响应数据失败!原因:${logger.yellow(`${typeStr}搜索接口第一次请求就返回空数组,你的抖音Cookie可能已经失效!`)}
|
|
4176
|
-
请求类型:「${data
|
|
4177
|
-
搜索关键词:「${data
|
|
4081
|
+
请求类型:「${data.methodType}」
|
|
4082
|
+
搜索关键词:「${data.query}」
|
|
4178
4083
|
请求URL:${url}
|
|
4179
4084
|
`;
|
|
4180
4085
|
logger.warn(warningMessage);
|
|
@@ -4182,7 +4087,7 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4182
4087
|
data: raw,
|
|
4183
4088
|
amagiError: {
|
|
4184
4089
|
errorDescription: desc,
|
|
4185
|
-
requestType: data
|
|
4090
|
+
requestType: data.methodType ?? "未知请求类型",
|
|
4186
4091
|
requestUrl: url
|
|
4187
4092
|
},
|
|
4188
4093
|
amagiMessage: warningMessage
|
|
@@ -4203,57 +4108,57 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4203
4108
|
});
|
|
4204
4109
|
}
|
|
4205
4110
|
case "dynamicEmojiList": {
|
|
4206
|
-
const url = douyinApiUrls
|
|
4207
|
-
return await GlobalGetData$3(data
|
|
4111
|
+
const url = douyinApiUrls.getDynamicEmojiList();
|
|
4112
|
+
return await GlobalGetData$3(data.methodType, {
|
|
4208
4113
|
...baseRequestConfig,
|
|
4209
4114
|
url: buildSignedUrl(url, signType, userAgent)
|
|
4210
4115
|
});
|
|
4211
4116
|
}
|
|
4212
4117
|
case "musicInfo": {
|
|
4213
|
-
const url = douyinApiUrls
|
|
4214
|
-
return await GlobalGetData$3(data
|
|
4118
|
+
const url = douyinApiUrls.getMusicInfo({ music_id: data.music_id });
|
|
4119
|
+
return await GlobalGetData$3(data.methodType, {
|
|
4215
4120
|
...baseRequestConfig,
|
|
4216
4121
|
url: buildSignedUrl(url, signType, userAgent)
|
|
4217
4122
|
});
|
|
4218
4123
|
}
|
|
4219
4124
|
case "liveRoomInfo": {
|
|
4220
|
-
let url = douyinApiUrls
|
|
4221
|
-
room_id: data
|
|
4222
|
-
web_rid: data
|
|
4125
|
+
let url = douyinApiUrls.getLiveRoomInfo({
|
|
4126
|
+
room_id: data.room_id,
|
|
4127
|
+
web_rid: data.web_rid
|
|
4223
4128
|
});
|
|
4224
4129
|
const liveCustomConfig = {
|
|
4225
4130
|
...baseRequestConfig,
|
|
4226
4131
|
url: buildSignedUrl(url, signType, userAgent),
|
|
4227
4132
|
headers: {
|
|
4228
4133
|
...baseRequestConfig.headers,
|
|
4229
|
-
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://live.douyin.com/${data
|
|
4134
|
+
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { Referer: `https://live.douyin.com/${data.web_rid}` }
|
|
4230
4135
|
}
|
|
4231
4136
|
};
|
|
4232
|
-
return await GlobalGetData$3(data
|
|
4137
|
+
return await GlobalGetData$3(data.methodType, {
|
|
4233
4138
|
...liveCustomConfig,
|
|
4234
4139
|
url: buildSignedUrl(url, signType, userAgent)
|
|
4235
4140
|
});
|
|
4236
4141
|
}
|
|
4237
4142
|
case "loginQrcode": {
|
|
4238
|
-
const url = douyinApiUrls
|
|
4239
|
-
return await GlobalGetData$3(data
|
|
4143
|
+
const url = douyinApiUrls.getLoginQrcode({ verify_fp: data.verify_fp });
|
|
4144
|
+
return await GlobalGetData$3(data.methodType, {
|
|
4240
4145
|
...baseRequestConfig,
|
|
4241
4146
|
url: buildSignedUrl(url, signType, userAgent)
|
|
4242
4147
|
});
|
|
4243
4148
|
}
|
|
4244
4149
|
case "danmakuList": {
|
|
4245
4150
|
const MAX_SEGMENT_DURATION = 32e3;
|
|
4246
|
-
const startTime = data
|
|
4247
|
-
const endTime = data
|
|
4151
|
+
const startTime = data.start_time ?? 0;
|
|
4152
|
+
const endTime = data.end_time ?? data.duration;
|
|
4248
4153
|
const totalDuration = endTime - startTime;
|
|
4249
4154
|
if (totalDuration <= MAX_SEGMENT_DURATION) {
|
|
4250
|
-
const url = douyinApiUrls
|
|
4251
|
-
aweme_id: data
|
|
4155
|
+
const url = douyinApiUrls.getDanmakuList({
|
|
4156
|
+
aweme_id: data.aweme_id,
|
|
4252
4157
|
start_time: startTime,
|
|
4253
4158
|
end_time: endTime,
|
|
4254
|
-
duration: data
|
|
4159
|
+
duration: data.duration
|
|
4255
4160
|
});
|
|
4256
|
-
return await GlobalGetData$3(data
|
|
4161
|
+
return await GlobalGetData$3(data.methodType, {
|
|
4257
4162
|
...baseRequestConfig,
|
|
4258
4163
|
url: buildSignedUrl(url, signType, userAgent)
|
|
4259
4164
|
});
|
|
@@ -4270,14 +4175,14 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4270
4175
|
}
|
|
4271
4176
|
logger.debug(`弹幕数据需要分${segments.length}段获取,总时长:${totalDuration}ms`);
|
|
4272
4177
|
const segmentPromises = segments.map(async (segment, index) => {
|
|
4273
|
-
const url = douyinApiUrls
|
|
4274
|
-
aweme_id: data
|
|
4178
|
+
const url = douyinApiUrls.getDanmakuList({
|
|
4179
|
+
aweme_id: data.aweme_id,
|
|
4275
4180
|
start_time: segment.start,
|
|
4276
4181
|
end_time: segment.end,
|
|
4277
|
-
duration: data
|
|
4182
|
+
duration: data.duration
|
|
4278
4183
|
});
|
|
4279
4184
|
try {
|
|
4280
|
-
const segmentData = await GlobalGetData$3(`${data
|
|
4185
|
+
const segmentData = await GlobalGetData$3(`${data.methodType}-segment${index + 1}`, {
|
|
4281
4186
|
...baseRequestConfig,
|
|
4282
4187
|
url: buildSignedUrl(url, signType, userAgent)
|
|
4283
4188
|
});
|
|
@@ -4317,15 +4222,15 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
4317
4222
|
return finalDanmakuData;
|
|
4318
4223
|
}
|
|
4319
4224
|
default: {
|
|
4320
|
-
const customUrl = data
|
|
4225
|
+
const customUrl = data.custom_url;
|
|
4321
4226
|
if (typeof customUrl === "string" && customUrl.length > 0) {
|
|
4322
4227
|
const url = buildSignedUrl(customUrl, signType, userAgent);
|
|
4323
|
-
return await GlobalGetData$3(data
|
|
4228
|
+
return await GlobalGetData$3(data.methodType ?? "customRequest", {
|
|
4324
4229
|
...baseRequestConfig,
|
|
4325
4230
|
url
|
|
4326
4231
|
});
|
|
4327
4232
|
}
|
|
4328
|
-
logger.warn(`未知的抖音数据接口:「${logger.red(data
|
|
4233
|
+
logger.warn(`未知的抖音数据接口:「${logger.red(data.methodType)}」`);
|
|
4329
4234
|
return null;
|
|
4330
4235
|
}
|
|
4331
4236
|
}
|
|
@@ -4400,7 +4305,7 @@ const GlobalGetData$3 = async (type, config) => {
|
|
|
4400
4305
|
logger.warn(warningMessage);
|
|
4401
4306
|
const cookieError = new Error(Err.errorDescription);
|
|
4402
4307
|
Object.assign(cookieError, {
|
|
4403
|
-
code:
|
|
4308
|
+
code: "INVALID_COOKIE",
|
|
4404
4309
|
data: result,
|
|
4405
4310
|
amagiError: Err
|
|
4406
4311
|
});
|
|
@@ -4421,7 +4326,7 @@ const GlobalGetData$3 = async (type, config) => {
|
|
|
4421
4326
|
logger.warn(warningMessage);
|
|
4422
4327
|
const filterError = new Error(Err.errorDescription);
|
|
4423
4328
|
Object.assign(filterError, {
|
|
4424
|
-
code:
|
|
4329
|
+
code: "CONTENT_FILTERED",
|
|
4425
4330
|
data: result,
|
|
4426
4331
|
amagiError: Err
|
|
4427
4332
|
});
|
|
@@ -4434,7 +4339,7 @@ const GlobalGetData$3 = async (type, config) => {
|
|
|
4434
4339
|
amagiMessage: warningMessage
|
|
4435
4340
|
};
|
|
4436
4341
|
return {
|
|
4437
|
-
code:
|
|
4342
|
+
code: "UNKNOWN_ERROR",
|
|
4438
4343
|
data: null,
|
|
4439
4344
|
amagiError: {
|
|
4440
4345
|
errorDescription: "未知错误",
|
|
@@ -4473,7 +4378,6 @@ const parseDouyinMultiJson = (raw) => {
|
|
|
4473
4378
|
const filterSearchResponses = (objs) => {
|
|
4474
4379
|
return objs.filter((o) => o && typeof o.cursor === "number" && typeof o.has_more === "number" && Array.isArray(o.data));
|
|
4475
4380
|
};
|
|
4476
|
-
|
|
4477
4381
|
//#endregion
|
|
4478
4382
|
//#region src/model/fetchers/douyin/internal.ts
|
|
4479
4383
|
/**
|
|
@@ -4525,7 +4429,6 @@ async function fetchDouyinInternal(methodType, options, config) {
|
|
|
4525
4429
|
throw new Error(`抖音数据获取失败: ${errorMessage}`);
|
|
4526
4430
|
}
|
|
4527
4431
|
}
|
|
4528
|
-
|
|
4529
4432
|
//#endregion
|
|
4530
4433
|
//#region src/model/fetchers/douyin/comment.ts
|
|
4531
4434
|
/**
|
|
@@ -4573,7 +4476,6 @@ async function fetchCommentReplies(options, cookie, requestConfig) {
|
|
|
4573
4476
|
requestConfig
|
|
4574
4477
|
});
|
|
4575
4478
|
}
|
|
4576
|
-
|
|
4577
4479
|
//#endregion
|
|
4578
4480
|
//#region src/model/fetchers/douyin/misc.ts
|
|
4579
4481
|
/**
|
|
@@ -4670,7 +4572,6 @@ async function fetchDynamicEmojiList(options, cookie, requestConfig) {
|
|
|
4670
4572
|
requestConfig
|
|
4671
4573
|
});
|
|
4672
4574
|
}
|
|
4673
|
-
|
|
4674
4575
|
//#endregion
|
|
4675
4576
|
//#region src/model/fetchers/douyin/search.ts
|
|
4676
4577
|
/**
|
|
@@ -4719,7 +4620,6 @@ async function fetchSuggestWords(options, cookie, requestConfig) {
|
|
|
4719
4620
|
requestConfig
|
|
4720
4621
|
});
|
|
4721
4622
|
}
|
|
4722
|
-
|
|
4723
4623
|
//#endregion
|
|
4724
4624
|
//#region src/model/fetchers/douyin/user.ts
|
|
4725
4625
|
/**
|
|
@@ -4804,7 +4704,6 @@ async function fetchUserRecommendList(options, cookie, requestConfig) {
|
|
|
4804
4704
|
requestConfig
|
|
4805
4705
|
});
|
|
4806
4706
|
}
|
|
4807
|
-
|
|
4808
4707
|
//#endregion
|
|
4809
4708
|
//#region src/model/fetchers/douyin/video.ts
|
|
4810
4709
|
/**
|
|
@@ -4921,7 +4820,6 @@ async function fetchDanmakuList(options, cookie, requestConfig) {
|
|
|
4921
4820
|
requestConfig
|
|
4922
4821
|
});
|
|
4923
4822
|
}
|
|
4924
|
-
|
|
4925
4823
|
//#endregion
|
|
4926
4824
|
//#region src/model/fetchers/douyin/bound.ts
|
|
4927
4825
|
/**
|
|
@@ -4960,7 +4858,6 @@ function createBoundDouyinFetcher(cookie, requestConfig) {
|
|
|
4960
4858
|
fetchDynamicEmojiList: (options, reqConfig) => fetchDynamicEmojiList(options, cookie, reqConfig ?? requestConfig)
|
|
4961
4859
|
};
|
|
4962
4860
|
}
|
|
4963
|
-
|
|
4964
4861
|
//#endregion
|
|
4965
4862
|
//#region src/model/fetchers/douyin/index.ts
|
|
4966
4863
|
/**
|
|
@@ -4998,7 +4895,6 @@ const douyinFetcher = {
|
|
|
4998
4895
|
fetchEmojiList: fetchEmojiList$2,
|
|
4999
4896
|
fetchDynamicEmojiList
|
|
5000
4897
|
};
|
|
5001
|
-
|
|
5002
4898
|
//#endregion
|
|
5003
4899
|
//#region src/platform/kuaishou/API.ts
|
|
5004
4900
|
/**
|
|
@@ -5036,14 +4932,19 @@ var API = class {
|
|
|
5036
4932
|
* @param data - 作品参数
|
|
5037
4933
|
* @returns 请求配置
|
|
5038
4934
|
*/
|
|
5039
|
-
videoWork(data
|
|
4935
|
+
videoWork(data) {
|
|
5040
4936
|
return {
|
|
4937
|
+
/** 接口类型 */
|
|
5041
4938
|
type: "visionVideoDetail",
|
|
4939
|
+
/** 请求url */
|
|
5042
4940
|
url: "https://www.kuaishou.com/graphql",
|
|
4941
|
+
/** 请求参数 */
|
|
5043
4942
|
body: {
|
|
4943
|
+
/** 接口类型 */
|
|
5044
4944
|
operationName: "visionVideoDetail",
|
|
5045
4945
|
variables: {
|
|
5046
|
-
|
|
4946
|
+
/** 作品ID */
|
|
4947
|
+
photoId: data.photoId,
|
|
5047
4948
|
page: "detail"
|
|
5048
4949
|
},
|
|
5049
4950
|
query: "query visionVideoDetail($photoId: String, $type: String, $page: String, $webPageArea: String) {\n visionVideoDetail(photoId: $photoId, type: $type, page: $page, webPageArea: $webPageArea) {\n status\n type\n author {\n id\n name\n following\n headerUrl\n __typename\n }\n photo {\n id\n duration\n caption\n likeCount\n realLikeCount\n coverUrl\n photoUrl\n liked\n timestamp\n expTag\n llsid\n viewCount\n videoRatio\n stereoType\n musicBlocked\n manifest {\n mediaType\n businessType\n version\n adaptationSet {\n id\n duration\n representation {\n id\n defaultSelect\n backupUrl\n codecs\n url\n height\n width\n avgBitrate\n maxBitrate\n m3u8Slice\n qualityType\n qualityLabel\n frameRate\n featureP2sp\n hidden\n disableAdaptive\n __typename\n }\n __typename\n }\n __typename\n }\n manifestH265\n photoH265Url\n coronaCropManifest\n coronaCropManifestH265\n croppedPhotoH265Url\n croppedPhotoUrl\n videoResource\n __typename\n }\n tags {\n type\n name\n __typename\n }\n commentLimit {\n canAddComment\n __typename\n }\n llsid\n danmakuSwitch\n __typename\n }\n}\n"
|
|
@@ -5055,14 +4956,14 @@ var API = class {
|
|
|
5055
4956
|
* @param data - 评论参数
|
|
5056
4957
|
* @returns 请求配置
|
|
5057
4958
|
*/
|
|
5058
|
-
comments(data
|
|
4959
|
+
comments(data) {
|
|
5059
4960
|
return {
|
|
5060
4961
|
type: "commentListQuery",
|
|
5061
4962
|
url: "https://www.kuaishou.com/graphql",
|
|
5062
4963
|
body: {
|
|
5063
4964
|
operationName: "commentListQuery",
|
|
5064
4965
|
variables: {
|
|
5065
|
-
photoId: data
|
|
4966
|
+
photoId: data.photoId,
|
|
5066
4967
|
pcursor: ""
|
|
5067
4968
|
},
|
|
5068
4969
|
query: "query commentListQuery($photoId: String, $pcursor: String) {\n visionCommentList(photoId: $photoId, pcursor: $pcursor) {\n commentCount\n pcursor\n rootComments {\n commentId\n authorId\n authorName\n content\n headurl\n timestamp\n likedCount\n realLikedCount\n liked\n status\n authorLiked\n subCommentCount\n subCommentsPcursor\n subComments {\n commentId\n authorId\n authorName\n content\n headurl\n timestamp\n likedCount\n realLikedCount\n liked\n status\n authorLiked\n replyToUserName\n replyTo\n __typename\n }\n __typename\n }\n __typename\n }\n}\n"
|
|
@@ -5078,10 +4979,10 @@ var API = class {
|
|
|
5078
4979
|
* @param data - 用户主页参数
|
|
5079
4980
|
* @returns 请求配置
|
|
5080
4981
|
*/
|
|
5081
|
-
userInfoById(data
|
|
4982
|
+
userInfoById(data) {
|
|
5082
4983
|
return createKuaishouLiveApiRequest("userInfoById", "/live_api/baseuser/userinfo/byid", {
|
|
5083
4984
|
caver: 2,
|
|
5084
|
-
principalId: data
|
|
4985
|
+
principalId: data.principalId
|
|
5085
4986
|
}, { signPath: "/rest/k/user/info" });
|
|
5086
4987
|
}
|
|
5087
4988
|
/**
|
|
@@ -5089,10 +4990,10 @@ var API = class {
|
|
|
5089
4990
|
* @param data - 用户主页参数
|
|
5090
4991
|
* @returns 请求配置
|
|
5091
4992
|
*/
|
|
5092
|
-
userSensitiveInfo(data
|
|
4993
|
+
userSensitiveInfo(data) {
|
|
5093
4994
|
return createKuaishouLiveApiRequest("userSensitiveInfo", "/live_api/baseuser/userinfo/sensitive", {
|
|
5094
4995
|
caver: 2,
|
|
5095
|
-
principalId: data
|
|
4996
|
+
principalId: data.principalId
|
|
5096
4997
|
}, { signPath: "/rest/k/user/info/sensitive" });
|
|
5097
4998
|
}
|
|
5098
4999
|
/**
|
|
@@ -5100,13 +5001,13 @@ var API = class {
|
|
|
5100
5001
|
* @param data - 用户主页参数
|
|
5101
5002
|
* @returns 请求配置
|
|
5102
5003
|
*/
|
|
5103
|
-
profilePublic(data
|
|
5004
|
+
profilePublic(data) {
|
|
5104
5005
|
return createKuaishouLiveApiRequest("profilePublic", "/live_api/profile/public", {
|
|
5105
5006
|
caver: 2,
|
|
5106
|
-
count: "count" in data
|
|
5007
|
+
count: "count" in data ? data.count ?? 12 : 12,
|
|
5107
5008
|
hasMore: true,
|
|
5108
|
-
pcursor: "pcursor" in data
|
|
5109
|
-
principalId: data
|
|
5009
|
+
pcursor: "pcursor" in data ? data.pcursor ?? "" : "",
|
|
5010
|
+
principalId: data.principalId,
|
|
5110
5011
|
privacy: "public"
|
|
5111
5012
|
}, { signPath: "/rest/k/feed/profile" });
|
|
5112
5013
|
}
|
|
@@ -5119,9 +5020,9 @@ var API = class {
|
|
|
5119
5020
|
* @param data - 用户作品列表参数
|
|
5120
5021
|
* @returns 请求配置
|
|
5121
5022
|
*/
|
|
5122
|
-
userWorkList(data
|
|
5023
|
+
userWorkList(data) {
|
|
5123
5024
|
return {
|
|
5124
|
-
...this.profilePublic(data
|
|
5025
|
+
...this.profilePublic(data),
|
|
5125
5026
|
type: "userWorkList"
|
|
5126
5027
|
};
|
|
5127
5028
|
}
|
|
@@ -5133,13 +5034,13 @@ var API = class {
|
|
|
5133
5034
|
* @param data - 用户主页参数
|
|
5134
5035
|
* @returns 请求配置
|
|
5135
5036
|
*/
|
|
5136
|
-
profilePrivate(data
|
|
5037
|
+
profilePrivate(data) {
|
|
5137
5038
|
return createKuaishouLiveApiRequest("profilePrivate", "/live_api/profile/private", {
|
|
5138
5039
|
caver: 2,
|
|
5139
5040
|
count: 12,
|
|
5140
5041
|
hasMore: true,
|
|
5141
5042
|
pcursor: "",
|
|
5142
|
-
principalId: data
|
|
5043
|
+
principalId: data.principalId,
|
|
5143
5044
|
privacy: "private"
|
|
5144
5045
|
}, { requiresSign: false });
|
|
5145
5046
|
}
|
|
@@ -5149,13 +5050,13 @@ var API = class {
|
|
|
5149
5050
|
* @param data - 用户主页参数
|
|
5150
5051
|
* @returns 请求配置
|
|
5151
5052
|
*/
|
|
5152
|
-
profileLiked(data
|
|
5053
|
+
profileLiked(data) {
|
|
5153
5054
|
return createKuaishouLiveApiRequest("profileLiked", "/live_api/profile/liked", {
|
|
5154
5055
|
caver: 2,
|
|
5155
5056
|
count: 12,
|
|
5156
5057
|
hasMore: true,
|
|
5157
5058
|
pcursor: "",
|
|
5158
|
-
principalId: data
|
|
5059
|
+
principalId: data.principalId,
|
|
5159
5060
|
privacy: "liked"
|
|
5160
5061
|
}, { requiresSign: false });
|
|
5161
5062
|
}
|
|
@@ -5164,11 +5065,11 @@ var API = class {
|
|
|
5164
5065
|
* @param data - 用户主页参数
|
|
5165
5066
|
* @returns 请求配置
|
|
5166
5067
|
*/
|
|
5167
|
-
profileInterestList(data
|
|
5068
|
+
profileInterestList(data) {
|
|
5168
5069
|
return createKuaishouLiveApiRequest("profileInterestList", "/live_api/profile/interestlist", {
|
|
5169
5070
|
caver: 2,
|
|
5170
5071
|
limit: 4,
|
|
5171
|
-
principalId: data
|
|
5072
|
+
principalId: data.principalId
|
|
5172
5073
|
});
|
|
5173
5074
|
}
|
|
5174
5075
|
/**
|
|
@@ -5179,9 +5080,9 @@ var API = class {
|
|
|
5179
5080
|
* @param data - 用户主页参数
|
|
5180
5081
|
* @returns 请求配置
|
|
5181
5082
|
*/
|
|
5182
|
-
playbackList(data
|
|
5083
|
+
playbackList(data) {
|
|
5183
5084
|
return createKuaishouLiveApiRequest("playbackList", "/live_api/playback/list", {
|
|
5184
|
-
principalId: data
|
|
5085
|
+
principalId: data.principalId,
|
|
5185
5086
|
count: 12,
|
|
5186
5087
|
cursor: "",
|
|
5187
5088
|
hasMore: true
|
|
@@ -5243,8 +5144,8 @@ var API = class {
|
|
|
5243
5144
|
* @param authToken - 私密房间等场景下可能需要的 authToken
|
|
5244
5145
|
* @returns 请求配置
|
|
5245
5146
|
*/
|
|
5246
|
-
liveDetail(data
|
|
5247
|
-
const query = { principalId: data
|
|
5147
|
+
liveDetail(data, authToken) {
|
|
5148
|
+
const query = { principalId: data.principalId };
|
|
5248
5149
|
if (authToken?.trim()) query.authToken = authToken.trim();
|
|
5249
5150
|
return createKuaishouLiveApiRequest("liveDetail", "/live_api/liveroom/livedetail", query, { requiresSign: false });
|
|
5250
5151
|
}
|
|
@@ -5326,7 +5227,6 @@ var API = class {
|
|
|
5326
5227
|
* 该对象只负责返回请求描述,不直接发起网络请求。
|
|
5327
5228
|
*/
|
|
5328
5229
|
const kuaishouApiUrls = new API();
|
|
5329
|
-
|
|
5330
5230
|
//#endregion
|
|
5331
5231
|
//#region src/platform/kuaishou/sign/hudr.ts
|
|
5332
5232
|
const KUAISHOU_HUDR_PREFIX = "HUDR_";
|
|
@@ -5520,7 +5420,6 @@ const deriveKuaishouHudrBody = (context) => {
|
|
|
5520
5420
|
nextCount: context.count + 1
|
|
5521
5421
|
};
|
|
5522
5422
|
};
|
|
5523
|
-
|
|
5524
5423
|
//#endregion
|
|
5525
5424
|
//#region src/platform/kuaishou/sign/primitives.ts
|
|
5526
5425
|
const KUAISHOU_BLAKE2S_IV = [
|
|
@@ -5997,7 +5896,6 @@ const transformKuaishouHeHex = (prefixHex, checksumHex) => {
|
|
|
5997
5896
|
output[input.length - 1] = xorKey;
|
|
5998
5897
|
return bytesToLowerHex(output);
|
|
5999
5898
|
};
|
|
6000
|
-
|
|
6001
5899
|
//#endregion
|
|
6002
5900
|
//#region src/platform/kuaishou/sign/he.ts
|
|
6003
5901
|
const KUAISHOU_HE_HEADER_HEX = "4B54";
|
|
@@ -6081,7 +5979,6 @@ const deriveKuaishouPureSignature = (context) => {
|
|
|
6081
5979
|
signResult: `${hudr.full}$HE_${he.finalHex}`
|
|
6082
5980
|
};
|
|
6083
5981
|
};
|
|
6084
|
-
|
|
6085
5982
|
//#endregion
|
|
6086
5983
|
//#region src/platform/kuaishou/sign/helpers.ts
|
|
6087
5984
|
const SIGN_INPUT_SKIP_KEYWORD = "__NS";
|
|
@@ -6170,7 +6067,7 @@ const buildKuaishouHxfalconSignInput = (payload) => {
|
|
|
6170
6067
|
*/
|
|
6171
6068
|
const extractCookieValue = (cookie, key) => {
|
|
6172
6069
|
if (!cookie?.trim()) return "";
|
|
6173
|
-
const pattern =
|
|
6070
|
+
const pattern = new RegExp(`(?:^|;\\s*)${key}=([^;]*)`);
|
|
6174
6071
|
return cookie.match(pattern)?.[1] ?? "";
|
|
6175
6072
|
};
|
|
6176
6073
|
const generateKuaishouAnonymousKwwSeed = () => {
|
|
@@ -6213,7 +6110,6 @@ const deriveKuaishouKww = (cookie) => {
|
|
|
6213
6110
|
if (kwfv1) return kwfv1;
|
|
6214
6111
|
return deriveKuaishouAnonymousKww();
|
|
6215
6112
|
};
|
|
6216
|
-
|
|
6217
6113
|
//#endregion
|
|
6218
6114
|
//#region src/platform/kuaishou/sign/state.ts
|
|
6219
6115
|
const KUAISHOU_DEFAULT_CAT_VERSION = "2";
|
|
@@ -6269,7 +6165,6 @@ const getKuaishouPureRuntimeState = () => {
|
|
|
6269
6165
|
};
|
|
6270
6166
|
return pureRuntimeState;
|
|
6271
6167
|
};
|
|
6272
|
-
|
|
6273
6168
|
//#endregion
|
|
6274
6169
|
//#region src/platform/kuaishou/sign/index.ts
|
|
6275
6170
|
/**
|
|
@@ -6362,7 +6257,6 @@ var kuaishouSign = class {
|
|
|
6362
6257
|
return this.signLiveApiUrl(request.url, cookie, request.signPath);
|
|
6363
6258
|
}
|
|
6364
6259
|
};
|
|
6365
|
-
|
|
6366
6260
|
//#endregion
|
|
6367
6261
|
//#region src/platform/kuaishou/getdata.ts
|
|
6368
6262
|
/**
|
|
@@ -6922,7 +6816,7 @@ const dedupeLiveRoomPlayList = (items) => {
|
|
|
6922
6816
|
* @param requestConfig - 外部请求配置(优先级最高)
|
|
6923
6817
|
* @returns 返回快手数据;当前 user/live 能力已优先走纯协议聚合链路
|
|
6924
6818
|
*/
|
|
6925
|
-
const KuaishouData = async (data
|
|
6819
|
+
const KuaishouData = async (data, cookie, requestConfig) => {
|
|
6926
6820
|
const defHeaders = getKuaishouDefaultConfig(cookie)["headers"];
|
|
6927
6821
|
const baseRequestConfig = {
|
|
6928
6822
|
method: "POST",
|
|
@@ -6960,27 +6854,27 @@ const KuaishouData = async (data$1, cookie, requestConfig) => {
|
|
|
6960
6854
|
const fetchKuaishouLiveApiPayload = (type, request, refererPath, config) => {
|
|
6961
6855
|
return GlobalGetData$2(type, buildLiveApiRequestConfig(request, refererPath, cookie, requestConfig), config);
|
|
6962
6856
|
};
|
|
6963
|
-
switch (data
|
|
6964
|
-
case "videoWork": return fetchKuaishouGraphqlPayload(data
|
|
6965
|
-
case "comments": return fetchKuaishouGraphqlPayload(data
|
|
6857
|
+
switch (data.methodType) {
|
|
6858
|
+
case "videoWork": return fetchKuaishouGraphqlPayload(data.methodType, kuaishouApiUrls.videoWork({ photoId: data.photoId }));
|
|
6859
|
+
case "comments": return fetchKuaishouGraphqlPayload(data.methodType, kuaishouApiUrls.comments({ photoId: data.photoId }));
|
|
6966
6860
|
case "userProfile": {
|
|
6967
|
-
const refererPath = `profile/${encodeURIComponent(data
|
|
6861
|
+
const refererPath = `profile/${encodeURIComponent(data.principalId)}`;
|
|
6968
6862
|
const [userInfoPayload, sensitivePayload, publicPayload, privatePayload, likedPayload, playbackPayload, interestListPayload, interestMaskPayload, categoryConfigPayload, categoryDataPayload, categoryClassifyPayload, liveDetailPayload] = await Promise.all([
|
|
6969
|
-
fetchKuaishouLiveApiPayload(data
|
|
6970
|
-
fetchKuaishouLiveApiPayload(data
|
|
6971
|
-
fetchKuaishouLiveApiPayload(data
|
|
6972
|
-
fetchKuaishouLiveApiPayload(data
|
|
6973
|
-
fetchKuaishouLiveApiPayload(data
|
|
6974
|
-
fetchKuaishouLiveApiPayload(data
|
|
6975
|
-
fetchKuaishouLiveApiPayload(data
|
|
6976
|
-
fetchKuaishouLiveApiPayload(data
|
|
6977
|
-
fetchKuaishouLiveApiPayload(data
|
|
6978
|
-
fetchKuaishouLiveApiPayload(data
|
|
6979
|
-
fetchKuaishouLiveApiPayload(data
|
|
6980
|
-
fetchKuaishouLiveApiPayload(data
|
|
6863
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.userInfoById({ principalId: data.principalId }), refererPath),
|
|
6864
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.userSensitiveInfo({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
6865
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.profilePublic({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
6866
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.profilePrivate({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
6867
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.profileLiked({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
6868
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.playbackList({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
6869
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.profileInterestList({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
6870
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.interestMaskList(), refererPath, { allowResult2: true }),
|
|
6871
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.categoryConfig(), refererPath),
|
|
6872
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.categoryData(), refererPath),
|
|
6873
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.categoryClassify(), refererPath),
|
|
6874
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.liveDetail({ principalId: data.principalId }), refererPath, { allowResult2: true })
|
|
6981
6875
|
]);
|
|
6982
6876
|
if (isErrorDetailLike(userInfoPayload)) return userInfoPayload;
|
|
6983
|
-
const userProfile = createEmptyUserProfileResult(data
|
|
6877
|
+
const userProfile = createEmptyUserProfileResult(data.principalId);
|
|
6984
6878
|
const userInfo = userInfoPayload?.data?.userInfo;
|
|
6985
6879
|
const sensitiveInfo = isErrorDetailLike(sensitivePayload) ? null : sensitivePayload?.data?.sensitiveUserInfo ?? null;
|
|
6986
6880
|
const liveDetailData = resolveKuaishouLiveDetailData(liveDetailPayload);
|
|
@@ -6994,10 +6888,10 @@ const KuaishouData = async (data$1, cookie, requestConfig) => {
|
|
|
6994
6888
|
const nextInterestMask = !isErrorDetailLike(interestMaskPayload) && Array.isArray(interestMaskPayload?.data) ? interestMaskPayload.data : userProfile.interestMask;
|
|
6995
6889
|
return {
|
|
6996
6890
|
...userProfile,
|
|
6997
|
-
principalId: data
|
|
6891
|
+
principalId: data.principalId,
|
|
6998
6892
|
author: {
|
|
6999
6893
|
...userProfile.author,
|
|
7000
|
-
principalId: data
|
|
6894
|
+
principalId: data.principalId,
|
|
7001
6895
|
userInfo: normalizedAuthor,
|
|
7002
6896
|
sensitiveInfo,
|
|
7003
6897
|
followInfo: {},
|
|
@@ -7028,25 +6922,25 @@ const KuaishouData = async (data$1, cookie, requestConfig) => {
|
|
|
7028
6922
|
};
|
|
7029
6923
|
}
|
|
7030
6924
|
case "userWorkList": {
|
|
7031
|
-
const refererPath = `profile/${encodeURIComponent(data
|
|
7032
|
-
const publicPayload = await fetchKuaishouLiveApiPayload(data
|
|
7033
|
-
principalId: data
|
|
7034
|
-
pcursor: data
|
|
7035
|
-
count: data
|
|
6925
|
+
const refererPath = `profile/${encodeURIComponent(data.principalId)}`;
|
|
6926
|
+
const publicPayload = await fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.userWorkList({
|
|
6927
|
+
principalId: data.principalId,
|
|
6928
|
+
pcursor: data.pcursor,
|
|
6929
|
+
count: data.count
|
|
7036
6930
|
}), refererPath, { allowResult2: true });
|
|
7037
6931
|
if (isErrorDetailLike(publicPayload)) return publicPayload;
|
|
7038
|
-
return resolveKuaishouUserWorkList(data
|
|
6932
|
+
return resolveKuaishouUserWorkList(data.principalId, publicPayload);
|
|
7039
6933
|
}
|
|
7040
6934
|
case "liveRoomInfo": {
|
|
7041
|
-
const refererPath = `u/${encodeURIComponent(data
|
|
6935
|
+
const refererPath = `u/${encodeURIComponent(data.principalId)}`;
|
|
7042
6936
|
const [liveDetailPayload, userInfoPayload, sensitivePayload, emojiPayload] = await Promise.all([
|
|
7043
|
-
fetchKuaishouLiveApiPayload(data
|
|
7044
|
-
fetchKuaishouLiveApiPayload(data
|
|
7045
|
-
fetchKuaishouLiveApiPayload(data
|
|
7046
|
-
fetchKuaishouGraphqlPayload(data
|
|
6937
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.liveDetail({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
6938
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.userInfoById({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
6939
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.userSensitiveInfo({ principalId: data.principalId }), refererPath, { allowResult2: true }),
|
|
6940
|
+
fetchKuaishouGraphqlPayload(data.methodType, kuaishouApiUrls.emojiList(), { allowResult2: true })
|
|
7047
6941
|
]);
|
|
7048
6942
|
if (isErrorDetailLike(liveDetailPayload)) return liveDetailPayload;
|
|
7049
|
-
const liveRoomInfo = createEmptyLiveRoomInfoResult(data
|
|
6943
|
+
const liveRoomInfo = createEmptyLiveRoomInfoResult(data.principalId);
|
|
7050
6944
|
const liveDetailData = resolveKuaishouLiveDetailData(liveDetailPayload);
|
|
7051
6945
|
if (!liveDetailData) return liveRoomInfo;
|
|
7052
6946
|
const userInfo = isErrorDetailLike(userInfoPayload) ? void 0 : userInfoPayload?.data?.userInfo;
|
|
@@ -7064,15 +6958,15 @@ const KuaishouData = async (data$1, cookie, requestConfig) => {
|
|
|
7064
6958
|
const shouldFetchWebsocketInfo = liveDetailWebsocketMeta.websocketUrls.length === 0 || !liveDetailWebsocketMeta.token;
|
|
7065
6959
|
const shouldFetchRecommendList = liveDetailRecommendList.length === 0;
|
|
7066
6960
|
const [giftPayload, websocketPayload, recoPayload] = await Promise.all([
|
|
7067
|
-
fetchKuaishouLiveApiPayload(data
|
|
7068
|
-
shouldFetchWebsocketInfo ? fetchKuaishouLiveApiPayload(data
|
|
7069
|
-
shouldFetchRecommendList ? fetchKuaishouLiveApiPayload(data
|
|
6961
|
+
fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.liveGiftList(liveStreamId), refererPath, { allowResult2: true }),
|
|
6962
|
+
shouldFetchWebsocketInfo ? fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.liveWebsocketInfo(liveStreamId), refererPath, { allowResult2: true }) : Promise.resolve(null),
|
|
6963
|
+
shouldFetchRecommendList ? fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.liveReco(currentGameId), refererPath, { allowResult2: true }) : Promise.resolve(null)
|
|
7070
6964
|
]);
|
|
7071
6965
|
const resolvedRecommendList = !isErrorDetailLike(recoPayload) && Array.isArray(recoPayload?.data?.list) ? recoPayload.data.list : liveDetailRecommendList;
|
|
7072
6966
|
const nextPlayList = dedupeLiveRoomPlayList([currentLiveRoomItem, ...Array.isArray(resolvedRecommendList) ? resolvedRecommendList.map((item) => mapRecoItemToLiveRoomPlayItem(item)) : []]);
|
|
7073
6967
|
return {
|
|
7074
6968
|
...liveRoomInfo,
|
|
7075
|
-
principalId: data
|
|
6969
|
+
principalId: data.principalId,
|
|
7076
6970
|
activeIndex: 0,
|
|
7077
6971
|
current: currentLiveRoomItem,
|
|
7078
6972
|
playList: nextPlayList,
|
|
@@ -7090,9 +6984,9 @@ const KuaishouData = async (data$1, cookie, requestConfig) => {
|
|
|
7090
6984
|
}
|
|
7091
6985
|
};
|
|
7092
6986
|
}
|
|
7093
|
-
case "emojiList": return fetchKuaishouGraphqlPayload(data
|
|
6987
|
+
case "emojiList": return fetchKuaishouGraphqlPayload(data.methodType, kuaishouApiUrls.emojiList());
|
|
7094
6988
|
default:
|
|
7095
|
-
logger.warn(`Unknown Kuaishou API method: "${logger.red(data
|
|
6989
|
+
logger.warn(`Unknown Kuaishou API method: "${logger.red(data.methodType)}"`);
|
|
7096
6990
|
return null;
|
|
7097
6991
|
}
|
|
7098
6992
|
};
|
|
@@ -7139,7 +7033,7 @@ const GlobalGetData$2 = async (type, options, config) => {
|
|
|
7139
7033
|
logger.warn(warningMessage);
|
|
7140
7034
|
const cookieError = new Error(Err.errorDescription);
|
|
7141
7035
|
Object.assign(cookieError, {
|
|
7142
|
-
code:
|
|
7036
|
+
code: "INVALID_COOKIE",
|
|
7143
7037
|
data: result,
|
|
7144
7038
|
amagiError: Err
|
|
7145
7039
|
});
|
|
@@ -7152,7 +7046,7 @@ const GlobalGetData$2 = async (type, options, config) => {
|
|
|
7152
7046
|
amagiMessage: warningMessage
|
|
7153
7047
|
};
|
|
7154
7048
|
return {
|
|
7155
|
-
code:
|
|
7049
|
+
code: "UNKNOWN_ERROR",
|
|
7156
7050
|
data: null,
|
|
7157
7051
|
amagiError: {
|
|
7158
7052
|
errorDescription: "未知错误",
|
|
@@ -7163,7 +7057,6 @@ const GlobalGetData$2 = async (type, options, config) => {
|
|
|
7163
7057
|
};
|
|
7164
7058
|
}
|
|
7165
7059
|
};
|
|
7166
|
-
|
|
7167
7060
|
//#endregion
|
|
7168
7061
|
//#region src/model/fetchers/kuaishou/internal.ts
|
|
7169
7062
|
/**
|
|
@@ -7215,7 +7108,6 @@ async function fetchKuaishouInternal(methodType, options, config) {
|
|
|
7215
7108
|
throw new Error(`快手数据获取失败: ${errorMessage}`);
|
|
7216
7109
|
}
|
|
7217
7110
|
}
|
|
7218
|
-
|
|
7219
7111
|
//#endregion
|
|
7220
7112
|
//#region src/model/fetchers/kuaishou/api.ts
|
|
7221
7113
|
/**
|
|
@@ -7320,7 +7212,6 @@ async function fetchEmojiList$1(options, cookie, requestConfig) {
|
|
|
7320
7212
|
requestConfig
|
|
7321
7213
|
});
|
|
7322
7214
|
}
|
|
7323
|
-
|
|
7324
7215
|
//#endregion
|
|
7325
7216
|
//#region src/model/fetchers/kuaishou/index.ts
|
|
7326
7217
|
/**
|
|
@@ -7364,7 +7255,6 @@ function createBoundKuaishouFetcher(cookie, requestConfig) {
|
|
|
7364
7255
|
fetchEmojiList: (options, reqConfig) => fetchEmojiList$1(options, cookie, reqConfig ?? requestConfig)
|
|
7365
7256
|
};
|
|
7366
7257
|
}
|
|
7367
|
-
|
|
7368
7258
|
//#endregion
|
|
7369
7259
|
//#region src/platform/xiaohongshu/getdata.ts
|
|
7370
7260
|
/**
|
|
@@ -7374,7 +7264,7 @@ function createBoundKuaishouFetcher(cookie, requestConfig) {
|
|
|
7374
7264
|
* @param requestConfig - 外部请求配置
|
|
7375
7265
|
* @returns 返回小红书数据
|
|
7376
7266
|
*/
|
|
7377
|
-
const XiaohongshuData = async (data
|
|
7267
|
+
const XiaohongshuData = async (data, cookie, requestConfig) => {
|
|
7378
7268
|
const defHeaders = getXiaohongshuDefaultConfig(cookie)["headers"];
|
|
7379
7269
|
const baseRequestConfig = {
|
|
7380
7270
|
method: "POST",
|
|
@@ -7385,32 +7275,32 @@ const XiaohongshuData = async (data$1, cookie, requestConfig) => {
|
|
|
7385
7275
|
...requestConfig?.headers ?? {}
|
|
7386
7276
|
}
|
|
7387
7277
|
};
|
|
7388
|
-
const xiaohongshuApiUrls
|
|
7389
|
-
switch (data
|
|
7390
|
-
case "homeFeed": return await GlobalGetData$1(data
|
|
7278
|
+
const xiaohongshuApiUrls = createXiaohongshuApiUrls();
|
|
7279
|
+
switch (data.methodType) {
|
|
7280
|
+
case "homeFeed": return await GlobalGetData$1(data.methodType, {
|
|
7391
7281
|
...baseRequestConfig,
|
|
7392
|
-
url: xiaohongshuApiUrls
|
|
7393
|
-
data: JSON.stringify(xiaohongshuApiUrls
|
|
7282
|
+
url: xiaohongshuApiUrls.homeFeed(data).Url,
|
|
7283
|
+
data: JSON.stringify(xiaohongshuApiUrls.homeFeed(data).Body),
|
|
7394
7284
|
headers: {
|
|
7395
7285
|
...baseRequestConfig.headers,
|
|
7396
|
-
"x-s": xiaohongshuSign.generateXSPost(xiaohongshuApiUrls
|
|
7286
|
+
"x-s": xiaohongshuSign.generateXSPost(xiaohongshuApiUrls.homeFeed(data).apiPath, xiaohongshuSign.extractA1FromCookie(cookie ?? ""), "xhs-pc-web", xiaohongshuApiUrls.homeFeed(data).Body),
|
|
7397
7287
|
"x-s-common": xiaohongshuSign.generateXSCommon(cookie ?? ""),
|
|
7398
7288
|
"x-t": xiaohongshuSign.generateXT()
|
|
7399
7289
|
}
|
|
7400
7290
|
});
|
|
7401
|
-
case "noteDetail": return await GlobalGetData$1(data
|
|
7291
|
+
case "noteDetail": return await GlobalGetData$1(data.methodType, {
|
|
7402
7292
|
...baseRequestConfig,
|
|
7403
|
-
url: xiaohongshuApiUrls
|
|
7404
|
-
data: xiaohongshuApiUrls
|
|
7293
|
+
url: xiaohongshuApiUrls.noteDetail(data).Url,
|
|
7294
|
+
data: xiaohongshuApiUrls.noteDetail(data).Body,
|
|
7405
7295
|
headers: {
|
|
7406
7296
|
...baseRequestConfig.headers,
|
|
7407
|
-
"x-s": xiaohongshuSign.generateXSPost(xiaohongshuApiUrls
|
|
7297
|
+
"x-s": xiaohongshuSign.generateXSPost(xiaohongshuApiUrls.noteDetail(data).apiPath, xiaohongshuSign.extractA1FromCookie(cookie ?? ""), "xhs-pc-web", xiaohongshuApiUrls.noteDetail(data).Body),
|
|
7408
7298
|
"x-s-common": xiaohongshuSign.generateXSCommon(cookie ?? ""),
|
|
7409
7299
|
"x-t": xiaohongshuSign.generateXT()
|
|
7410
7300
|
}
|
|
7411
7301
|
});
|
|
7412
7302
|
case "noteComments": {
|
|
7413
|
-
const baseRequestConfig
|
|
7303
|
+
const baseRequestConfig = {
|
|
7414
7304
|
method: "GET",
|
|
7415
7305
|
timeout: 1e4,
|
|
7416
7306
|
...requestConfig,
|
|
@@ -7419,19 +7309,19 @@ const XiaohongshuData = async (data$1, cookie, requestConfig) => {
|
|
|
7419
7309
|
...requestConfig?.headers ?? {}
|
|
7420
7310
|
}
|
|
7421
7311
|
};
|
|
7422
|
-
return await GlobalGetData$1(data
|
|
7423
|
-
...baseRequestConfig
|
|
7424
|
-
url: xiaohongshuApiUrls
|
|
7312
|
+
return await GlobalGetData$1(data.methodType, {
|
|
7313
|
+
...baseRequestConfig,
|
|
7314
|
+
url: xiaohongshuApiUrls.noteComments(data).Url,
|
|
7425
7315
|
headers: {
|
|
7426
|
-
...baseRequestConfig
|
|
7427
|
-
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls
|
|
7316
|
+
...baseRequestConfig.headers,
|
|
7317
|
+
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls.noteComments(data).apiPath, xiaohongshuSign.extractA1FromCookie(cookie ?? ""), "xhs-pc-web"),
|
|
7428
7318
|
"x-s-common": xiaohongshuSign.generateXSCommon(cookie ?? ""),
|
|
7429
7319
|
"x-t": xiaohongshuSign.generateXT()
|
|
7430
7320
|
}
|
|
7431
7321
|
});
|
|
7432
7322
|
}
|
|
7433
7323
|
case "userProfile": {
|
|
7434
|
-
const baseRequestConfig
|
|
7324
|
+
const baseRequestConfig = {
|
|
7435
7325
|
method: "GET",
|
|
7436
7326
|
timeout: 1e4,
|
|
7437
7327
|
...requestConfig,
|
|
@@ -7442,12 +7332,12 @@ const XiaohongshuData = async (data$1, cookie, requestConfig) => {
|
|
|
7442
7332
|
};
|
|
7443
7333
|
return {
|
|
7444
7334
|
code: 0,
|
|
7445
|
-
data: extractCreatorInfoFromHtml(await GlobalGetData$1(data
|
|
7446
|
-
...baseRequestConfig
|
|
7447
|
-
url: xiaohongshuApiUrls
|
|
7335
|
+
data: extractCreatorInfoFromHtml(await GlobalGetData$1(data.methodType, {
|
|
7336
|
+
...baseRequestConfig,
|
|
7337
|
+
url: xiaohongshuApiUrls.userProfile(data).Url,
|
|
7448
7338
|
headers: {
|
|
7449
|
-
...baseRequestConfig
|
|
7450
|
-
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls
|
|
7339
|
+
...baseRequestConfig.headers,
|
|
7340
|
+
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls.userProfile(data).apiPath, xiaohongshuSign.extractA1FromCookie(cookie ?? ""), "xhs-pc-web"),
|
|
7451
7341
|
"x-s-common": xiaohongshuSign.generateXSCommon(cookie ?? ""),
|
|
7452
7342
|
"x-t": xiaohongshuSign.generateXT()
|
|
7453
7343
|
}
|
|
@@ -7455,20 +7345,20 @@ const XiaohongshuData = async (data$1, cookie, requestConfig) => {
|
|
|
7455
7345
|
msg: "success"
|
|
7456
7346
|
};
|
|
7457
7347
|
}
|
|
7458
|
-
case "userNoteList": return await GlobalGetData$1(data
|
|
7348
|
+
case "userNoteList": return await GlobalGetData$1(data.methodType, {
|
|
7459
7349
|
...baseRequestConfig,
|
|
7460
7350
|
method: "GET",
|
|
7461
|
-
url: xiaohongshuApiUrls
|
|
7351
|
+
url: xiaohongshuApiUrls.userNoteList(data).Url,
|
|
7462
7352
|
headers: {
|
|
7463
7353
|
...baseRequestConfig.headers,
|
|
7464
7354
|
"x-b3-traceid": xiaohongshuSign.generateXB3Traceid(),
|
|
7465
|
-
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls
|
|
7355
|
+
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls.userNoteList(data).apiPath, xiaohongshuSign.extractA1FromCookie(cookie ?? ""), "xhs-pc-web"),
|
|
7466
7356
|
"x-s-common": xiaohongshuSign.generateXSCommon(cookie ?? ""),
|
|
7467
7357
|
"x-t": xiaohongshuSign.generateXT()
|
|
7468
7358
|
}
|
|
7469
7359
|
});
|
|
7470
7360
|
case "emojiList": {
|
|
7471
|
-
const baseRequestConfig
|
|
7361
|
+
const baseRequestConfig = {
|
|
7472
7362
|
method: "GET",
|
|
7473
7363
|
timeout: 1e4,
|
|
7474
7364
|
...requestConfig,
|
|
@@ -7477,29 +7367,29 @@ const XiaohongshuData = async (data$1, cookie, requestConfig) => {
|
|
|
7477
7367
|
...requestConfig?.headers ?? {}
|
|
7478
7368
|
}
|
|
7479
7369
|
};
|
|
7480
|
-
return await GlobalGetData$1(data
|
|
7481
|
-
...baseRequestConfig
|
|
7482
|
-
url: xiaohongshuApiUrls
|
|
7370
|
+
return await GlobalGetData$1(data.methodType, {
|
|
7371
|
+
...baseRequestConfig,
|
|
7372
|
+
url: xiaohongshuApiUrls.emojiList(data).Url,
|
|
7483
7373
|
headers: {
|
|
7484
|
-
...baseRequestConfig
|
|
7485
|
-
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls
|
|
7374
|
+
...baseRequestConfig.headers,
|
|
7375
|
+
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls.emojiList(data).apiPath, xiaohongshuSign.extractA1FromCookie(cookie ?? ""), "xhs-pc-web"),
|
|
7486
7376
|
"x-s-common": xiaohongshuSign.generateXSCommon(cookie ?? ""),
|
|
7487
7377
|
"x-t": xiaohongshuSign.generateXT()
|
|
7488
7378
|
}
|
|
7489
7379
|
});
|
|
7490
7380
|
}
|
|
7491
|
-
case "searchNotes": return await GlobalGetData$1(data
|
|
7381
|
+
case "searchNotes": return await GlobalGetData$1(data.methodType, {
|
|
7492
7382
|
...baseRequestConfig,
|
|
7493
|
-
url: xiaohongshuApiUrls
|
|
7494
|
-
data: xiaohongshuApiUrls
|
|
7383
|
+
url: xiaohongshuApiUrls.searchNotes(data).Url,
|
|
7384
|
+
data: xiaohongshuApiUrls.searchNotes(data).Body,
|
|
7495
7385
|
headers: {
|
|
7496
7386
|
...baseRequestConfig.headers,
|
|
7497
|
-
"x-s": xiaohongshuSign.generateXSPost(xiaohongshuApiUrls
|
|
7387
|
+
"x-s": xiaohongshuSign.generateXSPost(xiaohongshuApiUrls.searchNotes(data).apiPath, xiaohongshuSign.extractA1FromCookie(cookie ?? ""), "xhs-pc-web"),
|
|
7498
7388
|
"x-s-common": xiaohongshuSign.generateXSCommon(cookie ?? ""),
|
|
7499
7389
|
"x-t": xiaohongshuSign.generateXT()
|
|
7500
7390
|
}
|
|
7501
7391
|
});
|
|
7502
|
-
default: throw new Error(`Unknown Xiaohongshu API method: "${logger.red(data
|
|
7392
|
+
default: throw new Error(`Unknown Xiaohongshu API method: "${logger.red(data.methodType)}"`);
|
|
7503
7393
|
}
|
|
7504
7394
|
};
|
|
7505
7395
|
/**
|
|
@@ -7538,7 +7428,6 @@ const GlobalGetData$1 = async (methodType, config) => {
|
|
|
7538
7428
|
};
|
|
7539
7429
|
}
|
|
7540
7430
|
};
|
|
7541
|
-
|
|
7542
7431
|
//#endregion
|
|
7543
7432
|
//#region src/model/fetchers/xiaohongshu/internal.ts
|
|
7544
7433
|
/**
|
|
@@ -7549,9 +7438,9 @@ const GlobalGetData$1 = async (methodType, config) => {
|
|
|
7549
7438
|
* 搜索排序类型映射
|
|
7550
7439
|
*/
|
|
7551
7440
|
const sortTypeMapping = {
|
|
7552
|
-
general:
|
|
7553
|
-
time_descending:
|
|
7554
|
-
popularity_descending:
|
|
7441
|
+
general: "general",
|
|
7442
|
+
time_descending: "time_descending",
|
|
7443
|
+
popularity_descending: "popularity_descending"
|
|
7555
7444
|
};
|
|
7556
7445
|
/**
|
|
7557
7446
|
* 小红书 API 内部调用函数
|
|
@@ -7598,7 +7487,6 @@ async function fetchXiaohongshuInternal(methodType, options, config) {
|
|
|
7598
7487
|
throw new Error(`小红书数据获取失败: ${errorMessage}`);
|
|
7599
7488
|
}
|
|
7600
7489
|
}
|
|
7601
|
-
|
|
7602
7490
|
//#endregion
|
|
7603
7491
|
//#region src/model/fetchers/xiaohongshu/misc.ts
|
|
7604
7492
|
/**
|
|
@@ -7620,7 +7508,6 @@ async function fetchEmojiList(options, cookie, requestConfig) {
|
|
|
7620
7508
|
requestConfig
|
|
7621
7509
|
});
|
|
7622
7510
|
}
|
|
7623
|
-
|
|
7624
7511
|
//#endregion
|
|
7625
7512
|
//#region src/model/fetchers/xiaohongshu/note.ts
|
|
7626
7513
|
/**
|
|
@@ -7687,7 +7574,6 @@ async function fetchNoteComments(options, cookie, requestConfig) {
|
|
|
7687
7574
|
requestConfig
|
|
7688
7575
|
});
|
|
7689
7576
|
}
|
|
7690
|
-
|
|
7691
7577
|
//#endregion
|
|
7692
7578
|
//#region src/model/fetchers/xiaohongshu/search.ts
|
|
7693
7579
|
/**
|
|
@@ -7722,7 +7608,6 @@ async function searchNotes(options, cookie, requestConfig) {
|
|
|
7722
7608
|
requestConfig
|
|
7723
7609
|
});
|
|
7724
7610
|
}
|
|
7725
|
-
|
|
7726
7611
|
//#endregion
|
|
7727
7612
|
//#region src/model/fetchers/xiaohongshu/user.ts
|
|
7728
7613
|
/**
|
|
@@ -7763,7 +7648,6 @@ async function fetchUserNoteList(options, cookie, requestConfig) {
|
|
|
7763
7648
|
requestConfig
|
|
7764
7649
|
});
|
|
7765
7650
|
}
|
|
7766
|
-
|
|
7767
7651
|
//#endregion
|
|
7768
7652
|
//#region src/model/fetchers/xiaohongshu/index.ts
|
|
7769
7653
|
/**
|
|
@@ -7813,7 +7697,6 @@ function createBoundXiaohongshuFetcher(cookie, requestConfig) {
|
|
|
7813
7697
|
fetchEmojiList: (options, reqConfig) => fetchEmojiList(options, cookie, reqConfig ?? requestConfig)
|
|
7814
7698
|
};
|
|
7815
7699
|
}
|
|
7816
|
-
|
|
7817
7700
|
//#endregion
|
|
7818
7701
|
//#region src/model/networks.ts
|
|
7819
7702
|
/** 可恢复的错误代码列表 */
|
|
@@ -7855,7 +7738,7 @@ const createNetworkErrorResult = (error, retries) => {
|
|
|
7855
7738
|
const errorCode = error.code ?? "UNKNOWN";
|
|
7856
7739
|
const message = `网络请求失败 [${errorCode}]: ${error.message} (已重试 ${retries} 次)`;
|
|
7857
7740
|
return createErrorResponse({
|
|
7858
|
-
code:
|
|
7741
|
+
code: "UNKNOWN_ERROR",
|
|
7859
7742
|
data: null,
|
|
7860
7743
|
amagiError: {
|
|
7861
7744
|
errorDescription: `${error.message} (已重试 ${retries} 次)`,
|
|
@@ -7992,7 +7875,6 @@ const getHeadersAndData = async (config, maxRetries = DEFAULT_MAX_RETRIES) => {
|
|
|
7992
7875
|
data: response.data
|
|
7993
7876
|
};
|
|
7994
7877
|
};
|
|
7995
|
-
|
|
7996
7878
|
//#endregion
|
|
7997
7879
|
//#region src/model/logger.ts
|
|
7998
7880
|
/**
|
|
@@ -8093,7 +7975,6 @@ const logMiddleware = (pathsToLog) => {
|
|
|
8093
7975
|
next();
|
|
8094
7976
|
};
|
|
8095
7977
|
};
|
|
8096
|
-
|
|
8097
7978
|
//#endregion
|
|
8098
7979
|
//#region src/platform/bilibili/qtparam.ts
|
|
8099
7980
|
/**
|
|
@@ -8139,7 +8020,6 @@ const qtparam = async (BASEURL, cookie) => {
|
|
|
8139
8020
|
isvip
|
|
8140
8021
|
};
|
|
8141
8022
|
};
|
|
8142
|
-
|
|
8143
8023
|
//#endregion
|
|
8144
8024
|
//#region src/platform/bilibili/sign/bv2av.ts
|
|
8145
8025
|
const XOR_CODE = 23442827791579n;
|
|
@@ -8191,7 +8071,6 @@ const bv2av = (bvid) => {
|
|
|
8191
8071
|
const tmp = bvidArr.reduce((pre, bvidChar) => pre * BASE + BigInt(data.indexOf(bvidChar)), 0n);
|
|
8192
8072
|
return Number(tmp & MASK_CODE ^ XOR_CODE);
|
|
8193
8073
|
};
|
|
8194
|
-
|
|
8195
8074
|
//#endregion
|
|
8196
8075
|
//#region src/platform/bilibili/sign/danmaku_proto.ts
|
|
8197
8076
|
/**
|
|
@@ -8277,16 +8156,15 @@ function getProtoType() {
|
|
|
8277
8156
|
* @param data - 二进制 protobuf 数据
|
|
8278
8157
|
* @returns 解析后的弹幕数据
|
|
8279
8158
|
*/
|
|
8280
|
-
function parseDmSegMobileReply(data
|
|
8159
|
+
function parseDmSegMobileReply(data) {
|
|
8281
8160
|
const messageType = getProtoType();
|
|
8282
|
-
const buffer = data
|
|
8161
|
+
const buffer = data instanceof Uint8Array ? data : new Uint8Array(data);
|
|
8283
8162
|
const message = messageType.decode(buffer);
|
|
8284
8163
|
return messageType.toObject(message, {
|
|
8285
8164
|
longs: String,
|
|
8286
8165
|
defaults: true
|
|
8287
8166
|
});
|
|
8288
8167
|
}
|
|
8289
|
-
|
|
8290
8168
|
//#endregion
|
|
8291
8169
|
//#region src/platform/bilibili/sign/wbi.ts
|
|
8292
8170
|
/**
|
|
@@ -8409,7 +8287,6 @@ const wbi_sign = async (BASEURL, cookie) => {
|
|
|
8409
8287
|
for (const [key, value] of url.searchParams.entries()) params[key] = value;
|
|
8410
8288
|
return encWbi(params, web_keys.img_key, web_keys.sub_key);
|
|
8411
8289
|
};
|
|
8412
|
-
|
|
8413
8290
|
//#endregion
|
|
8414
8291
|
//#region src/platform/bilibili/getdata.ts
|
|
8415
8292
|
/**
|
|
@@ -8430,28 +8307,28 @@ const wbi_sign = async (BASEURL, cookie) => {
|
|
|
8430
8307
|
* @param requestConfig - 外部请求配置(优先级最高)
|
|
8431
8308
|
* @returns 返回B站数据
|
|
8432
8309
|
*/
|
|
8433
|
-
const fetchBilibili = async (data
|
|
8310
|
+
const fetchBilibili = async (data, cookie, requestConfig) => {
|
|
8434
8311
|
const baseRequestConfig = getBilibiliDefaultConfig(cookie, requestConfig);
|
|
8435
|
-
switch (data
|
|
8436
|
-
case "videoInfo": return await GlobalGetData(data
|
|
8312
|
+
switch (data.methodType) {
|
|
8313
|
+
case "videoInfo": return await GlobalGetData(data.methodType, {
|
|
8437
8314
|
...baseRequestConfig,
|
|
8438
|
-
url: bilibiliApiUrls.getVideoInfo({ bvid: data
|
|
8315
|
+
url: bilibiliApiUrls.getVideoInfo({ bvid: data.bvid })
|
|
8439
8316
|
});
|
|
8440
8317
|
case "videoStream": {
|
|
8441
8318
|
const sign = await qtparam(bilibiliApiUrls.getVideoStream({
|
|
8442
|
-
avid: data
|
|
8443
|
-
cid: data
|
|
8319
|
+
avid: data.avid,
|
|
8320
|
+
cid: data.cid
|
|
8444
8321
|
}), baseRequestConfig.headers?.Cookie);
|
|
8445
|
-
return await GlobalGetData(data
|
|
8322
|
+
return await GlobalGetData(data.methodType, {
|
|
8446
8323
|
...baseRequestConfig,
|
|
8447
8324
|
url: bilibiliApiUrls.getVideoStream({
|
|
8448
|
-
avid: data
|
|
8449
|
-
cid: data
|
|
8325
|
+
avid: data.avid,
|
|
8326
|
+
cid: data.cid
|
|
8450
8327
|
}) + sign.QUERY
|
|
8451
8328
|
});
|
|
8452
8329
|
}
|
|
8453
8330
|
case "comments": {
|
|
8454
|
-
let { oid, number, type, mode, pagination_str, plat, seek_rpid, web_location } = data
|
|
8331
|
+
let { oid, number, type, mode, pagination_str, plat, seek_rpid, web_location } = data;
|
|
8455
8332
|
let fetchedComments = [];
|
|
8456
8333
|
const maxRequestCount = 100;
|
|
8457
8334
|
let requestCount = 0;
|
|
@@ -8462,7 +8339,7 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8462
8339
|
oid,
|
|
8463
8340
|
type
|
|
8464
8341
|
});
|
|
8465
|
-
if ((await GlobalGetData(data
|
|
8342
|
+
if ((await GlobalGetData(data.methodType, {
|
|
8466
8343
|
...baseRequestConfig,
|
|
8467
8344
|
url: checkStatusUrl
|
|
8468
8345
|
})).data === null) {
|
|
@@ -8484,7 +8361,7 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8484
8361
|
web_location: web_location ?? "1315875"
|
|
8485
8362
|
});
|
|
8486
8363
|
const finalUrl = baseUrl + await wbi_sign(baseUrl, baseRequestConfig.headers?.cookie);
|
|
8487
|
-
const response = await GlobalGetData(data
|
|
8364
|
+
const response = await GlobalGetData(data.methodType, {
|
|
8488
8365
|
...baseRequestConfig,
|
|
8489
8366
|
url: finalUrl
|
|
8490
8367
|
});
|
|
@@ -8505,43 +8382,43 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8505
8382
|
...tmpresp,
|
|
8506
8383
|
data: {
|
|
8507
8384
|
...tmpresp.data,
|
|
8508
|
-
replies: Array.from(new Map(fetchedComments.map((item) => [item.rpid, item])).values()).slice(0, Number(data
|
|
8385
|
+
replies: Array.from(new Map(fetchedComments.map((item) => [item.rpid, item])).values()).slice(0, Number(data.number ?? 20))
|
|
8509
8386
|
}
|
|
8510
8387
|
};
|
|
8511
8388
|
}
|
|
8512
|
-
case "commentReplies": return await GlobalGetData(data
|
|
8389
|
+
case "commentReplies": return await GlobalGetData(data.methodType, {
|
|
8513
8390
|
...baseRequestConfig,
|
|
8514
|
-
url: bilibiliApiUrls.getCommentReplies(data
|
|
8391
|
+
url: bilibiliApiUrls.getCommentReplies(data)
|
|
8515
8392
|
});
|
|
8516
|
-
case "emojiList": return await GlobalGetData(data
|
|
8393
|
+
case "emojiList": return await GlobalGetData(data.methodType, {
|
|
8517
8394
|
...baseRequestConfig,
|
|
8518
8395
|
url: bilibiliApiUrls.getEmojiList()
|
|
8519
8396
|
});
|
|
8520
8397
|
case "bangumiInfo": {
|
|
8521
|
-
let id = data
|
|
8398
|
+
let id = data.ep_id ?? data.season_id;
|
|
8522
8399
|
if (!id) return false;
|
|
8523
8400
|
const idType = id ? id.startsWith("ep") ? "ep_id" : "season_id" : "ep_id";
|
|
8524
8401
|
const newId = idType === "ep_id" ? id.replace("ep", "") : id.replace("ss", "");
|
|
8525
|
-
return await GlobalGetData(data
|
|
8402
|
+
return await GlobalGetData(data.methodType, {
|
|
8526
8403
|
...baseRequestConfig,
|
|
8527
8404
|
url: bilibiliApiUrls.getBangumiInfo({ [idType]: newId })
|
|
8528
8405
|
});
|
|
8529
8406
|
}
|
|
8530
8407
|
case "bangumiStream": {
|
|
8531
8408
|
const sign = await qtparam(bilibiliApiUrls.getBangumiStream({
|
|
8532
|
-
cid: data
|
|
8533
|
-
ep_id: data
|
|
8409
|
+
cid: data.cid,
|
|
8410
|
+
ep_id: data.ep_id.replace("ep", "")
|
|
8534
8411
|
}), baseRequestConfig.headers?.cookie);
|
|
8535
|
-
return await GlobalGetData(data
|
|
8412
|
+
return await GlobalGetData(data.methodType, {
|
|
8536
8413
|
...baseRequestConfig,
|
|
8537
8414
|
url: bilibiliApiUrls.getBangumiStream({
|
|
8538
|
-
cid: data
|
|
8539
|
-
ep_id: data
|
|
8415
|
+
cid: data.cid,
|
|
8416
|
+
ep_id: data.ep_id.replace("ep", "")
|
|
8540
8417
|
}) + sign.QUERY
|
|
8541
8418
|
});
|
|
8542
8419
|
}
|
|
8543
8420
|
case "userDynamicList": {
|
|
8544
|
-
const { host_mid } = data
|
|
8421
|
+
const { host_mid } = data;
|
|
8545
8422
|
const hasExternalReferer = requestConfig?.headers && ("referer" in requestConfig.headers || "Referer" in requestConfig.headers);
|
|
8546
8423
|
const customHeaders = {
|
|
8547
8424
|
...baseRequestConfig.headers,
|
|
@@ -8549,7 +8426,7 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8549
8426
|
...!hasExternalReferer && { Referer: `https://space.bilibili.com/${host_mid}/dynamic` }
|
|
8550
8427
|
};
|
|
8551
8428
|
const wbiSignQuery = await wbi_sign(bilibiliApiUrls.getUserDynamicList({ host_mid }), baseRequestConfig.headers?.cookie);
|
|
8552
|
-
return await GlobalGetData(data
|
|
8429
|
+
return await GlobalGetData(data.methodType, {
|
|
8553
8430
|
...baseRequestConfig,
|
|
8554
8431
|
headers: customHeaders,
|
|
8555
8432
|
url: bilibiliApiUrls.getUserDynamicList({ host_mid }) + wbiSignQuery
|
|
@@ -8561,55 +8438,48 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8561
8438
|
...baseRequestConfig.headers,
|
|
8562
8439
|
...!hasExternalReferer && { Referer: void 0 }
|
|
8563
8440
|
};
|
|
8564
|
-
return await GlobalGetData(data
|
|
8441
|
+
return await GlobalGetData(data.methodType, {
|
|
8565
8442
|
...baseRequestConfig,
|
|
8566
8443
|
headers: customHeaders,
|
|
8567
|
-
url: bilibiliApiUrls.getDynamicDetail({ dynamic_id: data
|
|
8568
|
-
});
|
|
8569
|
-
}
|
|
8570
|
-
case "dynamicCard": {
|
|
8571
|
-
const { dynamic_id } = data$1;
|
|
8572
|
-
const hasExternalReferer = requestConfig?.headers && "referer" in requestConfig.headers;
|
|
8573
|
-
const customHeaders = {
|
|
8574
|
-
...baseRequestConfig.headers,
|
|
8575
|
-
...!hasExternalReferer && { Referer: void 0 }
|
|
8576
|
-
};
|
|
8577
|
-
return await GlobalGetData(data$1.methodType, {
|
|
8578
|
-
...baseRequestConfig,
|
|
8579
|
-
headers: customHeaders,
|
|
8580
|
-
url: bilibiliApiUrls.getDynamicCard({ dynamic_id })
|
|
8444
|
+
url: bilibiliApiUrls.getDynamicDetail({ dynamic_id: data.dynamic_id })
|
|
8581
8445
|
});
|
|
8582
8446
|
}
|
|
8447
|
+
case "dynamicCard": return {
|
|
8448
|
+
code: -404,
|
|
8449
|
+
message: "接口已停用:B站官方已于 `2025-08-09` 删除 dynamic_svr 接口,fetchDynamicCard 方法已废弃,调用讲返回错误信息",
|
|
8450
|
+
ttl: 1,
|
|
8451
|
+
data: null
|
|
8452
|
+
};
|
|
8583
8453
|
case "userCard": {
|
|
8584
|
-
const { host_mid } = data
|
|
8585
|
-
return await GlobalGetData(data
|
|
8454
|
+
const { host_mid } = data;
|
|
8455
|
+
return await GlobalGetData(data.methodType, {
|
|
8586
8456
|
...baseRequestConfig,
|
|
8587
8457
|
url: bilibiliApiUrls.getUserCard({ host_mid })
|
|
8588
8458
|
});
|
|
8589
8459
|
}
|
|
8590
8460
|
case "userSpaceInfo": {
|
|
8591
|
-
const wbiSignQuery = await wbi_sign(bilibiliApiUrls.getUserSpaceInfo({ host_mid: data
|
|
8592
|
-
return await GlobalGetData(data
|
|
8461
|
+
const wbiSignQuery = await wbi_sign(bilibiliApiUrls.getUserSpaceInfo({ host_mid: data.host_mid }), baseRequestConfig.headers?.cookie);
|
|
8462
|
+
return await GlobalGetData(data.methodType, {
|
|
8593
8463
|
...baseRequestConfig,
|
|
8594
|
-
url: bilibiliApiUrls.getUserSpaceInfo({ host_mid: data
|
|
8464
|
+
url: bilibiliApiUrls.getUserSpaceInfo({ host_mid: data.host_mid }) + wbiSignQuery
|
|
8595
8465
|
});
|
|
8596
8466
|
}
|
|
8597
|
-
case "liveRoomInfo": return await GlobalGetData(data
|
|
8467
|
+
case "liveRoomInfo": return await GlobalGetData(data.methodType, {
|
|
8598
8468
|
...baseRequestConfig,
|
|
8599
|
-
url: bilibiliApiUrls.getLiveRoomInfo({ room_id: data
|
|
8469
|
+
url: bilibiliApiUrls.getLiveRoomInfo({ room_id: data.room_id })
|
|
8600
8470
|
});
|
|
8601
|
-
case "liveRoomInit": return await GlobalGetData(data
|
|
8471
|
+
case "liveRoomInit": return await GlobalGetData(data.methodType, {
|
|
8602
8472
|
...baseRequestConfig,
|
|
8603
|
-
url: bilibiliApiUrls.getLiveRoomInit({ room_id: data
|
|
8473
|
+
url: bilibiliApiUrls.getLiveRoomInit({ room_id: data.room_id })
|
|
8604
8474
|
});
|
|
8605
|
-
case "loginQrcode": return await GlobalGetData(data
|
|
8475
|
+
case "loginQrcode": return await GlobalGetData(data.methodType, {
|
|
8606
8476
|
...baseRequestConfig,
|
|
8607
8477
|
url: bilibiliApiUrls.getLoginQrcode()
|
|
8608
8478
|
});
|
|
8609
8479
|
case "qrcodeStatus": try {
|
|
8610
8480
|
const result = await getHeadersAndData({
|
|
8611
8481
|
...baseRequestConfig,
|
|
8612
|
-
url: bilibiliApiUrls.getQrcodeStatus({ qrcode_key: data
|
|
8482
|
+
url: bilibiliApiUrls.getQrcodeStatus({ qrcode_key: data.qrcode_key })
|
|
8613
8483
|
});
|
|
8614
8484
|
if (isNetworkErrorResult(result)) {
|
|
8615
8485
|
const networkError = new Error(result.error.amagiError.errorDescription);
|
|
@@ -8618,7 +8488,7 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8618
8488
|
data: null,
|
|
8619
8489
|
amagiError: {
|
|
8620
8490
|
...result.error.amagiError,
|
|
8621
|
-
requestType: data
|
|
8491
|
+
requestType: data.methodType
|
|
8622
8492
|
}
|
|
8623
8493
|
});
|
|
8624
8494
|
throw networkError;
|
|
@@ -8626,8 +8496,8 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8626
8496
|
if (result.data.code !== 0) {
|
|
8627
8497
|
const Err = {
|
|
8628
8498
|
errorDescription: `获取响应数据失败!原因:${bilibiliErrorCodeMap[String(result.data.code)] || result.data.message || "未知错误"}!`,
|
|
8629
|
-
requestType: data
|
|
8630
|
-
requestUrl: bilibiliApiUrls.getQrcodeStatus({ qrcode_key: data
|
|
8499
|
+
requestType: data.methodType,
|
|
8500
|
+
requestUrl: bilibiliApiUrls.getQrcodeStatus({ qrcode_key: data.qrcode_key })
|
|
8631
8501
|
};
|
|
8632
8502
|
return {
|
|
8633
8503
|
code: result.data.code,
|
|
@@ -8646,65 +8516,65 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8646
8516
|
} catch (error) {
|
|
8647
8517
|
if (error && typeof error === "object") return error;
|
|
8648
8518
|
return {
|
|
8649
|
-
code:
|
|
8519
|
+
code: "UNKNOWN_ERROR",
|
|
8650
8520
|
data: error.data,
|
|
8651
8521
|
amagiError: {
|
|
8652
8522
|
errorDescription: "未知错误",
|
|
8653
|
-
requestType: data
|
|
8654
|
-
requestUrl: bilibiliApiUrls.getQrcodeStatus({ qrcode_key: data
|
|
8523
|
+
requestType: data.methodType,
|
|
8524
|
+
requestUrl: bilibiliApiUrls.getQrcodeStatus({ qrcode_key: data.qrcode_key })
|
|
8655
8525
|
}
|
|
8656
8526
|
};
|
|
8657
8527
|
}
|
|
8658
|
-
case "loginStatus": return await GlobalGetData(data
|
|
8528
|
+
case "loginStatus": return await GlobalGetData(data.methodType, {
|
|
8659
8529
|
...baseRequestConfig,
|
|
8660
8530
|
url: bilibiliApiUrls.getLoginStatus()
|
|
8661
8531
|
});
|
|
8662
|
-
case "uploaderTotalViews": return await GlobalGetData(data
|
|
8532
|
+
case "uploaderTotalViews": return await GlobalGetData(data.methodType, {
|
|
8663
8533
|
...baseRequestConfig,
|
|
8664
|
-
url: bilibiliApiUrls.getUploaderTotalViews({ host_mid: data
|
|
8534
|
+
url: bilibiliApiUrls.getUploaderTotalViews({ host_mid: data.host_mid })
|
|
8665
8535
|
});
|
|
8666
8536
|
case "avToBv": return {
|
|
8667
8537
|
code: 0,
|
|
8668
8538
|
message: "success",
|
|
8669
|
-
data: { bvid: av2bv(Number(data
|
|
8539
|
+
data: { bvid: av2bv(Number(data.avid.toString().replace(/^av/i, ""))) }
|
|
8670
8540
|
};
|
|
8671
8541
|
case "bvToAv": return {
|
|
8672
8542
|
code: 0,
|
|
8673
8543
|
message: "success",
|
|
8674
|
-
data: { aid: "av" + bv2av(data
|
|
8544
|
+
data: { aid: "av" + bv2av(data.bvid) }
|
|
8675
8545
|
};
|
|
8676
|
-
case "articleContent": return await GlobalGetData(data
|
|
8546
|
+
case "articleContent": return await GlobalGetData(data.methodType, {
|
|
8677
8547
|
...baseRequestConfig,
|
|
8678
|
-
url: bilibiliApiUrls.getArticleContent({ id: data
|
|
8548
|
+
url: bilibiliApiUrls.getArticleContent({ id: data.id })
|
|
8679
8549
|
});
|
|
8680
|
-
case "articleCards": return await GlobalGetData(data
|
|
8550
|
+
case "articleCards": return await GlobalGetData(data.methodType, {
|
|
8681
8551
|
...baseRequestConfig,
|
|
8682
|
-
url: bilibiliApiUrls.getArticleCards({ ids: data
|
|
8552
|
+
url: bilibiliApiUrls.getArticleCards({ ids: data.ids })
|
|
8683
8553
|
});
|
|
8684
|
-
case "articleInfo": return await GlobalGetData(data
|
|
8554
|
+
case "articleInfo": return await GlobalGetData(data.methodType, {
|
|
8685
8555
|
...baseRequestConfig,
|
|
8686
|
-
url: bilibiliApiUrls.getArticleInfo({ id: data
|
|
8556
|
+
url: bilibiliApiUrls.getArticleInfo({ id: data.id })
|
|
8687
8557
|
});
|
|
8688
|
-
case "articleListInfo": return await GlobalGetData(data
|
|
8558
|
+
case "articleListInfo": return await GlobalGetData(data.methodType, {
|
|
8689
8559
|
...baseRequestConfig,
|
|
8690
|
-
url: bilibiliApiUrls.getArticleListInfo({ id: data
|
|
8560
|
+
url: bilibiliApiUrls.getArticleListInfo({ id: data.id })
|
|
8691
8561
|
});
|
|
8692
|
-
case "captchaFromVoucher": return await GlobalGetData(data
|
|
8562
|
+
case "captchaFromVoucher": return await GlobalGetData(data.methodType, {
|
|
8693
8563
|
...baseRequestConfig,
|
|
8694
8564
|
method: "POST",
|
|
8695
|
-
url: bilibiliApiUrls.getCaptchaFromVoucher(data
|
|
8696
|
-
data: bilibiliApiUrls.getCaptchaFromVoucher(data
|
|
8565
|
+
url: bilibiliApiUrls.getCaptchaFromVoucher(data).Url,
|
|
8566
|
+
data: bilibiliApiUrls.getCaptchaFromVoucher(data).Body
|
|
8697
8567
|
});
|
|
8698
|
-
case "validateCaptcha": return await GlobalGetData(data
|
|
8568
|
+
case "validateCaptcha": return await GlobalGetData(data.methodType, {
|
|
8699
8569
|
...baseRequestConfig,
|
|
8700
8570
|
method: "POST",
|
|
8701
|
-
url: bilibiliApiUrls.validateCaptcha(data
|
|
8702
|
-
data: bilibiliApiUrls.validateCaptcha(data
|
|
8571
|
+
url: bilibiliApiUrls.validateCaptcha(data).Url,
|
|
8572
|
+
data: bilibiliApiUrls.validateCaptcha(data).Body
|
|
8703
8573
|
});
|
|
8704
8574
|
case "videoDanmaku": {
|
|
8705
8575
|
const url = bilibiliApiUrls.getVideoDanmaku({
|
|
8706
|
-
cid: data
|
|
8707
|
-
segment_index: data
|
|
8576
|
+
cid: data.cid,
|
|
8577
|
+
segment_index: data.segment_index
|
|
8708
8578
|
});
|
|
8709
8579
|
try {
|
|
8710
8580
|
const response = await fetchData({
|
|
@@ -8719,7 +8589,7 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8719
8589
|
data: null,
|
|
8720
8590
|
amagiError: {
|
|
8721
8591
|
...response.error.amagiError,
|
|
8722
|
-
requestType: data
|
|
8592
|
+
requestType: data.methodType
|
|
8723
8593
|
}
|
|
8724
8594
|
});
|
|
8725
8595
|
throw networkError;
|
|
@@ -8731,20 +8601,19 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
8731
8601
|
};
|
|
8732
8602
|
} catch (error) {
|
|
8733
8603
|
if (error && typeof error === "object" && "code" in error) return error;
|
|
8734
|
-
const Err = {
|
|
8735
|
-
errorDescription: `获取弹幕数据失败:${error instanceof Error ? error.message : "未知错误"}`,
|
|
8736
|
-
requestType: data$1.methodType,
|
|
8737
|
-
requestUrl: url
|
|
8738
|
-
};
|
|
8739
8604
|
return {
|
|
8740
|
-
code:
|
|
8605
|
+
code: "UNKNOWN_ERROR",
|
|
8741
8606
|
data: null,
|
|
8742
|
-
amagiError:
|
|
8607
|
+
amagiError: {
|
|
8608
|
+
errorDescription: `获取弹幕数据失败:${error instanceof Error ? error.message : "未知错误"}`,
|
|
8609
|
+
requestType: data.methodType,
|
|
8610
|
+
requestUrl: url
|
|
8611
|
+
}
|
|
8743
8612
|
};
|
|
8744
8613
|
}
|
|
8745
8614
|
}
|
|
8746
8615
|
default:
|
|
8747
|
-
logger.warn(`未知的B站数据接口:「${logger.red(data
|
|
8616
|
+
logger.warn(`未知的B站数据接口:「${logger.red(data.methodType)}」`);
|
|
8748
8617
|
return null;
|
|
8749
8618
|
}
|
|
8750
8619
|
};
|
|
@@ -8787,15 +8656,18 @@ const GlobalGetData = async (type, options, retryCount = 0) => {
|
|
|
8787
8656
|
logger.warn(warningMessage);
|
|
8788
8657
|
const riskError = new Error(Err.errorDescription);
|
|
8789
8658
|
Object.assign(riskError, {
|
|
8790
|
-
code:
|
|
8659
|
+
code: "-352",
|
|
8791
8660
|
data: result,
|
|
8792
8661
|
amagiError: Err
|
|
8793
8662
|
});
|
|
8794
8663
|
throw riskError;
|
|
8795
8664
|
}
|
|
8796
|
-
|
|
8665
|
+
const payload = "data" in result ? result.data : "result" in result ? result.result : void 0;
|
|
8666
|
+
const hasPayload = payload !== null && payload !== void 0;
|
|
8667
|
+
const isEmptyObjectPayload = typeof payload === "object" && !Array.isArray(payload) && Object.keys(payload).length === 0;
|
|
8668
|
+
if (result.code !== 0 || !hasPayload || isEmptyObjectPayload) {
|
|
8797
8669
|
if (result.code === -412 && retryCount < MAX_RETRIES) return await GlobalGetData(type, options, retryCount + 1);
|
|
8798
|
-
const errorMessage = bilibiliErrorCodeMap[result.code] ||
|
|
8670
|
+
const errorMessage = bilibiliErrorCodeMap[result.code] || isEmptyObjectPayload && "请求成功但无返回内容" || (result.message ?? "未知错误");
|
|
8799
8671
|
const Err = {
|
|
8800
8672
|
errorDescription: `获取响应数据失败!原因:${errorMessage}!`,
|
|
8801
8673
|
requestType: type ?? "未知请求类型",
|
|
@@ -8824,7 +8696,7 @@ const GlobalGetData = async (type, options, retryCount = 0) => {
|
|
|
8824
8696
|
amagiMessage: warningMessage
|
|
8825
8697
|
};
|
|
8826
8698
|
return {
|
|
8827
|
-
code:
|
|
8699
|
+
code: "UNKNOWN_ERROR",
|
|
8828
8700
|
data: error.data,
|
|
8829
8701
|
amagiError: {
|
|
8830
8702
|
errorDescription: "未知错误",
|
|
@@ -8891,7 +8763,6 @@ const bilibiliErrorCodeMap = {
|
|
|
8891
8763
|
1e5: "验证码获取失败",
|
|
8892
8764
|
100003: "验证码过期"
|
|
8893
8765
|
};
|
|
8894
|
-
|
|
8895
8766
|
//#endregion
|
|
8896
8767
|
//#region src/utils/errors.ts
|
|
8897
8768
|
/**
|
|
@@ -8973,7 +8844,6 @@ const handleError = (error, requestPath) => {
|
|
|
8973
8844
|
requestPath
|
|
8974
8845
|
};
|
|
8975
8846
|
};
|
|
8976
|
-
|
|
8977
8847
|
//#endregion
|
|
8978
8848
|
//#region src/middleware/validation.ts
|
|
8979
8849
|
/**
|
|
@@ -9020,7 +8890,6 @@ const createKuaishouValidationMiddleware = (methodType) => createValidationMiddl
|
|
|
9020
8890
|
* @returns Express中间件函数
|
|
9021
8891
|
*/
|
|
9022
8892
|
const createXiaohongshuValidationMiddleware = (methodType) => createValidationMiddleware(validateXiaohongshuParams, methodType);
|
|
9023
|
-
|
|
9024
8893
|
//#endregion
|
|
9025
8894
|
//#region src/platform/bilibili/routes.ts
|
|
9026
8895
|
/**
|
|
@@ -9068,7 +8937,6 @@ const createBilibiliRoutes = (cookie, requestConfig = getBilibiliDefaultConfig(c
|
|
|
9068
8937
|
for (const [method, path] of Object.entries(BilibiliMethodRoutes)) router.get(path, createBilibiliValidationMiddleware(method), createBilibiliRouteHandler(method, cookie, requestConfig));
|
|
9069
8938
|
return router;
|
|
9070
8939
|
};
|
|
9071
|
-
|
|
9072
8940
|
//#endregion
|
|
9073
8941
|
//#region src/platform/bilibili/index.ts
|
|
9074
8942
|
/** B站相关功能模块 (工具集) */
|
|
@@ -9082,7 +8950,6 @@ const bilibiliUtils = {
|
|
|
9082
8950
|
bilibiliApiUrls,
|
|
9083
8951
|
api: bilibili
|
|
9084
8952
|
};
|
|
9085
|
-
|
|
9086
8953
|
//#endregion
|
|
9087
8954
|
//#region src/platform/douyin/DouyinApi.ts
|
|
9088
8955
|
/**
|
|
@@ -9100,22 +8967,39 @@ const createDeprecatedStub$2 = (methodName) => {
|
|
|
9100
8967
|
* @deprecated v6 已废弃,请使用 douyinFetcher 或 client.douyin.fetcher 替代
|
|
9101
8968
|
*/
|
|
9102
8969
|
const douyin = {
|
|
8970
|
+
/** @deprecated 请使用 douyinFetcher.fetchTextWork 替代 */
|
|
9103
8971
|
getTextWorkInfo: createDeprecatedStub$2("getTextWorkInfo"),
|
|
8972
|
+
/** @deprecated 请使用 douyinFetcher.parseWork 替代 */
|
|
9104
8973
|
getWorkInfo: createDeprecatedStub$2("getWorkInfo"),
|
|
8974
|
+
/** @deprecated 请使用 douyinFetcher.fetchVideoWork 替代 */
|
|
9105
8975
|
getVideoWorkInfo: createDeprecatedStub$2("getVideoWorkInfo"),
|
|
8976
|
+
/** @deprecated 请使用 douyinFetcher.fetchImageAlbumWork 替代 */
|
|
9106
8977
|
getImageAlbumWorkInfo: createDeprecatedStub$2("getImageAlbumWorkInfo"),
|
|
8978
|
+
/** @deprecated 请使用 douyinFetcher.fetchSlidesWork 替代 */
|
|
9107
8979
|
getSlidesWorkInfo: createDeprecatedStub$2("getSlidesWorkInfo"),
|
|
8980
|
+
/** @deprecated 请使用 douyinFetcher.fetchComments 替代 */
|
|
9108
8981
|
getComments: createDeprecatedStub$2("getComments"),
|
|
8982
|
+
/** @deprecated 请使用 douyinFetcher.fetchCommentReplies 替代 */
|
|
9109
8983
|
getCommentReplies: createDeprecatedStub$2("getCommentReplies"),
|
|
8984
|
+
/** @deprecated 请使用 douyinFetcher.fetchUserProfile 替代 */
|
|
9110
8985
|
getUserProfile: createDeprecatedStub$2("getUserProfile"),
|
|
8986
|
+
/** @deprecated 请使用 douyinFetcher.fetchEmojiList 替代 */
|
|
9111
8987
|
getEmojiList: createDeprecatedStub$2("getEmojiList"),
|
|
8988
|
+
/** @deprecated 请使用 douyinFetcher.fetchDynamicEmojiList 替代 */
|
|
9112
8989
|
getEmojiProList: createDeprecatedStub$2("getEmojiProList"),
|
|
8990
|
+
/** @deprecated 请使用 douyinFetcher.fetchUserVideoList 替代 */
|
|
9113
8991
|
getUserVideos: createDeprecatedStub$2("getUserVideos"),
|
|
8992
|
+
/** @deprecated 请使用 douyinFetcher.fetchMusicInfo 替代 */
|
|
9114
8993
|
getMusicInfo: createDeprecatedStub$2("getMusicInfo"),
|
|
8994
|
+
/** @deprecated 请使用 douyinFetcher.fetchSuggestWords 替代 */
|
|
9115
8995
|
getSuggestWords: createDeprecatedStub$2("getSuggestWords"),
|
|
8996
|
+
/** @deprecated 请使用 douyinFetcher.searchContent 替代 */
|
|
9116
8997
|
search: createDeprecatedStub$2("search"),
|
|
8998
|
+
/** @deprecated 请使用 douyinFetcher.fetchLiveRoomInfo 替代 */
|
|
9117
8999
|
getLiveRoomInfo: createDeprecatedStub$2("getLiveRoomInfo"),
|
|
9000
|
+
/** @deprecated 请使用 douyinFetcher.fetchDanmakuList 替代 */
|
|
9118
9001
|
getDanmaku: createDeprecatedStub$2("getDanmaku"),
|
|
9002
|
+
/** @deprecated 请使用 douyinFetcher 的具体方法替代 */
|
|
9119
9003
|
invoke: createDeprecatedStub$2("invoke")
|
|
9120
9004
|
};
|
|
9121
9005
|
/**
|
|
@@ -9129,7 +9013,6 @@ const createBoundDouyinApi = (_cookie, _requestConfig) => {
|
|
|
9129
9013
|
getSearchData: createDeprecatedStub$2("getSearchData")
|
|
9130
9014
|
};
|
|
9131
9015
|
};
|
|
9132
|
-
|
|
9133
9016
|
//#endregion
|
|
9134
9017
|
//#region src/platform/douyin/routes.ts
|
|
9135
9018
|
/**
|
|
@@ -9177,7 +9060,6 @@ const createDouyinRoutes = (cookie, requestConfig = getDouyinDefaultConfig(cooki
|
|
|
9177
9060
|
for (const [method, path] of Object.entries(DouyinMethodRoutes)) router.get(path, createDouyinValidationMiddleware(method), createDouyinRouteHandler(method, cookie, requestConfig));
|
|
9178
9061
|
return router;
|
|
9179
9062
|
};
|
|
9180
|
-
|
|
9181
9063
|
//#endregion
|
|
9182
9064
|
//#region src/platform/douyin/index.ts
|
|
9183
9065
|
/** 抖音相关功能模块 (工具集) */
|
|
@@ -9186,7 +9068,6 @@ const douyinUtils = {
|
|
|
9186
9068
|
douyinApiUrls,
|
|
9187
9069
|
api: douyin
|
|
9188
9070
|
};
|
|
9189
|
-
|
|
9190
9071
|
//#endregion
|
|
9191
9072
|
//#region src/platform/kuaishou/KuaishouApi.ts
|
|
9192
9073
|
/**
|
|
@@ -9204,11 +9085,17 @@ const createDeprecatedStub$1 = (methodName) => {
|
|
|
9204
9085
|
* @deprecated v6 已废弃,请使用 kuaishouFetcher 或 client.kuaishou.fetcher 替代
|
|
9205
9086
|
*/
|
|
9206
9087
|
const kuaishou = {
|
|
9088
|
+
/** @deprecated 请使用 kuaishouFetcher.fetchVideoWork 替代 */
|
|
9207
9089
|
getWorkInfo: createDeprecatedStub$1("getWorkInfo"),
|
|
9090
|
+
/** @deprecated 请使用 kuaishouFetcher.fetchWorkComments 替代 */
|
|
9208
9091
|
getComments: createDeprecatedStub$1("getComments"),
|
|
9092
|
+
/** @deprecated 请使用 kuaishouFetcher.fetchUserProfile 替代 */
|
|
9209
9093
|
getUserProfile: createDeprecatedStub$1("getUserProfile"),
|
|
9094
|
+
/** @deprecated 请使用 kuaishouFetcher.fetchUserWorkList 替代 */
|
|
9210
9095
|
getUserWorkList: createDeprecatedStub$1("getUserWorkList"),
|
|
9096
|
+
/** @deprecated 请使用 kuaishouFetcher.fetchLiveRoomInfo 替代 */
|
|
9211
9097
|
getLiveRoomInfo: createDeprecatedStub$1("getLiveRoomInfo"),
|
|
9098
|
+
/** @deprecated 请使用 kuaishouFetcher.fetchEmojiList 替代 */
|
|
9212
9099
|
getEmojiList: createDeprecatedStub$1("getEmojiList")
|
|
9213
9100
|
};
|
|
9214
9101
|
/**
|
|
@@ -9219,7 +9106,6 @@ const kuaishou = {
|
|
|
9219
9106
|
const createBoundKuaishouApi = (_cookie, _requestConfig) => {
|
|
9220
9107
|
return { ...kuaishou };
|
|
9221
9108
|
};
|
|
9222
|
-
|
|
9223
9109
|
//#endregion
|
|
9224
9110
|
//#region src/platform/kuaishou/routes.ts
|
|
9225
9111
|
/**
|
|
@@ -9267,7 +9153,6 @@ const createKuaishouRoutes = (cookie, requestConfig = getKuaishouDefaultConfig(c
|
|
|
9267
9153
|
for (const [method, path] of Object.entries(KuaishouMethodRoutes)) router.get(path, createKuaishouValidationMiddleware(method), createKuaishouRouteHandler(method, cookie, requestConfig));
|
|
9268
9154
|
return router;
|
|
9269
9155
|
};
|
|
9270
|
-
|
|
9271
9156
|
//#endregion
|
|
9272
9157
|
//#region src/platform/kuaishou/index.ts
|
|
9273
9158
|
/** 快手相关功能模块 (工具集) */
|
|
@@ -9276,7 +9161,6 @@ const kuaishouUtils = {
|
|
|
9276
9161
|
kuaishouApiUrls,
|
|
9277
9162
|
api: kuaishou
|
|
9278
9163
|
};
|
|
9279
|
-
|
|
9280
9164
|
//#endregion
|
|
9281
9165
|
//#region src/platform/xiaohongshu/XiaohongshuApi.ts
|
|
9282
9166
|
/**
|
|
@@ -9303,12 +9187,19 @@ const createDeprecatedStub = (methodName) => {
|
|
|
9303
9187
|
* @deprecated v6 已废弃,请使用 xiaohongshuFetcher 或 client.xiaohongshu.fetcher 替代
|
|
9304
9188
|
*/
|
|
9305
9189
|
const xiaohongshu = {
|
|
9190
|
+
/** @deprecated 请使用 xiaohongshuFetcher.fetchHomeFeed 替代 */
|
|
9306
9191
|
getHomeFeed: createDeprecatedStub("getHomeFeed"),
|
|
9192
|
+
/** @deprecated 请使用 xiaohongshuFetcher.fetchNoteDetail 替代 */
|
|
9307
9193
|
getNote: createDeprecatedStub("getNote"),
|
|
9194
|
+
/** @deprecated 请使用 xiaohongshuFetcher.fetchNoteComments 替代 */
|
|
9308
9195
|
getComments: createDeprecatedStub("getComments"),
|
|
9196
|
+
/** @deprecated 请使用 xiaohongshuFetcher.fetchUserProfile 替代 */
|
|
9309
9197
|
getUser: createDeprecatedStub("getUser"),
|
|
9198
|
+
/** @deprecated 请使用 xiaohongshuFetcher.fetchUserNoteList 替代 */
|
|
9310
9199
|
getUserNotes: createDeprecatedStub("getUserNotes"),
|
|
9200
|
+
/** @deprecated 请使用 xiaohongshuFetcher.searchNotes 替代 */
|
|
9311
9201
|
getSearchNotes: createDeprecatedStub("getSearchNotes"),
|
|
9202
|
+
/** @deprecated 请使用 xiaohongshuFetcher.fetchEmojiList 替代 */
|
|
9312
9203
|
getEmojiList: createDeprecatedStub("getEmojiList")
|
|
9313
9204
|
};
|
|
9314
9205
|
/**
|
|
@@ -9319,7 +9210,6 @@ const xiaohongshu = {
|
|
|
9319
9210
|
const createBoundXiaohongshuApi = (_cookie, _requestConfig) => {
|
|
9320
9211
|
return { ...xiaohongshu };
|
|
9321
9212
|
};
|
|
9322
|
-
|
|
9323
9213
|
//#endregion
|
|
9324
9214
|
//#region src/platform/xiaohongshu/routes.ts
|
|
9325
9215
|
/**
|
|
@@ -9367,7 +9257,6 @@ const createXiaohongshuRoutes = (cookie, requestConfig = getXiaohongshuDefaultCo
|
|
|
9367
9257
|
for (const [method, path] of Object.entries(XiaohongshuMethodRoutes)) router.get(path, createXiaohongshuValidationMiddleware(method), createXiaohongshuRouteHandler(method, cookie, requestConfig));
|
|
9368
9258
|
return router;
|
|
9369
9259
|
};
|
|
9370
|
-
|
|
9371
9260
|
//#endregion
|
|
9372
9261
|
//#region src/platform/xiaohongshu/index.ts
|
|
9373
9262
|
/** 小红书相关功能模块 (工具集) */
|
|
@@ -9376,7 +9265,6 @@ const xiaohongshuUtils = {
|
|
|
9376
9265
|
xiaohongshuApiUrls,
|
|
9377
9266
|
api: xiaohongshu
|
|
9378
9267
|
};
|
|
9379
|
-
|
|
9380
9268
|
//#endregion
|
|
9381
9269
|
//#region src/server/index.ts
|
|
9382
9270
|
/**
|
|
@@ -9426,7 +9314,7 @@ const createAmagiClient = (options) => {
|
|
|
9426
9314
|
* @deprecated v6 已废弃,请使用 douyin.fetcher 替代
|
|
9427
9315
|
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
9428
9316
|
*/
|
|
9429
|
-
const getDouyinData
|
|
9317
|
+
const getDouyinData = (..._args) => {
|
|
9430
9318
|
checkDeprecation("getDouyinData");
|
|
9431
9319
|
throw new Error("getDouyinData 已废弃");
|
|
9432
9320
|
};
|
|
@@ -9434,7 +9322,7 @@ const createAmagiClient = (options) => {
|
|
|
9434
9322
|
* @deprecated v6 已废弃,请使用 bilibili.fetcher 替代
|
|
9435
9323
|
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
9436
9324
|
*/
|
|
9437
|
-
const getBilibiliData
|
|
9325
|
+
const getBilibiliData = (..._args) => {
|
|
9438
9326
|
checkDeprecation("getBilibiliData");
|
|
9439
9327
|
throw new Error("getBilibiliData 已废弃");
|
|
9440
9328
|
};
|
|
@@ -9442,7 +9330,7 @@ const createAmagiClient = (options) => {
|
|
|
9442
9330
|
* @deprecated v6 已废弃,请使用 kuaishou.fetcher 替代
|
|
9443
9331
|
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
9444
9332
|
*/
|
|
9445
|
-
const getKuaishouData
|
|
9333
|
+
const getKuaishouData = (..._args) => {
|
|
9446
9334
|
checkDeprecation("getKuaishouData");
|
|
9447
9335
|
throw new Error("getKuaishouData 已废弃");
|
|
9448
9336
|
};
|
|
@@ -9450,42 +9338,65 @@ const createAmagiClient = (options) => {
|
|
|
9450
9338
|
* @deprecated v6 已废弃,请使用 xiaohongshu.fetcher 替代
|
|
9451
9339
|
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
9452
9340
|
*/
|
|
9453
|
-
const getXiaohongshuData
|
|
9341
|
+
const getXiaohongshuData = (..._args) => {
|
|
9454
9342
|
checkDeprecation("getXiaohongshuData");
|
|
9455
9343
|
throw new Error("getXiaohongshuData 已废弃");
|
|
9456
9344
|
};
|
|
9457
9345
|
return {
|
|
9346
|
+
/** 启动本地HTTP服务 */
|
|
9458
9347
|
startServer,
|
|
9348
|
+
/** 事件系统 */
|
|
9459
9349
|
events: amagiEvents,
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
|
|
9465
|
-
|
|
9350
|
+
/**
|
|
9351
|
+
* 注册事件监听器
|
|
9352
|
+
* @param event - 事件名称
|
|
9353
|
+
* @param listener - 事件处理函数
|
|
9354
|
+
*/
|
|
9355
|
+
on: (event, listener) => amagiEvents.on(event, listener),
|
|
9356
|
+
/**
|
|
9357
|
+
* 注册一次性事件监听器
|
|
9358
|
+
* @param event - 事件名称
|
|
9359
|
+
* @param listener - 事件处理函数 (只触发一次)
|
|
9360
|
+
*/
|
|
9361
|
+
once: (event, listener) => amagiEvents.once(event, listener),
|
|
9362
|
+
/** @deprecated v6 已废弃,请使用 douyin.fetcher 替代 */
|
|
9363
|
+
getDouyinData,
|
|
9364
|
+
/** @deprecated v6 已废弃,请使用 bilibili.fetcher 替代 */
|
|
9365
|
+
getBilibiliData,
|
|
9366
|
+
/** @deprecated v6 已废弃,请使用 kuaishou.fetcher 替代 */
|
|
9367
|
+
getKuaishouData,
|
|
9368
|
+
/** @deprecated v6 已废弃,请使用 xiaohongshu.fetcher 替代 */
|
|
9369
|
+
getXiaohongshuData,
|
|
9466
9370
|
douyin: {
|
|
9467
9371
|
...douyinUtils,
|
|
9372
|
+
/** @deprecated 请使用 fetcher 替代 */
|
|
9468
9373
|
api: createBoundDouyinApi(douyinCookie, requestConfig),
|
|
9374
|
+
/** fetcher */
|
|
9469
9375
|
fetcher: createBoundDouyinFetcher(douyinCookie, requestConfig)
|
|
9470
9376
|
},
|
|
9471
9377
|
bilibili: {
|
|
9472
9378
|
...bilibiliUtils,
|
|
9379
|
+
/** @deprecated 请使用 fetcher 替代 */
|
|
9473
9380
|
api: createBoundBilibiliApi(bilibiliCookie, requestConfig),
|
|
9381
|
+
/** fetcher */
|
|
9474
9382
|
fetcher: createBoundBilibiliFetcher(bilibiliCookie, requestConfig)
|
|
9475
9383
|
},
|
|
9476
9384
|
kuaishou: {
|
|
9477
9385
|
...kuaishouUtils,
|
|
9386
|
+
/** @deprecated 请使用 fetcher 替代 */
|
|
9478
9387
|
api: createBoundKuaishouApi(kuaishouCookie, requestConfig),
|
|
9388
|
+
/** fetcher */
|
|
9479
9389
|
fetcher: createBoundKuaishouFetcher(kuaishouCookie, requestConfig)
|
|
9480
9390
|
},
|
|
9481
9391
|
xiaohongshu: {
|
|
9482
9392
|
...xiaohongshuUtils,
|
|
9393
|
+
/** @deprecated 请使用 fetcher 替代 */
|
|
9483
9394
|
api: createBoundXiaohongshuApi(xiaohongshuCookie, requestConfig),
|
|
9395
|
+
/** fetcher */
|
|
9484
9396
|
fetcher: createBoundXiaohongshuFetcher(xiaohongshuCookie, requestConfig)
|
|
9485
9397
|
}
|
|
9486
9398
|
};
|
|
9487
9399
|
};
|
|
9488
|
-
|
|
9489
9400
|
//#endregion
|
|
9490
9401
|
//#region src/types/BilibiliAPIParams.ts
|
|
9491
9402
|
/**
|
|
@@ -9494,136 +9405,133 @@ const createAmagiClient = (options) => {
|
|
|
9494
9405
|
* 对应 CommentParams.type 与 CommentReplyParams.type
|
|
9495
9406
|
* @see https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/comment/readme.md#评论区类型代码
|
|
9496
9407
|
*/
|
|
9497
|
-
let CommentType = /* @__PURE__ */ function(CommentType
|
|
9408
|
+
let CommentType = /* @__PURE__ */ function(CommentType) {
|
|
9498
9409
|
/** 视频稿件:oid 为稿件 avid */
|
|
9499
|
-
CommentType
|
|
9410
|
+
CommentType[CommentType["Video"] = 1] = "Video";
|
|
9500
9411
|
/** 话题:oid 为话题 id */
|
|
9501
|
-
CommentType
|
|
9412
|
+
CommentType[CommentType["Topic"] = 2] = "Topic";
|
|
9502
9413
|
/** 活动:oid 为活动 id */
|
|
9503
|
-
CommentType
|
|
9414
|
+
CommentType[CommentType["Activity"] = 4] = "Activity";
|
|
9504
9415
|
/** 小视频:oid 为小视频 id */
|
|
9505
|
-
CommentType
|
|
9416
|
+
CommentType[CommentType["SmallVideo"] = 5] = "SmallVideo";
|
|
9506
9417
|
/** 小黑屋封禁信息:oid 为封禁公示 id */
|
|
9507
|
-
CommentType
|
|
9418
|
+
CommentType[CommentType["BlockInfo"] = 6] = "BlockInfo";
|
|
9508
9419
|
/** 公告信息:oid 为公告 id */
|
|
9509
|
-
CommentType
|
|
9420
|
+
CommentType[CommentType["Announcement"] = 7] = "Announcement";
|
|
9510
9421
|
/** 直播活动:oid 为直播间 id */
|
|
9511
|
-
CommentType
|
|
9422
|
+
CommentType[CommentType["LiveActivity"] = 8] = "LiveActivity";
|
|
9512
9423
|
/** 活动稿件:oid 含义未知 */
|
|
9513
|
-
CommentType
|
|
9424
|
+
CommentType[CommentType["ActivityVideo"] = 9] = "ActivityVideo";
|
|
9514
9425
|
/** 直播公告:oid 含义未知 */
|
|
9515
|
-
CommentType
|
|
9426
|
+
CommentType[CommentType["LiveAnnouncement"] = 10] = "LiveAnnouncement";
|
|
9516
9427
|
/** 相簿(图片动态):oid 为相簿 id */
|
|
9517
|
-
CommentType
|
|
9428
|
+
CommentType[CommentType["Album"] = 11] = "Album";
|
|
9518
9429
|
/** 专栏:oid 为专栏 cvid */
|
|
9519
|
-
CommentType
|
|
9430
|
+
CommentType[CommentType["Article"] = 12] = "Article";
|
|
9520
9431
|
/** 票务:oid 含义未知 */
|
|
9521
|
-
CommentType
|
|
9432
|
+
CommentType[CommentType["Ticket"] = 13] = "Ticket";
|
|
9522
9433
|
/** 音频:oid 为音频 auid */
|
|
9523
|
-
CommentType
|
|
9434
|
+
CommentType[CommentType["Audio"] = 14] = "Audio";
|
|
9524
9435
|
/** 风纪委员会:oid 为众裁项目 id */
|
|
9525
|
-
CommentType
|
|
9436
|
+
CommentType[CommentType["Jury"] = 15] = "Jury";
|
|
9526
9437
|
/** 点评:oid 含义未知 */
|
|
9527
|
-
CommentType
|
|
9438
|
+
CommentType[CommentType["Review"] = 16] = "Review";
|
|
9528
9439
|
/** 动态(纯文字动态&分享):oid 为动态 id */
|
|
9529
|
-
CommentType
|
|
9440
|
+
CommentType[CommentType["Dynamic"] = 17] = "Dynamic";
|
|
9530
9441
|
/** 播单:oid 含义未知 */
|
|
9531
|
-
CommentType
|
|
9442
|
+
CommentType[CommentType["Playlist"] = 18] = "Playlist";
|
|
9532
9443
|
/** 音乐播单:oid 含义未知 */
|
|
9533
|
-
CommentType
|
|
9444
|
+
CommentType[CommentType["MusicPlaylist"] = 19] = "MusicPlaylist";
|
|
9534
9445
|
/** 漫画:oid 含义未知 */
|
|
9535
|
-
CommentType
|
|
9446
|
+
CommentType[CommentType["Comic1"] = 20] = "Comic1";
|
|
9536
9447
|
/** 漫画:oid 含义未知 */
|
|
9537
|
-
CommentType
|
|
9448
|
+
CommentType[CommentType["Comic2"] = 21] = "Comic2";
|
|
9538
9449
|
/** 漫画:oid 为漫画 mcid */
|
|
9539
|
-
CommentType
|
|
9450
|
+
CommentType[CommentType["Comic"] = 22] = "Comic";
|
|
9540
9451
|
/** 课程:oid 为课程 epid */
|
|
9541
|
-
CommentType
|
|
9542
|
-
return CommentType
|
|
9452
|
+
CommentType[CommentType["Course"] = 33] = "Course";
|
|
9453
|
+
return CommentType;
|
|
9543
9454
|
}({});
|
|
9544
|
-
|
|
9545
9455
|
//#endregion
|
|
9546
9456
|
//#region src/types/ReturnDataType/Bilibili/Dynamic/index.ts
|
|
9547
9457
|
/**
|
|
9548
9458
|
* 转发动态种子动态主体类型枚举
|
|
9549
9459
|
*/
|
|
9550
|
-
let MajorType = /* @__PURE__ */ function(MajorType
|
|
9460
|
+
let MajorType = /* @__PURE__ */ function(MajorType) {
|
|
9551
9461
|
/** 动态失效 */
|
|
9552
|
-
MajorType
|
|
9462
|
+
MajorType["NONE"] = "MAJOR_TYPE_NONE";
|
|
9553
9463
|
/** 图文动态 */
|
|
9554
|
-
MajorType
|
|
9464
|
+
MajorType["OPUS"] = "MAJOR_TYPE_OPUS";
|
|
9555
9465
|
/** 视频 */
|
|
9556
|
-
MajorType
|
|
9466
|
+
MajorType["ARCHIVE"] = "MAJOR_TYPE_ARCHIVE";
|
|
9557
9467
|
/** 剧集更新 */
|
|
9558
|
-
MajorType
|
|
9468
|
+
MajorType["PGC"] = "MAJOR_TYPE_PGC";
|
|
9559
9469
|
/** 课程 */
|
|
9560
|
-
MajorType
|
|
9470
|
+
MajorType["COURSES"] = "MAJOR_TYPE_COURSES";
|
|
9561
9471
|
/** 带图动态 */
|
|
9562
|
-
MajorType
|
|
9472
|
+
MajorType["DRAW"] = "MAJOR_TYPE_DRAW";
|
|
9563
9473
|
/** 文章 */
|
|
9564
|
-
MajorType
|
|
9474
|
+
MajorType["ARTICLE"] = "MAJOR_TYPE_ARTICLE";
|
|
9565
9475
|
/** 音频更新 */
|
|
9566
|
-
MajorType
|
|
9476
|
+
MajorType["MUSIC"] = "MAJOR_TYPE_MUSIC";
|
|
9567
9477
|
/** 一般类型 */
|
|
9568
|
-
MajorType
|
|
9478
|
+
MajorType["COMMON"] = "MAJOR_TYPE_COMMON";
|
|
9569
9479
|
/** 直播间分享 */
|
|
9570
|
-
MajorType
|
|
9480
|
+
MajorType["LIVE"] = "MAJOR_TYPE_LIVE";
|
|
9571
9481
|
/** 媒体列表 */
|
|
9572
|
-
MajorType
|
|
9482
|
+
MajorType["MEDIALIST"] = "MAJOR_TYPE_MEDIALIST";
|
|
9573
9483
|
/** 小程序 */
|
|
9574
|
-
MajorType
|
|
9484
|
+
MajorType["APPLET"] = "MAJOR_TYPE_APPLET";
|
|
9575
9485
|
/** 订阅 */
|
|
9576
|
-
MajorType
|
|
9486
|
+
MajorType["SUBSCRIPTION"] = "MAJOR_TYPE_SUBSCRIPTION";
|
|
9577
9487
|
/** 直播状态 */
|
|
9578
|
-
MajorType
|
|
9488
|
+
MajorType["LIVE_RCMD"] = "MAJOR_TYPE_LIVE_RCMD";
|
|
9579
9489
|
/** 合集更新 */
|
|
9580
|
-
MajorType
|
|
9490
|
+
MajorType["UGC_SEASON"] = "MAJOR_TYPE_UGC_SEASON";
|
|
9581
9491
|
/** 新订阅 */
|
|
9582
|
-
MajorType
|
|
9492
|
+
MajorType["SUBSCRIPTION_NEW"] = "MAJOR_TYPE_SUBSCRIPTION_NEW";
|
|
9583
9493
|
/** 充电相关 */
|
|
9584
|
-
MajorType
|
|
9585
|
-
return MajorType
|
|
9494
|
+
MajorType["UPOWER_COMMON"] = "MAJOR_TYPE_UPOWER_COMMON";
|
|
9495
|
+
return MajorType;
|
|
9586
9496
|
}({});
|
|
9587
9497
|
/**
|
|
9588
9498
|
* 相关内容卡片类型枚举
|
|
9589
9499
|
* 用于标识动态中附加的相关内容卡片的类型
|
|
9590
9500
|
*/
|
|
9591
|
-
let AdditionalType = /* @__PURE__ */ function(AdditionalType
|
|
9501
|
+
let AdditionalType = /* @__PURE__ */ function(AdditionalType) {
|
|
9592
9502
|
/** 无相关内容 */
|
|
9593
|
-
AdditionalType
|
|
9503
|
+
AdditionalType["NONE"] = "ADDITIONAL_TYPE_NONE";
|
|
9594
9504
|
/** 剧集相关 */
|
|
9595
|
-
AdditionalType
|
|
9505
|
+
AdditionalType["PGC"] = "ADDITIONAL_TYPE_PGC";
|
|
9596
9506
|
/** 商品信息 */
|
|
9597
|
-
AdditionalType
|
|
9507
|
+
AdditionalType["GOODS"] = "ADDITIONAL_TYPE_GOODS";
|
|
9598
9508
|
/** 投票 */
|
|
9599
|
-
AdditionalType
|
|
9509
|
+
AdditionalType["VOTE"] = "ADDITIONAL_TYPE_VOTE";
|
|
9600
9510
|
/** 一般类型 */
|
|
9601
|
-
AdditionalType
|
|
9511
|
+
AdditionalType["COMMON"] = "ADDITIONAL_TYPE_COMMON";
|
|
9602
9512
|
/** 比赛信息 */
|
|
9603
|
-
AdditionalType
|
|
9513
|
+
AdditionalType["MATCH"] = "ADDITIONAL_TYPE_MATCH";
|
|
9604
9514
|
/** UP主推荐 */
|
|
9605
|
-
AdditionalType
|
|
9515
|
+
AdditionalType["UP_RCMD"] = "ADDITIONAL_TYPE_UP_RCMD";
|
|
9606
9516
|
/** 视频跳转 */
|
|
9607
|
-
AdditionalType
|
|
9517
|
+
AdditionalType["UGC"] = "ADDITIONAL_TYPE_UGC";
|
|
9608
9518
|
/** 直播预约 */
|
|
9609
|
-
AdditionalType
|
|
9519
|
+
AdditionalType["RESERVE"] = "ADDITIONAL_TYPE_RESERVE";
|
|
9610
9520
|
/** 充电专属抽奖 */
|
|
9611
|
-
AdditionalType
|
|
9612
|
-
return AdditionalType
|
|
9521
|
+
AdditionalType["UPOWER_LOTTERY"] = "ADDITIONAL_TYPE_UPOWER_LOTTERY";
|
|
9522
|
+
return AdditionalType;
|
|
9613
9523
|
}({});
|
|
9614
|
-
|
|
9615
9524
|
//#endregion
|
|
9616
|
-
//#region src/types/ReturnDataType/Bilibili/DynamicInfo.ts
|
|
9617
|
-
let DynamicType = /* @__PURE__ */ function(DynamicType
|
|
9618
|
-
DynamicType
|
|
9619
|
-
DynamicType
|
|
9620
|
-
DynamicType
|
|
9621
|
-
DynamicType
|
|
9622
|
-
DynamicType
|
|
9623
|
-
DynamicType
|
|
9624
|
-
return DynamicType
|
|
9525
|
+
//#region src/types/ReturnDataType/Bilibili/DynamicInfo/index.ts
|
|
9526
|
+
let DynamicType = /* @__PURE__ */ function(DynamicType) {
|
|
9527
|
+
DynamicType["AV"] = "DYNAMIC_TYPE_AV";
|
|
9528
|
+
DynamicType["DRAW"] = "DYNAMIC_TYPE_DRAW";
|
|
9529
|
+
DynamicType["WORD"] = "DYNAMIC_TYPE_WORD";
|
|
9530
|
+
DynamicType["LIVE_RCMD"] = "DYNAMIC_TYPE_LIVE_RCMD";
|
|
9531
|
+
DynamicType["FORWARD"] = "DYNAMIC_TYPE_FORWARD";
|
|
9532
|
+
DynamicType["ARTICLE"] = "DYNAMIC_TYPE_ARTICLE";
|
|
9533
|
+
return DynamicType;
|
|
9625
9534
|
}({});
|
|
9626
|
-
|
|
9627
9535
|
//#endregion
|
|
9628
9536
|
//#region src/types/method-keys.ts
|
|
9629
9537
|
/**
|
|
@@ -9882,7 +9790,6 @@ const MethodMaps = {
|
|
|
9882
9790
|
toFetcher: XiaohongshuMethodToFetcher
|
|
9883
9791
|
}
|
|
9884
9792
|
};
|
|
9885
|
-
|
|
9886
9793
|
//#endregion
|
|
9887
9794
|
//#region src/types/api-spec.ts
|
|
9888
9795
|
const DouyinMethodMapping = {
|
|
@@ -9904,8 +9811,7 @@ const DouyinMethodMapping = {
|
|
|
9904
9811
|
动态表情数据: "fetchDynamicEmojiList",
|
|
9905
9812
|
弹幕数据: "fetchDanmakuList"
|
|
9906
9813
|
};
|
|
9907
|
-
|
|
9908
|
-
const DouyinMethodReverseMapping = Object.fromEntries(Object.entries(DouyinMethodMapping).map(([k, v]) => [v, k]));
|
|
9814
|
+
Object.fromEntries(Object.entries(DouyinMethodMapping).map(([k, v]) => [v, k]));
|
|
9909
9815
|
const BilibiliMethodMapping = {
|
|
9910
9816
|
单个视频作品数据: "fetchVideoInfo",
|
|
9911
9817
|
单个视频下载信息数据: "fetchVideoStreamUrl",
|
|
@@ -9935,8 +9841,7 @@ const BilibiliMethodMapping = {
|
|
|
9935
9841
|
从_v_voucher_申请_captcha: "requestCaptchaFromVoucher",
|
|
9936
9842
|
验证验证码结果: "validateCaptchaResult"
|
|
9937
9843
|
};
|
|
9938
|
-
|
|
9939
|
-
const BilibiliMethodReverseMapping = Object.fromEntries(Object.entries(BilibiliMethodMapping).map(([k, v]) => [v, k]));
|
|
9844
|
+
Object.fromEntries(Object.entries(BilibiliMethodMapping).map(([k, v]) => [v, k]));
|
|
9940
9845
|
const KuaishouMethodMapping = {
|
|
9941
9846
|
单个视频作品数据: "fetchVideoWork",
|
|
9942
9847
|
评论数据: "fetchWorkComments",
|
|
@@ -9945,8 +9850,7 @@ const KuaishouMethodMapping = {
|
|
|
9945
9850
|
直播间信息数据: "fetchLiveRoomInfo",
|
|
9946
9851
|
Emoji数据: "fetchEmojiList"
|
|
9947
9852
|
};
|
|
9948
|
-
|
|
9949
|
-
const KuaishouMethodReverseMapping = Object.fromEntries(Object.entries(KuaishouMethodMapping).map(([k, v]) => [v, k]));
|
|
9853
|
+
Object.fromEntries(Object.entries(KuaishouMethodMapping).map(([k, v]) => [v, k]));
|
|
9950
9854
|
const XiaohongshuMethodMapping = {
|
|
9951
9855
|
首页推荐数据: "fetchHomeFeed",
|
|
9952
9856
|
单个笔记数据: "fetchNoteDetail",
|
|
@@ -9956,8 +9860,7 @@ const XiaohongshuMethodMapping = {
|
|
|
9956
9860
|
表情列表: "fetchEmojiList",
|
|
9957
9861
|
搜索笔记: "searchNotes"
|
|
9958
9862
|
};
|
|
9959
|
-
|
|
9960
|
-
const XiaohongshuMethodReverseMapping = Object.fromEntries(Object.entries(XiaohongshuMethodMapping).map(([k, v]) => [v, k]));
|
|
9863
|
+
Object.fromEntries(Object.entries(XiaohongshuMethodMapping).map(([k, v]) => [v, k]));
|
|
9961
9864
|
/**
|
|
9962
9865
|
* Douyin HTTP API 路由
|
|
9963
9866
|
*
|
|
@@ -10065,7 +9968,6 @@ function getApiRoute(platform, methodType) {
|
|
|
10065
9968
|
xiaohongshu: XiaohongshuApiRoutes
|
|
10066
9969
|
}[platform][methodType];
|
|
10067
9970
|
}
|
|
10068
|
-
|
|
10069
9971
|
//#endregion
|
|
10070
9972
|
//#region src/index.ts
|
|
10071
9973
|
/**
|
|
@@ -10073,7 +9975,7 @@ function getApiRoute(platform, methodType) {
|
|
|
10073
9975
|
* 构建后使用 __VERSION__,开发环境从 package.json 读取
|
|
10074
9976
|
*/
|
|
10075
9977
|
const getVersion = () => {
|
|
10076
|
-
return "6.1.
|
|
9978
|
+
return "6.1.3";
|
|
10077
9979
|
};
|
|
10078
9980
|
const VERSION = getVersion();
|
|
10079
9981
|
/**
|
|
@@ -10120,7 +10022,7 @@ const CreateApp = CreateAmagiApp;
|
|
|
10120
10022
|
/** After instantiation, it can interact with the specified platform API to quickly obtain data. */
|
|
10121
10023
|
const Client = CreateApp;
|
|
10122
10024
|
const amagi = Client;
|
|
10123
|
-
|
|
10124
10025
|
//#endregion
|
|
10125
10026
|
export { AdditionalType, ApiError, BilibiliApiRoutes, BilibiliApplyCaptchaParamsSchema, BilibiliArticleCardParamsSchema, BilibiliArticleInfoParamsSchema, BilibiliArticleParamsSchema, BilibiliAv2BvParamsSchema, BilibiliBangumiInfoParamsSchema, BilibiliBangumiStreamParamsSchema, BilibiliBv2AvParamsSchema, BilibiliColumnInfoParamsSchema, BilibiliCommentParamsSchema, BilibiliCommentReplyParamsSchema, BilibiliDanmakuParamsSchema, BilibiliDynamicParamsSchema, BilibiliEmojiParamsSchema, BilibiliFetcherMethods, BilibiliInternalMethods, BilibiliLiveParamsSchema, BilibiliLoginParamsSchema, BilibiliMethodMapping, BilibiliMethodRoutes, BilibiliMethodToFetcher, BilibiliQrcodeParamsSchema, BilibiliQrcodeStatusParamsSchema, BilibiliUserParamsSchema, BilibiliValidateCaptchaParamsSchema, BilibiliValidationSchemas, BilibiliVideoDownloadParamsSchema, BilibiliVideoParamsSchema, CommentType, CreateApp, DouyinApiRoutes, DouyinCommentParamsSchema, DouyinCommentReplyParamsSchema, DouyinDanmakuParamsSchema, DouyinEmojiListParamsSchema, DouyinEmojiProParamsSchema, DouyinFetcherMethods, DouyinHotWordsParamsSchema, DouyinInternalMethods, DouyinLiveRoomParamsSchema, DouyinMethodMapping, DouyinMethodRoutes, DouyinMethodToFetcher, DouyinMusicParamsSchema, DouyinQrcodeParamsSchema, DouyinSearchParamsSchema, DouyinUserListParamsSchema, DouyinUserParamsSchema, DouyinValidationSchemas, DouyinWorkParamsSchema, DynamicType, KuaishouApiRoutes, KuaishouCommentParamsSchema, KuaishouEmojiParamsSchema, KuaishouFetcherMethods, KuaishouInternalMethods, KuaishouLiveRoomInfoParamsSchema, KuaishouMethodMapping, KuaishouMethodRoutes, KuaishouMethodToFetcher, KuaishouUserProfileParamsSchema, KuaishouUserWorkListParamsSchema, KuaishouValidationSchemas, KuaishouVideoParamsSchema, MajorType, MethodMaps, ValidationError, XiaohongshuApiRoutes, XiaohongshuFetcherMethods, XiaohongshuInternalMethods, XiaohongshuMethodMapping, XiaohongshuMethodRoutes, XiaohongshuMethodToFetcher, XiaohongshuValidationSchemas, amagi, amagiClient, amagiEvents, av2bv, bilibili, bilibiliApiUrls, bilibiliErrorCodeMap, bilibiliFetcher, bilibiliUtils, bv2av, createAmagiClient, createBilibiliRoutes, createBilibiliRoutes as registerBilibiliRoutes, createBoundBilibiliApi, createBoundBilibiliFetcher, createBoundDouyinApi, createBoundDouyinFetcher, createBoundKuaishouApi, createBoundKuaishouFetcher, createBoundXiaohongshuApi, createBoundXiaohongshuFetcher, createDouyinRoutes, createDouyinRoutes as registerDouyinRoutes, createErrorResponse, createKuaishouRoutes, createKuaishouRoutes as registerKuaishouRoutes, createSuccessResponse, createXiaohongshuRoutes, createXiaohongshuRoutes as registerXiaohongshuRoutes, Client as default, douyin, douyinApiUrls, douyinFetcher, douyinSign, douyinUtils, emitApiError, emitApiSuccess, emitHttpRequest, emitHttpResponse, emitLog, emitLogDebug, emitLogError, emitLogInfo, emitLogMark, emitLogWarn, emitNetworkError, emitNetworkRetry, fetchData, fetchResponse, getApiRoute, getBilibiliData, getDouyinData, getEnglishMethodName, getHeadersAndData, getKuaishouData, handleError, httpLogger, initLogger, isNetworkErrorResult, kuaishou, kuaishouApiUrls, kuaishouFetcher, kuaishouSign, kuaishouUtils, logMiddleware, logger, parseDmSegMobileReply, qtparam, toFetcherMethod, validateBilibiliParams, validateDouyinParams, validateKuaishouParams, validateXiaohongshuParams, wbi_sign, xiaohongshu, xiaohongshuApiUrls, xiaohongshuFetcher, xiaohongshuSign, xiaohongshuUtils };
|
|
10027
|
+
|
|
10126
10028
|
//# sourceMappingURL=index.mjs.map
|