@ikenxuan/amagi 5.12.3 → 5.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +1,19 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
2
  const require_chunk = require('../chunk-CbDLau6x.cjs');
3
- let node_fs = require("node:fs");
4
- node_fs = require_chunk.__toESM(node_fs);
5
3
  let node_path = require("node:path");
6
4
  node_path = require_chunk.__toESM(node_path);
7
5
  let node_url = require("node:url");
8
6
  node_url = require_chunk.__toESM(node_url);
7
+ let node_fs = require("node:fs");
8
+ node_fs = require_chunk.__toESM(node_fs);
9
9
  let chalk = require("chalk");
10
10
  let axios = require("axios");
11
11
  axios = require_chunk.__toESM(axios);
12
12
  let zod = require("zod");
13
13
  zod = require_chunk.__toESM(zod);
14
14
  let __ikenxuan_xhshow_ts = require("@ikenxuan/xhshow-ts");
15
+ let protobufjs = require("protobufjs");
16
+ protobufjs = require_chunk.__toESM(protobufjs);
15
17
  let node_crypto = require("node:crypto");
16
18
  node_crypto = require_chunk.__toESM(node_crypto);
17
19
  let express = require("express");
@@ -535,6 +537,11 @@ const BilibiliValidateCaptchaParamsSchema = zod.default.object({
535
537
  validate: zod.default.string({ error: "验证码validate必须是字符串" }).min(1, { error: "验证码validate不能为空" }),
536
538
  seccode: zod.default.string({ error: "验证码seccode必须是字符串" }).min(1, { error: "验证码seccode不能为空" })
537
539
  });
540
+ const BilibiliDanmakuParamsSchema = zod.default.object({
541
+ methodType: zod.default.literal("实时弹幕", { error: "方法类型必须是\"实时弹幕\"" }),
542
+ cid: smartNumber("CID不能为空", 1, true),
543
+ segment_index: zod.default.coerce.number({ error: "分段序号必须是数字" }).int({ error: "分段序号必须是整数" }).positive({ error: "分段序号必须是正数" }).default(1).optional()
544
+ });
538
545
  const BilibiliValidationSchemas = {
539
546
  单个视频作品数据: BilibiliVideoParamsSchema,
540
547
  单个视频下载信息数据: BilibiliVideoDownloadParamsSchema,
@@ -561,7 +568,8 @@ const BilibiliValidationSchemas = {
561
568
  专栏文章基本信息: BilibiliArticleInfoParamsSchema,
562
569
  文集基本信息: BilibiliColumnInfoParamsSchema,
563
570
  从_v_voucher_申请_captcha: BilibiliApplyCaptchaParamsSchema,
564
- 验证验证码结果: BilibiliValidateCaptchaParamsSchema
571
+ 验证验证码结果: BilibiliValidateCaptchaParamsSchema,
572
+ 实时弹幕: BilibiliDanmakuParamsSchema
565
573
  };
566
574
  const BilibiliMethodRoutes = {
567
575
  单个视频作品数据: "/fetch_one_video",
@@ -589,7 +597,8 @@ const BilibiliMethodRoutes = {
589
597
  专栏文章基本信息: "/fetch_article_info",
590
598
  文集基本信息: "/fetch_column_info",
591
599
  从_v_voucher_申请_captcha: "/apply_captcha",
592
- 验证验证码结果: "/validate_captcha"
600
+ 验证验证码结果: "/validate_captcha",
601
+ 实时弹幕: "/fetch_danmaku"
593
602
  };
594
603
 
595
604
  //#endregion
@@ -1164,7 +1173,7 @@ const isRecoverableError = (error) => {
1164
1173
  * 延迟函数
1165
1174
  * @param ms - 延迟毫秒数
1166
1175
  */
1167
- const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
1176
+ const delay = (ms) => new Promise((resolve$1) => setTimeout(resolve$1, ms));
1168
1177
  /**
1169
1178
  * 创建网络错误响应
1170
1179
  * @param error - 错误对象
@@ -1534,6 +1543,17 @@ var BiLiBiLiAPI = class {
1534
1543
  }
1535
1544
  };
1536
1545
  }
1546
+ /**
1547
+ * 获取实时弹幕(web端 protobuf 接口)
1548
+ * @see https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/danmaku/danmaku_proto.md
1549
+ */
1550
+ 实时弹幕(data$1) {
1551
+ return `https://api.bilibili.com/x/v2/dm/web/seg.so?${new URLSearchParams({
1552
+ type: "1",
1553
+ oid: data$1.cid.toString(),
1554
+ segment_index: (data$1.segment_index ?? 1).toString()
1555
+ }).toString()}`;
1556
+ }
1537
1557
  };
1538
1558
  /** 该类下的所有方法只会返回拼接好参数后的 Url 地址,需要手动请求该地址以获取数据 */
1539
1559
  const bilibiliApiUrls = new BiLiBiLiAPI();
@@ -1598,7 +1618,8 @@ const bilibili = {
1598
1618
  getColumnInfo: createBilibiliApiMethod("文集基本信息"),
1599
1619
  getUserProfileDetail: createBilibiliApiMethod("用户空间详细信息"),
1600
1620
  applyVoucherCaptcha: createBilibiliApiMethod("从_v_voucher_申请_captcha"),
1601
- validateCaptcha: createBilibiliApiMethod("验证验证码结果")
1621
+ validateCaptcha: createBilibiliApiMethod("验证验证码结果"),
1622
+ getDanmaku: createBilibiliApiMethod("实时弹幕")
1602
1623
  };
1603
1624
  /**
1604
1625
  * 创建绑定了cookie的B站API对象
@@ -1632,7 +1653,8 @@ const createBoundBilibiliApi = (cookie, requestConfig) => {
1632
1653
  getColumnInfo: createBoundBilibiliApiMethod("文集基本信息", cookie),
1633
1654
  getUserProfileDetail: createBoundBilibiliApiMethod("用户空间详细信息", cookie),
1634
1655
  applyVoucherCaptcha: createBoundBilibiliApiMethod("从_v_voucher_申请_captcha", cookie),
1635
- validateCaptcha: createBoundBilibiliApiMethod("验证验证码结果", cookie)
1656
+ validateCaptcha: createBoundBilibiliApiMethod("验证验证码结果", cookie),
1657
+ getDanmaku: createBoundBilibiliApiMethod("实时弹幕", cookie)
1636
1658
  };
1637
1659
  };
1638
1660
 
@@ -1688,6 +1710,101 @@ const bv2av = (bvid) => {
1688
1710
  return Number(tmp & MASK_CODE ^ XOR_CODE);
1689
1711
  };
1690
1712
 
1713
+ //#endregion
1714
+ //#region src/platform/bilibili/sign/danmaku_proto.ts
1715
+ /**
1716
+ * B站弹幕 Protobuf 定义(内联)
1717
+ * @see https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/danmaku/danmaku_proto.md
1718
+ */
1719
+ const DANMAKU_PROTO_JSON = { nested: { bilibili: { nested: { community: { nested: { service: { nested: { dm: { nested: { v1: { nested: {
1720
+ DmSegMobileReply: { fields: { elems: {
1721
+ rule: "repeated",
1722
+ type: "DanmakuElem",
1723
+ id: 1
1724
+ } } },
1725
+ DanmakuElem: { fields: {
1726
+ id: {
1727
+ type: "int64",
1728
+ id: 1
1729
+ },
1730
+ progress: {
1731
+ type: "int32",
1732
+ id: 2
1733
+ },
1734
+ mode: {
1735
+ type: "int32",
1736
+ id: 3
1737
+ },
1738
+ fontsize: {
1739
+ type: "int32",
1740
+ id: 4
1741
+ },
1742
+ color: {
1743
+ type: "uint32",
1744
+ id: 5
1745
+ },
1746
+ midHash: {
1747
+ type: "string",
1748
+ id: 6
1749
+ },
1750
+ content: {
1751
+ type: "string",
1752
+ id: 7
1753
+ },
1754
+ ctime: {
1755
+ type: "int64",
1756
+ id: 8
1757
+ },
1758
+ weight: {
1759
+ type: "int32",
1760
+ id: 9
1761
+ },
1762
+ action: {
1763
+ type: "string",
1764
+ id: 10
1765
+ },
1766
+ pool: {
1767
+ type: "int32",
1768
+ id: 11
1769
+ },
1770
+ idStr: {
1771
+ type: "string",
1772
+ id: 12
1773
+ },
1774
+ attr: {
1775
+ type: "int32",
1776
+ id: 13
1777
+ },
1778
+ animation: {
1779
+ type: "string",
1780
+ id: 22
1781
+ }
1782
+ } }
1783
+ } } } } } } } } } } } };
1784
+ let DmSegMobileReplyType = null;
1785
+ /**
1786
+ * 获取 protobuf 类型定义
1787
+ */
1788
+ function getProtoType() {
1789
+ if (DmSegMobileReplyType) return DmSegMobileReplyType;
1790
+ DmSegMobileReplyType = protobufjs.default.Root.fromJSON(DANMAKU_PROTO_JSON).lookupType("bilibili.community.service.dm.v1.DmSegMobileReply");
1791
+ return DmSegMobileReplyType;
1792
+ }
1793
+ /**
1794
+ * 解析弹幕分段响应
1795
+ * @param data - 二进制 protobuf 数据
1796
+ * @returns 解析后的弹幕数据
1797
+ */
1798
+ function parseDmSegMobileReply(data$1) {
1799
+ const messageType = getProtoType();
1800
+ const buffer = data$1 instanceof Uint8Array ? data$1 : new Uint8Array(data$1);
1801
+ const message = messageType.decode(buffer);
1802
+ return messageType.toObject(message, {
1803
+ longs: String,
1804
+ defaults: true
1805
+ });
1806
+ }
1807
+
1691
1808
  //#endregion
1692
1809
  //#region src/platform/bilibili/sign/wbi.ts
1693
1810
  /**
@@ -1987,6 +2104,7 @@ const bilibiliUtils = {
1987
2104
  av2bv,
1988
2105
  bv2av
1989
2106
  },
2107
+ danmaku: { parseDmSegMobileReply },
1990
2108
  bilibiliApiUrls,
1991
2109
  api: bilibili
1992
2110
  };
@@ -2326,6 +2444,48 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
2326
2444
  url: bilibiliApiUrls.验证验证码结果(data$1).Url,
2327
2445
  data: bilibiliApiUrls.验证验证码结果(data$1).Body
2328
2446
  });
2447
+ case "实时弹幕": {
2448
+ const url$1 = bilibiliApiUrls.实时弹幕({
2449
+ cid: data$1.cid,
2450
+ segment_index: data$1.segment_index
2451
+ });
2452
+ try {
2453
+ const response = await fetchData({
2454
+ ...baseRequestConfig,
2455
+ url: url$1,
2456
+ responseType: "arraybuffer"
2457
+ });
2458
+ if (isNetworkErrorResult(response)) {
2459
+ const networkError = new Error(response.error.amagiError.errorDescription);
2460
+ Object.assign(networkError, {
2461
+ code: response.error.code,
2462
+ data: null,
2463
+ amagiError: {
2464
+ ...response.error.amagiError,
2465
+ requestType: data$1.methodType
2466
+ }
2467
+ });
2468
+ throw networkError;
2469
+ }
2470
+ return {
2471
+ code: 0,
2472
+ message: "success",
2473
+ data: { elems: parseDmSegMobileReply(response).elems }
2474
+ };
2475
+ } catch (error) {
2476
+ if (error && typeof error === "object" && "code" in error) return error;
2477
+ const Err = {
2478
+ errorDescription: `获取弹幕数据失败:${error instanceof Error ? error.message : "未知错误"}`,
2479
+ requestType: data$1.methodType,
2480
+ requestUrl: url$1
2481
+ };
2482
+ return {
2483
+ code: amagiAPIErrorCode.UNKNOWN,
2484
+ data: null,
2485
+ amagiError: Err
2486
+ };
2487
+ }
2488
+ }
2329
2489
  default:
2330
2490
  logger.warn(`未知的B站数据接口:「${logger.red(data$1.methodType)}」`);
2331
2491
  return null;
@@ -5180,7 +5340,14 @@ let DynamicType = /* @__PURE__ */ function(DynamicType$1) {
5180
5340
 
5181
5341
  //#endregion
5182
5342
  //#region src/index.ts
5183
- const VERSION = "5.12.3";
5343
+ /**
5344
+ * 获取版本号
5345
+ * 构建后使用 __VERSION__,开发环境从 package.json 读取
5346
+ */
5347
+ const getVersion = () => {
5348
+ return "5.13.0";
5349
+ };
5350
+ const VERSION = getVersion();
5184
5351
  /**
5185
5352
  * @deprecated 请使用 createAmagiClient 替代
5186
5353
  */
@@ -5229,6 +5396,7 @@ exports.BilibiliBv2AvParamsSchema = BilibiliBv2AvParamsSchema;
5229
5396
  exports.BilibiliColumnInfoParamsSchema = BilibiliColumnInfoParamsSchema;
5230
5397
  exports.BilibiliCommentParamsSchema = BilibiliCommentParamsSchema;
5231
5398
  exports.BilibiliCommentReplyParamsSchema = BilibiliCommentReplyParamsSchema;
5399
+ exports.BilibiliDanmakuParamsSchema = BilibiliDanmakuParamsSchema;
5232
5400
  exports.BilibiliDynamicParamsSchema = BilibiliDynamicParamsSchema;
5233
5401
  exports.BilibiliEmojiParamsSchema = BilibiliEmojiParamsSchema;
5234
5402
  exports.BilibiliLiveParamsSchema = BilibiliLiveParamsSchema;
@@ -5306,6 +5474,7 @@ exports.kuaishouApiUrls = kuaishouApiUrls;
5306
5474
  exports.kuaishouUtils = kuaishouUtils;
5307
5475
  exports.logMiddleware = logMiddleware;
5308
5476
  exports.logger = logger;
5477
+ exports.parseDmSegMobileReply = parseDmSegMobileReply;
5309
5478
  exports.qtparam = qtparam;
5310
5479
  exports.registerBilibiliRoutes = createBilibiliRoutes;
5311
5480
  exports.registerDouyinRoutes = createDouyinRoutes;
@@ -2157,6 +2157,20 @@ interface BilibiliMethodOptionsMap {
2157
2157
  */
2158
2158
  id: string;
2159
2159
  };
2160
+ /**
2161
+ * 实时弹幕参数
2162
+ * @see https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/danmaku/danmaku_proto.md
2163
+ */
2164
+ DanmakuParams: {
2165
+ methodType: '实时弹幕';
2166
+ /** 稿件cid */
2167
+ cid: number;
2168
+ /**
2169
+ * 分段序号(从1开始),每6分钟为一段
2170
+ * @defaultValue 1
2171
+ */
2172
+ segment_index?: number;
2173
+ };
2160
2174
  /** 从_v_voucher_申请_captcha */
2161
2175
  ApplyVoucherCaptchaParams: {
2162
2176
  methodType: '从_v_voucher_申请_captcha';
@@ -2261,6 +2275,7 @@ type BilibiliMethodOptMap = {
2261
2275
  文集基本信息: BilibiliMethodOptionsMap['ColumnInfoParams'];
2262
2276
  从_v_voucher_申请_captcha: BilibiliMethodOptionsMap['ApplyVoucherCaptchaParams'];
2263
2277
  验证验证码结果: BilibiliMethodOptionsMap['ValidateCaptchaParams'];
2278
+ 实时弹幕: BilibiliMethodOptionsMap['DanmakuParams'];
2264
2279
  };
2265
2280
  //#endregion
2266
2281
  //#region src/validation/bilibili.d.ts
@@ -2285,6 +2300,7 @@ declare const BilibiliArticleInfoParamsSchema: zod.ZodType<BilibiliMethodOptions
2285
2300
  declare const BilibiliColumnInfoParamsSchema: zod.ZodType<BilibiliMethodOptionsMap['ColumnInfoParams']>;
2286
2301
  declare const BilibiliApplyCaptchaParamsSchema: zod.ZodType<BilibiliMethodOptionsMap['ApplyVoucherCaptchaParams']>;
2287
2302
  declare const BilibiliValidateCaptchaParamsSchema: zod.ZodType<BilibiliMethodOptionsMap['ValidateCaptchaParams']>;
2303
+ declare const BilibiliDanmakuParamsSchema: zod.ZodType<BilibiliMethodOptionsMap['DanmakuParams']>;
2288
2304
  declare const BilibiliValidationSchemas: {
2289
2305
  readonly 单个视频作品数据: zod.ZodType<{
2290
2306
  methodType: "\u5355\u4E2A\u89C6\u9891\u4F5C\u54C1\u6570\u636E";
@@ -2498,6 +2514,15 @@ declare const BilibiliValidationSchemas: {
2498
2514
  validate: string;
2499
2515
  seccode: string;
2500
2516
  }, unknown>>;
2517
+ readonly 实时弹幕: zod.ZodType<{
2518
+ methodType: "\u5B9E\u65F6\u5F39\u5E55";
2519
+ cid: number;
2520
+ segment_index?: number;
2521
+ }, unknown, zod.core.$ZodTypeInternals<{
2522
+ methodType: "\u5B9E\u65F6\u5F39\u5E55";
2523
+ cid: number;
2524
+ segment_index?: number;
2525
+ }, unknown>>;
2501
2526
  };
2502
2527
  declare const BilibiliMethodRoutes: {
2503
2528
  readonly 单个视频作品数据: "/fetch_one_video";
@@ -2526,6 +2551,7 @@ declare const BilibiliMethodRoutes: {
2526
2551
  readonly 文集基本信息: "/fetch_column_info";
2527
2552
  readonly 从_v_voucher_申请_captcha: "/apply_captcha";
2528
2553
  readonly 验证验证码结果: "/validate_captcha";
2554
+ readonly 实时弹幕: "/fetch_danmaku";
2529
2555
  };
2530
2556
  type BilibiliMethodType = keyof typeof BilibiliValidationSchemas;
2531
2557
  //#endregion
@@ -3410,12 +3436,12 @@ declare enum xiaohongshuAPIErrorCode {
3410
3436
  //#region src/types/ReturnDataType/Bilibili/ArticleCard.d.ts
3411
3437
  type ArticleCard = {
3412
3438
  code: number;
3413
- data: DataData$26;
3439
+ data: DataData$27;
3414
3440
  message: string;
3415
3441
  ttl: number;
3416
3442
  [property: string]: any;
3417
3443
  };
3418
- type DataData$26 = {
3444
+ type DataData$27 = {
3419
3445
  av2: Av2;
3420
3446
  cv1: Cv1;
3421
3447
  cv2: Cv2;
@@ -3774,12 +3800,12 @@ type Lv5440 = {
3774
3800
  //#region src/types/ReturnDataType/Bilibili/ArticleContent.d.ts
3775
3801
  type ArticleContent = {
3776
3802
  code: number;
3777
- data: DataData$25;
3803
+ data: DataData$26;
3778
3804
  message: string;
3779
3805
  ttl: number;
3780
3806
  [property: string]: any;
3781
3807
  };
3782
- type DataData$25 = {
3808
+ type DataData$26 = {
3783
3809
  act_id: number;
3784
3810
  apply_time: string;
3785
3811
  authenMark: null;
@@ -3991,12 +4017,12 @@ type Stats$1 = {
3991
4017
  //#region src/types/ReturnDataType/Bilibili/ArticleInfo.d.ts
3992
4018
  type ArticleInfo = {
3993
4019
  code: number;
3994
- data: DataData$24;
4020
+ data: DataData$25;
3995
4021
  message: string;
3996
4022
  ttl: number;
3997
4023
  [property: string]: any;
3998
4024
  };
3999
- type DataData$24 = {
4025
+ type DataData$25 = {
4000
4026
  attention: boolean;
4001
4027
  author_name: string;
4002
4028
  banner_url: string;
@@ -4762,12 +4788,12 @@ type Setting = {
4762
4788
  //#region src/types/ReturnDataType/Bilibili/BiliCommentReply.d.ts
4763
4789
  type BiliCommentReply = {
4764
4790
  code: number;
4765
- data: DataData$23;
4791
+ data: DataData$24;
4766
4792
  message: string;
4767
4793
  ttl: number;
4768
4794
  [property: string]: any;
4769
4795
  };
4770
- type DataData$23 = {
4796
+ type DataData$24 = {
4771
4797
  assist: number;
4772
4798
  blacklist: number;
4773
4799
  callbacks: {
@@ -5272,12 +5298,12 @@ type Data$13 = {
5272
5298
  //#region src/types/ReturnDataType/Bilibili/Captcha/ApplyCaptcha.d.ts
5273
5299
  type ApplyCaptcha = {
5274
5300
  code: number;
5275
- data: DataData$22;
5301
+ data: DataData$23;
5276
5302
  message: string;
5277
5303
  ttl: number;
5278
5304
  [property: string]: any;
5279
5305
  };
5280
- type DataData$22 = {
5306
+ type DataData$23 = {
5281
5307
  biliword: null;
5282
5308
  geetest: Geetest;
5283
5309
  phone: null;
@@ -5296,12 +5322,12 @@ type Geetest = {
5296
5322
  //#region src/types/ReturnDataType/Bilibili/Captcha/ValidateCaptcha.d.ts
5297
5323
  type ValidateCaptcha = {
5298
5324
  code: number;
5299
- data: DataData$21;
5325
+ data: DataData$22;
5300
5326
  message: string;
5301
5327
  ttl: number;
5302
5328
  [property: string]: any;
5303
5329
  };
5304
- type DataData$21 = {
5330
+ type DataData$22 = {
5305
5331
  grisk_id: string;
5306
5332
  is_valid: number;
5307
5333
  [property: string]: any;
@@ -5310,12 +5336,12 @@ type DataData$21 = {
5310
5336
  //#region src/types/ReturnDataType/Bilibili/ColumnInfo.d.ts
5311
5337
  type ColumnInfo = {
5312
5338
  code: number;
5313
- data: DataData$20;
5339
+ data: DataData$21;
5314
5340
  message: string;
5315
5341
  ttl: number;
5316
5342
  [property: string]: any;
5317
5343
  };
5318
- type DataData$20 = {
5344
+ type DataData$21 = {
5319
5345
  articles: null;
5320
5346
  attention: boolean;
5321
5347
  author: Author$6;
@@ -5564,12 +5590,12 @@ type DynamicTypeItemMap$1 = {
5564
5590
  [DynamicType.FORWARD]: DynamicTypeForwardUnion['data']['item'];
5565
5591
  [DynamicType.ARTICLE]: DynamicTypeArticle['data']['item'];
5566
5592
  };
5567
- type DataData$19<T extends DynamicType> = {
5593
+ type DataData$20<T extends DynamicType> = {
5568
5594
  item: DynamicTypeItemMap$1[T];
5569
5595
  };
5570
5596
  type BiliDynamicInfo<T extends DynamicType> = {
5571
5597
  code: number;
5572
- data: DataData$19<T>;
5598
+ data: DataData$20<T>;
5573
5599
  message: string;
5574
5600
  ttl: number;
5575
5601
  [property: string]: any;
@@ -5875,6 +5901,35 @@ type UserGarb = {
5875
5901
  [property: string]: any;
5876
5902
  };
5877
5903
  //#endregion
5904
+ //#region src/types/ReturnDataType/Bilibili/ProtobufDanmaku.d.ts
5905
+ type BiliProtobufDanmaku = {
5906
+ code: number;
5907
+ data: DataData$19;
5908
+ message: string;
5909
+ [property: string]: any;
5910
+ };
5911
+ type DataData$19 = {
5912
+ elems: Elem[];
5913
+ [property: string]: any;
5914
+ };
5915
+ type Elem = {
5916
+ action: string;
5917
+ animation: string;
5918
+ attr: number;
5919
+ color: number;
5920
+ content: string;
5921
+ ctime: string;
5922
+ fontsize: number;
5923
+ id: string;
5924
+ idStr: string;
5925
+ midHash: string;
5926
+ mode: number;
5927
+ pool: number;
5928
+ progress: number;
5929
+ weight: number;
5930
+ [property: string]: any;
5931
+ };
5932
+ //#endregion
5878
5933
  //#region src/types/ReturnDataType/Bilibili/UserDynamic.d.ts
5879
5934
  type BiliUserDynamic = {
5880
5935
  code: number;
@@ -11926,6 +11981,7 @@ interface BilibiliReturnTypeMap {
11926
11981
  文集基本信息: ColumnInfo;
11927
11982
  从_v_voucher_申请_captcha: ApplyCaptcha;
11928
11983
  验证验证码结果: ValidateCaptcha;
11984
+ 实时弹幕: BiliProtobufDanmaku;
11929
11985
  }
11930
11986
  //#endregion
11931
11987
  //#region src/types/ReturnDataType/Douyin/CommentReply.d.ts
@@ -21094,6 +21150,14 @@ declare const av2bv: (aid: number) => `BV1${string}`;
21094
21150
  */
21095
21151
  declare const bv2av: (bvid: string) => number;
21096
21152
  //#endregion
21153
+ //#region src/platform/bilibili/sign/danmaku_proto.d.ts
21154
+ /**
21155
+ * 解析弹幕分段响应
21156
+ * @param data - 二进制 protobuf 数据
21157
+ * @returns 解析后的弹幕数据
21158
+ */
21159
+ declare function parseDmSegMobileReply(data: ArrayBuffer | Uint8Array): BiliProtobufDanmaku['data']['elems'][number];
21160
+ //#endregion
21097
21161
  //#region src/platform/bilibili/API.d.ts
21098
21162
  type BilibiliMethodOptionsWithoutMethodType = { [K in keyof BilibiliMethodOptionsMap]: OmitMethodType<BilibiliMethodOptionsMap[K]> };
21099
21163
  declare class BiLiBiLiAPI {
@@ -21139,6 +21203,11 @@ declare class BiLiBiLiAPI {
21139
21203
  seccode: string;
21140
21204
  };
21141
21205
  };
21206
+ /**
21207
+ * 获取实时弹幕(web端 protobuf 接口)
21208
+ * @see https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/danmaku/danmaku_proto.md
21209
+ */
21210
+ 实时弹幕(data: BilibiliMethodOptionsWithoutMethodType['DanmakuParams']): string;
21142
21211
  }
21143
21212
  /** 该类下的所有方法只会返回拼接好参数后的 Url 地址,需要手动请求该地址以获取数据 */
21144
21213
  declare const bilibiliApiUrls: BiLiBiLiAPI;
@@ -21622,6 +21691,22 @@ declare const bilibili: {
21622
21691
  } & {
21623
21692
  typeMode?: M | undefined;
21624
21693
  }, cookie?: string) => Promise<Result<ConditionalReturnType<ValidateCaptcha, M>>>;
21694
+ /**
21695
+ * 获取实时弹幕
21696
+ * @param options 请求参数,包含 cid 和可选的 segment_index
21697
+ * @param cookie 有效的用户 Cookie
21698
+ * @returns 统一格式的API响应,包含弹幕列表
21699
+ * @see https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/danmaku/danmaku_proto.md
21700
+ */
21701
+ getDanmaku: <M extends TypeMode>(options: Omit<{
21702
+ methodType: "\u5B9E\u65F6\u5F39\u5E55";
21703
+ cid: number;
21704
+ segment_index?: number;
21705
+ }, "methodType"> & {
21706
+ typeMode?: TypeMode;
21707
+ } & {
21708
+ typeMode?: M | undefined;
21709
+ }, cookie?: string) => Promise<Result<ConditionalReturnType<BiliProtobufDanmaku, M>>>;
21625
21710
  };
21626
21711
  /**
21627
21712
  * 创建绑定了cookie的B站API对象
@@ -21982,6 +22067,21 @@ declare const createBoundBilibiliApi: (cookie: string, requestConfig: RequestCon
21982
22067
  } & {
21983
22068
  typeMode?: M | undefined;
21984
22069
  }) => Promise<Result<ConditionalReturnType<ValidateCaptcha, M>>>;
22070
+ /**
22071
+ * 获取实时弹幕
22072
+ * @param options 请求参数,包含 cid 和可选的 segment_index
22073
+ * @returns 统一格式的API响应,包含弹幕列表
22074
+ * @see https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/danmaku/danmaku_proto.md
22075
+ */
22076
+ getDanmaku: <M extends TypeMode>(options: Omit<{
22077
+ methodType: "\u5B9E\u65F6\u5F39\u5E55";
22078
+ cid: number;
22079
+ segment_index?: number;
22080
+ }, "methodType"> & {
22081
+ typeMode?: TypeMode;
22082
+ } & {
22083
+ typeMode?: M | undefined;
22084
+ }) => Promise<Result<ConditionalReturnType<BiliProtobufDanmaku, M>>>;
21985
22085
  };
21986
22086
  /**
21987
22087
  * 绑定cookie的B站API对象类型
@@ -22087,6 +22187,11 @@ type bilibiliUtilsModel = {
22087
22187
  /** BV号转AV号 */
22088
22188
  bv2av: typeof bv2av;
22089
22189
  };
22190
+ /** 弹幕解析相关 */
22191
+ danmaku: {
22192
+ /** 解析弹幕 protobuf 数据 */
22193
+ parseDmSegMobileReply: typeof parseDmSegMobileReply;
22194
+ };
22090
22195
  /** 该类下的所有方法只会返回拼接好参数后的 Url 地址,需要手动请求该地址以获取数据 */
22091
22196
  bilibiliApiUrls: typeof bilibiliApiUrls;
22092
22197
  /**
@@ -23417,12 +23522,24 @@ declare const createAmagiClient: (options?: Options) => {
23417
23522
  } & {
23418
23523
  typeMode?: M | undefined;
23419
23524
  }) => Promise<Result<ConditionalReturnType<ValidateCaptcha, M>>>;
23525
+ getDanmaku: <M extends TypeMode>(options: Omit<{
23526
+ methodType: "\u5B9E\u65F6\u5F39\u5E55";
23527
+ cid: number;
23528
+ segment_index?: number;
23529
+ }, "methodType"> & {
23530
+ typeMode?: TypeMode;
23531
+ } & {
23532
+ typeMode?: M | undefined;
23533
+ }) => Promise<Result<ConditionalReturnType<BiliProtobufDanmaku, M>>>;
23420
23534
  };
23421
23535
  sign: {
23422
23536
  wbi_sign: typeof wbi_sign;
23423
23537
  av2bv: typeof av2bv;
23424
23538
  bv2av: typeof bv2av;
23425
23539
  };
23540
+ danmaku: {
23541
+ parseDmSegMobileReply: typeof parseDmSegMobileReply;
23542
+ };
23426
23543
  bilibiliApiUrls: typeof bilibiliApiUrls;
23427
23544
  };
23428
23545
  kuaishou: {
@@ -23875,5 +23992,5 @@ declare const amagi: typeof Client;
23875
23992
  */
23876
23993
 
23877
23994
  //#endregion
23878
- export { APIErrorType, AdditionalType, ApiError, ApiResponse, ArticleCard, ArticleContent, ArticleInfo, BaseResponse, BiliAv2Bv, BiliBangumiVideoInfo, BiliBangumiVideoPlayurlIsLogin, BiliBangumiVideoPlayurlNoLogin, BiliBiliVideoPlayurlNoLogin, BiliBv2AV, BiliCheckQrcode, BiliCommentReply, BiliDynamicCard, BiliDynamicInfo, BiliDynamicInfoUnion, BiliEmojiList, BiliLiveRoomDef, BiliLiveRoomDetail, BiliNewLoginQrcode, BiliOneWork, BiliUserDynamic, BiliUserFullView, BiliUserProfile, BiliVideoPlayurlIsLogin, BiliWorkComments, BilibiliApplyCaptchaParamsSchema, BilibiliArticleCardParamsSchema, BilibiliArticleInfoParamsSchema, BilibiliArticleParamsSchema, BilibiliAv2BvParamsSchema, BilibiliBangumiInfoParamsSchema, BilibiliBangumiStreamParamsSchema, BilibiliBv2AvParamsSchema, BilibiliColumnInfoParamsSchema, BilibiliCommentParamsSchema, BilibiliCommentReplyParamsSchema, BilibiliDataOptions, BilibiliDataOptionsMap, BilibiliDynamicParamsSchema, BilibiliEmojiParamsSchema, BilibiliLiveParamsSchema, BilibiliLoginParamsSchema, BilibiliMethodOptMap, BilibiliMethodOptionsMap, BilibiliMethodRoutes, type BilibiliMethodType, BilibiliQrcodeParamsSchema, BilibiliQrcodeStatusParamsSchema, BilibiliReturnTypeMap, BilibiliUserParamsSchema, BilibiliValidateCaptchaParamsSchema, BilibiliValidationSchemas, BilibiliVideoDownloadParamsSchema, BilibiliVideoParamsSchema, BoundBilibiliApi, BoundDouyinApi, BoundKuaishouApi, BoundXiaohongshuApi, ColumnInfo, CommentReply, CommentType, CookieConfig, CreateApp, DouyinCommentParamsSchema, DouyinCommentReplyParamsSchema, DouyinDanmakuParamsSchema, DouyinDataOptions, DouyinDataOptionsMap, DouyinEmojiListParamsSchema, DouyinEmojiProParamsSchema, DouyinHotWordsParamsSchema, DouyinLiveRoomParamsSchema, DouyinMethodOptMap, DouyinMethodOptionsMap, DouyinMethodRoutes, type DouyinMethodType, DouyinMusicParamsSchema, DouyinQrcodeParamsSchema, DouyinReturnTypeMap, DouyinSearchParamsSchema, DouyinUserParamsSchema, DouyinValidationSchemas, DouyinWorkParamsSchema, DyDanmakuList, DyEmojiList, DyEmojiProList, DyImageAlbumWork, DyMusicWork, DySearchInfo, DySlidesWork, DySuggestWords, DyTextWork, DyUserInfo, DyUserLiveVideos, DyUserPostVideos, DyVideoWork, DyWorkComments, DynamicType, DynamicTypeAV, DynamicTypeArticle, DynamicTypeDraw, DynamicTypeForward, DynamicTypeForwardUnion, DynamicTypeLiveRcmd, DynamicTypeWord, ErrorResult, HomeFeed, KsEmojiList, KsOneWork, KsWorkComments, KuaishouCommentParamsSchema, KuaishouDataOptions, KuaishouDataOptionsMap, KuaishouEmojiParamsSchema, KuaishouMethodOptMap, KuaishouMethodOptionsMap, KuaishouMethodRoutes, type KuaishouMethodType, KuaishouReturnTypeMap, KuaishouValidationSchemas, KuaishouVideoParamsSchema, MajorType, type NetworksConfigType, NoteComments, OmitMethodType, OneNote, Options, RequestConfig, Result, SearchInfoGeneralData, SearchInfoUser, SearchInfoVideo, SearchNotes, SuccessResult, TypeControl, ValidationError, XiaohongshuDataOptions, XiaohongshuDataOptionsMap, XiaohongshuEmojiList, XiaohongshuMethodOptMap, XiaohongshuMethodOptionsMap, XiaohongshuMethodRoutes, XiaohongshuMethodType, XiaohongshuReturnTypeMap, XiaohongshuUserProfile, XiaohongshuValidationSchemas, amagi, amagiClient, av2bv, bilibili, bilibiliApiUrls, bilibiliErrorCodeMap, bilibiliUtils, bv2av, createAmagiClient, createBilibiliRoutes, createBilibiliRoutes as registerBilibiliRoutes, createBoundBilibiliApi, createBoundDouyinApi, createBoundKuaishouApi, createBoundXiaohongshuApi, createDouyinRoutes, createDouyinRoutes as registerDouyinRoutes, createErrorResponse, createKuaishouRoutes, createKuaishouRoutes as registerKuaishouRoutes, createSuccessResponse, createXiaohongshuRoutes, createXiaohongshuRoutes as registerXiaohongshuRoutes, Client as default, douyin, douyinApiUrls, douyinSign, douyinUtils, fetchData, fetchResponse, getBilibiliData, getDouyinData, getHeadersAndData, getKuaishouData, handleError, httpLogger, initLogger, isNetworkErrorResult, kuaishou, kuaishouApiUrls, kuaishouUtils, logMiddleware, logger, qtparam, validateBilibiliParams, validateDouyinParams, validateKuaishouParams, validateXiaohongshuParams, wbi_sign, xiaohongshu, xiaohongshuApiUrls, xiaohongshuSign, xiaohongshuUtils };
23995
+ export { APIErrorType, AdditionalType, ApiError, ApiResponse, ArticleCard, ArticleContent, ArticleInfo, BaseResponse, BiliAv2Bv, BiliBangumiVideoInfo, BiliBangumiVideoPlayurlIsLogin, BiliBangumiVideoPlayurlNoLogin, BiliBiliVideoPlayurlNoLogin, BiliBv2AV, BiliCheckQrcode, BiliCommentReply, BiliDynamicCard, BiliDynamicInfo, BiliDynamicInfoUnion, BiliEmojiList, BiliLiveRoomDef, BiliLiveRoomDetail, BiliNewLoginQrcode, BiliOneWork, BiliProtobufDanmaku, BiliUserDynamic, BiliUserFullView, BiliUserProfile, BiliVideoPlayurlIsLogin, BiliWorkComments, BilibiliApplyCaptchaParamsSchema, BilibiliArticleCardParamsSchema, BilibiliArticleInfoParamsSchema, BilibiliArticleParamsSchema, BilibiliAv2BvParamsSchema, BilibiliBangumiInfoParamsSchema, BilibiliBangumiStreamParamsSchema, BilibiliBv2AvParamsSchema, BilibiliColumnInfoParamsSchema, BilibiliCommentParamsSchema, BilibiliCommentReplyParamsSchema, BilibiliDanmakuParamsSchema, BilibiliDataOptions, BilibiliDataOptionsMap, BilibiliDynamicParamsSchema, BilibiliEmojiParamsSchema, BilibiliLiveParamsSchema, BilibiliLoginParamsSchema, BilibiliMethodOptMap, BilibiliMethodOptionsMap, BilibiliMethodRoutes, type BilibiliMethodType, BilibiliQrcodeParamsSchema, BilibiliQrcodeStatusParamsSchema, BilibiliReturnTypeMap, BilibiliUserParamsSchema, BilibiliValidateCaptchaParamsSchema, BilibiliValidationSchemas, BilibiliVideoDownloadParamsSchema, BilibiliVideoParamsSchema, BoundBilibiliApi, BoundDouyinApi, BoundKuaishouApi, BoundXiaohongshuApi, ColumnInfo, CommentReply, CommentType, CookieConfig, CreateApp, DouyinCommentParamsSchema, DouyinCommentReplyParamsSchema, DouyinDanmakuParamsSchema, DouyinDataOptions, DouyinDataOptionsMap, DouyinEmojiListParamsSchema, DouyinEmojiProParamsSchema, DouyinHotWordsParamsSchema, DouyinLiveRoomParamsSchema, DouyinMethodOptMap, DouyinMethodOptionsMap, DouyinMethodRoutes, type DouyinMethodType, DouyinMusicParamsSchema, DouyinQrcodeParamsSchema, DouyinReturnTypeMap, DouyinSearchParamsSchema, DouyinUserParamsSchema, DouyinValidationSchemas, DouyinWorkParamsSchema, DyDanmakuList, DyEmojiList, DyEmojiProList, DyImageAlbumWork, DyMusicWork, DySearchInfo, DySlidesWork, DySuggestWords, DyTextWork, DyUserInfo, DyUserLiveVideos, DyUserPostVideos, DyVideoWork, DyWorkComments, DynamicType, DynamicTypeAV, DynamicTypeArticle, DynamicTypeDraw, DynamicTypeForward, DynamicTypeForwardUnion, DynamicTypeLiveRcmd, DynamicTypeWord, ErrorResult, HomeFeed, KsEmojiList, KsOneWork, KsWorkComments, KuaishouCommentParamsSchema, KuaishouDataOptions, KuaishouDataOptionsMap, KuaishouEmojiParamsSchema, KuaishouMethodOptMap, KuaishouMethodOptionsMap, KuaishouMethodRoutes, type KuaishouMethodType, KuaishouReturnTypeMap, KuaishouValidationSchemas, KuaishouVideoParamsSchema, MajorType, type NetworksConfigType, NoteComments, OmitMethodType, OneNote, Options, RequestConfig, Result, SearchInfoGeneralData, SearchInfoUser, SearchInfoVideo, SearchNotes, SuccessResult, TypeControl, ValidationError, XiaohongshuDataOptions, XiaohongshuDataOptionsMap, XiaohongshuEmojiList, XiaohongshuMethodOptMap, XiaohongshuMethodOptionsMap, XiaohongshuMethodRoutes, XiaohongshuMethodType, XiaohongshuReturnTypeMap, XiaohongshuUserProfile, XiaohongshuValidationSchemas, amagi, amagiClient, av2bv, bilibili, bilibiliApiUrls, bilibiliErrorCodeMap, bilibiliUtils, bv2av, createAmagiClient, createBilibiliRoutes, createBilibiliRoutes as registerBilibiliRoutes, createBoundBilibiliApi, createBoundDouyinApi, createBoundKuaishouApi, createBoundXiaohongshuApi, createDouyinRoutes, createDouyinRoutes as registerDouyinRoutes, createErrorResponse, createKuaishouRoutes, createKuaishouRoutes as registerKuaishouRoutes, createSuccessResponse, createXiaohongshuRoutes, createXiaohongshuRoutes as registerXiaohongshuRoutes, Client as default, douyin, douyinApiUrls, douyinSign, douyinUtils, fetchData, fetchResponse, getBilibiliData, getDouyinData, getHeadersAndData, getKuaishouData, handleError, httpLogger, initLogger, isNetworkErrorResult, kuaishou, kuaishouApiUrls, kuaishouUtils, logMiddleware, logger, parseDmSegMobileReply, qtparam, validateBilibiliParams, validateDouyinParams, validateKuaishouParams, validateXiaohongshuParams, wbi_sign, xiaohongshu, xiaohongshuApiUrls, xiaohongshuSign, xiaohongshuUtils };
23879
23996
  //# sourceMappingURL=index.d.cts.map