@dan-uni/dan-any 0.2.4 → 0.4.7

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.
@@ -14,4 +14,6 @@
14
14
 
15
15
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
16
16
 
17
- /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
17
+ /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
18
+
19
+ /*! zero-fill. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
@@ -1,4 +1,5 @@
1
1
  import type { UniPool } from '../..';
2
2
  import type { Context, SubtitleStyle } from '../types';
3
- declare const _default: (list: UniPool, rawList: UniPool, config: SubtitleStyle, context?: Context) => string;
3
+ import type { RawConfig } from './raw';
4
+ declare const _default: (list: UniPool, rawList: UniPool, config: SubtitleStyle, context?: Context, rawConfig?: RawConfig) => string;
4
5
  export default _default;
@@ -1,10 +1,14 @@
1
1
  import type { Context, Danmaku, SubtitleStyle } from '../types';
2
2
  type compressType = 'brotli' | 'gzip';
3
3
  type baseType = 'base64' | 'base18384';
4
- declare const _default: (list: Danmaku[], config: SubtitleStyle, context: Context, compressType?: compressType, baseType?: baseType) => string;
5
- export default _default;
4
+ export interface RawConfig {
5
+ compressType: compressType;
6
+ baseType: baseType;
7
+ }
8
+ export declare function raw(list: Danmaku[], config: SubtitleStyle, context: Context, compressType?: compressType, baseType?: baseType): string;
6
9
  export declare function deRaw(ass: string): {
7
10
  list: Danmaku[];
8
11
  config: SubtitleStyle;
9
12
  context: Context;
10
13
  } | undefined;
14
+ export {};
@@ -1,9 +1,11 @@
1
+ import type { RawConfig } from './ass/raw';
1
2
  import type { SubtitleStyle } from './types';
2
3
  import { UniPool } from '..';
3
4
  export type Options = {
4
5
  filename?: string;
5
6
  title?: string;
6
7
  substyle?: Partial<SubtitleStyle>;
8
+ raw?: RawConfig;
7
9
  };
8
10
  /**
9
11
  * 使用bilibili弹幕(XMl)生成ASS字幕文件
@@ -1,9 +1,9 @@
1
1
  import type { Options as AssGenOptions } from './ass-gen';
2
2
  import type { CommandDm as DM_JSON_BiliCommandGrpc } from './proto/gen/bili/dm_pb';
3
- import type { platfrom } from './utils/id-gen';
4
3
  import { UniDM } from './utils/dm-gen';
5
4
  import * as UniDMTools from './utils/dm-gen';
6
5
  import * as UniIDTools from './utils/id-gen';
6
+ import * as platform from './utils/platform';
7
7
  export interface DM_XML_Bili {
8
8
  i: {
9
9
  chatserver: string;
@@ -43,11 +43,67 @@ export interface DM_JSON_DDPlay {
43
43
  }[];
44
44
  }
45
45
  export type DM_format = 'danuni.json' | 'danuni.bin' | 'danuni.pb.zst' | 'bili.xml' | 'bili.bin' | 'bili.cmd.bin' | 'dplayer.json' | 'artplayer.json' | 'ddplay.json' | 'common.ass';
46
- type shareItems = Partial<Pick<UniDMTools.UniDMObj, 'FCID' | 'senderID' | 'platform' | 'SPMO' | 'pool' | 'mode'>>;
46
+ type shareItems = Partial<Pick<UniDMTools.UniDMObj, 'SOID' | 'senderID' | 'platform' | 'SOID' | 'pool' | 'mode' | 'color'>>;
47
+ type UniPoolPipe = (that: UniPool) => Promise<UniPool>;
48
+ type UniPoolPipeSync = (that: UniPool) => UniPool;
49
+ interface Options {
50
+ dedupe?: boolean;
51
+ }
47
52
  export declare class UniPool {
48
53
  dans: UniDM[];
49
- readonly shared: shareItems;
50
- constructor(dans: UniDM[]);
54
+ options: Options;
55
+ constructor(dans: UniDM[], options?: Options);
56
+ pipe(fn: UniPoolPipe): Promise<UniPool>;
57
+ pipeSync(fn: UniPoolPipeSync): UniPool;
58
+ get shared(): shareItems;
59
+ get stat(): {
60
+ SOID: {
61
+ val: string;
62
+ count: number;
63
+ }[];
64
+ mode: {
65
+ val: UniDMTools.Modes;
66
+ count: number;
67
+ }[];
68
+ fontsize: {
69
+ val: number;
70
+ count: number;
71
+ }[];
72
+ color: {
73
+ val: number;
74
+ count: number;
75
+ }[];
76
+ senderID: {
77
+ val: string;
78
+ count: number;
79
+ }[];
80
+ content: {
81
+ val: string;
82
+ count: number;
83
+ }[];
84
+ weight: {
85
+ val: number;
86
+ count: number;
87
+ }[];
88
+ pool: {
89
+ val: UniDMTools.Pools;
90
+ count: number;
91
+ }[];
92
+ platform: {
93
+ val?: string;
94
+ count: number;
95
+ }[];
96
+ };
97
+ get most(): {
98
+ mode: UniDMTools.Modes;
99
+ fontsize: number;
100
+ color: number;
101
+ senderID: string;
102
+ content: string;
103
+ weight: number;
104
+ pool: UniDMTools.Pools;
105
+ platform: string | undefined;
106
+ };
51
107
  static create(): UniPool;
52
108
  /**
53
109
  * 合并弹幕/弹幕库
@@ -57,33 +113,35 @@ export declare class UniPool {
57
113
  * 按共通属性拆分弹幕库
58
114
  */
59
115
  split(key: keyof shareItems): UniPool[];
116
+ /**
117
+ * 基于DMID的基本去重功能,用于解决该class下dans为array而非Set的问题
118
+ */
119
+ private dedupe;
60
120
  /**
61
121
  * 合并一定时间段内的重复弹幕,防止同屏出现过多
62
- * @param lifetime 查重时间区段,单位秒 (默认为0,表示不查重)
122
+ * @param lifetime 查重时间区段,单位秒 (默认为 0,表示不查重)
63
123
  */
64
124
  merge(lifetime?: number): UniPool;
65
- minify(): (Partial<UniDMTools.UniDMObj> & Pick<UniDMTools.UniDMObj, "FCID">)[];
66
- convert2(format: DM_format, continue_on_error?: boolean): string | Uint8Array<ArrayBufferLike> | DM_JSON_Dplayer | DM_JSON_DDPlay | DM_JSON_Artplayer[];
125
+ minify(): (Partial<UniDMTools.UniDMObj> & Pick<UniDMTools.UniDMObj, "SOID">)[];
126
+ convert2(format: DM_format, continue_on_error?: boolean): string | Uint8Array<ArrayBufferLike> | UniDM[] | DM_JSON_Dplayer | DM_JSON_DDPlay | DM_JSON_Artplayer[];
67
127
  static fromPb(bin: Uint8Array | ArrayBuffer): UniPool;
68
128
  /**
69
129
  * 转为 protobuf 二进制
70
130
  */
71
131
  toPb(): Uint8Array<ArrayBufferLike>;
72
- static fromBiliXML(xml: string, SPMO?: string): UniPool;
73
- static fromBiliGrpc(bin: Uint8Array | ArrayBuffer, SPMO?: string): UniPool;
132
+ static fromBiliXML(xml: string): UniPool;
133
+ static fromBiliGrpc(bin: Uint8Array | ArrayBuffer): UniPool;
74
134
  /**
75
- *
76
135
  * @param bin 符合`DmWebViewReplySchema`(bili视频meta)的protobuf二进制
77
- * @param SPMO
78
136
  */
79
- static fromBiliCommandGrpc(bin: Uint8Array | ArrayBuffer, SPMO?: string): UniPool;
137
+ static fromBiliCommandGrpc(bin: Uint8Array | ArrayBuffer): UniPool;
80
138
  static fromDplayer(json: DM_JSON_Dplayer, playerID: string, domain?: string): UniPool;
81
139
  toDplayer(): DM_JSON_Dplayer;
82
140
  static fromArtplayer(json: DM_JSON_Artplayer[], playerID: string, domain?: string): UniPool;
83
141
  toArtplayer(): DM_JSON_Artplayer[];
84
- static fromDDPlay(json: DM_JSON_DDPlay, episodeId: string, domain?: string): UniPool;
142
+ static fromDDPlay(json: DM_JSON_DDPlay, episodeId: string): UniPool;
85
143
  toDDplay(): DM_JSON_DDPlay;
86
144
  static fromASS(ass: string): UniPool;
87
145
  toASS(options?: AssGenOptions): string;
88
146
  }
89
- export { UniDM, UniDMTools, UniIDTools, type DM_JSON_BiliCommandGrpc, type platfrom, };
147
+ export { platform, UniDM, UniDMTools, UniIDTools, type DM_JSON_BiliCommandGrpc, };
@@ -1,4 +1,4 @@
1
- import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv1";
1
+ import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
2
2
  import type { Message } from "@bufbuild/protobuf";
3
3
  /**
4
4
  * Describes the file bili/dm.proto.
@@ -1,18 +1,36 @@
1
- import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1";
1
+ import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
2
2
  import type { Timestamp } from "@bufbuild/protobuf/wkt";
3
3
  import type { Message } from "@bufbuild/protobuf";
4
4
  /**
5
5
  * Describes the file danuni.proto.
6
6
  */
7
7
  export declare const file_danuni: GenFile;
8
+ /**
9
+ * @generated from message danuni.danmaku.v1.listDanReq
10
+ */
11
+ export type listDanReq = Message<"danuni.danmaku.v1.listDanReq"> & {
12
+ /**
13
+ * @generated from field: string ID = 1;
14
+ */
15
+ ID: string;
16
+ /**
17
+ * @generated from field: optional int32 seg = 2;
18
+ */
19
+ seg?: number;
20
+ };
21
+ /**
22
+ * Describes the message danuni.danmaku.v1.listDanReq.
23
+ * Use `create(listDanReqSchema)` to create a new message.
24
+ */
25
+ export declare const listDanReqSchema: GenMessage<listDanReq>;
8
26
  /**
9
27
  * @generated from message danuni.danmaku.v1.Danmaku
10
28
  */
11
29
  export type Danmaku = Message<"danuni.danmaku.v1.Danmaku"> & {
12
30
  /**
13
- * @generated from field: string FCID = 1;
31
+ * @generated from field: string SOID = 1;
14
32
  */
15
- FCID: string;
33
+ SOID: string;
16
34
  /**
17
35
  * @generated from field: string DMID = 2;
18
36
  */
@@ -62,11 +80,7 @@ export type Danmaku = Message<"danuni.danmaku.v1.Danmaku"> & {
62
80
  */
63
81
  platform: string;
64
82
  /**
65
- * @generated from field: optional string SPMO = 14;
66
- */
67
- SPMO?: string;
68
- /**
69
- * @generated from field: optional string extra = 15;
83
+ * @generated from field: optional string extra = 14;
70
84
  */
71
85
  extra?: string;
72
86
  };
@@ -143,3 +157,16 @@ export declare enum Pool {
143
157
  * Describes the enum danuni.danmaku.v1.Pool.
144
158
  */
145
159
  export declare const PoolSchema: GenEnum<Pool>;
160
+ /**
161
+ * @generated from service danuni.danmaku.v1.DanmakuService
162
+ */
163
+ export declare const DanmakuService: GenService<{
164
+ /**
165
+ * @generated from rpc danuni.danmaku.v1.DanmakuService.listDan
166
+ */
167
+ listDan: {
168
+ methodKind: "unary";
169
+ input: typeof listDanReqSchema;
170
+ output: typeof DanmakuReplySchema;
171
+ };
172
+ }>;
@@ -1,6 +1,7 @@
1
1
  import type { DM_JSON_BiliCommandGrpc } from '..';
2
- import type { platfrom } from './id-gen';
3
- export type DMAttr = 'Protect' | 'FromLive' | 'HighLike' | 'Compatible' | 'Reported';
2
+ import type { PlatformDanmakuSource } from './platform';
3
+ import { PlatformDanmakuOnlySource } from './platform';
4
+ export type DMAttr = 'Protect' | 'FromLive' | 'HighLike' | 'Compatible' | 'Reported' | 'Unchecked' | 'HasEvent' | 'Hide';
4
5
  interface DMBili {
5
6
  id: bigint;
6
7
  progress: number;
@@ -83,8 +84,8 @@ interface ExtraArtplayer {
83
84
  border?: boolean;
84
85
  }
85
86
  interface ExtraBili {
86
- mode: number;
87
- pool: number;
87
+ mode?: number;
88
+ pool?: number;
88
89
  adv?: string;
89
90
  code?: string;
90
91
  bas?: string;
@@ -102,6 +103,8 @@ export interface ExtraDanUniMerge {
102
103
  duration: number;
103
104
  count: number;
104
105
  senders: string[];
106
+ taolu_count: number;
107
+ taolu_senders: string[];
105
108
  }
106
109
  export declare enum ExtraDanUniChapterType {
107
110
  Chapter = "ch",//其它片段(用于标记章节)
@@ -111,7 +114,7 @@ export declare enum ExtraDanUniChapterType {
111
114
  ED = "ed",//片尾
112
115
  Preview = "prvw",//预告
113
116
  Cut = "cut",//删减(删减版中提供删减说明,提供开始位置、长度)
114
- Duplicates = "dup",//补档(完整版中指明其它平台中删减位置)
117
+ Duplicate = "dup",//补档(完整版中指明其它平台中删减位置)
115
118
  AdBiz = "biz",//商业广告
116
119
  AdUnpaid = "promo"
117
120
  }
@@ -136,7 +139,7 @@ export declare enum Pools {
136
139
  }
137
140
  export type ctime = string | number | bigint | Date;
138
141
  export interface UniDMObj {
139
- FCID: string;
142
+ SOID: string;
140
143
  progress: number;
141
144
  mode: Modes;
142
145
  fontsize: number;
@@ -147,8 +150,7 @@ export interface UniDMObj {
147
150
  weight: number;
148
151
  pool: Pools;
149
152
  attr: DMAttr[];
150
- platform: platfrom | string;
151
- SPMO: string;
153
+ platform: PlatformDanmakuSource | string;
152
154
  extra: string | Extra;
153
155
  extraStr: string;
154
156
  DMID: string;
@@ -158,15 +160,16 @@ export interface UniDMObj {
158
160
  */
159
161
  export declare class UniDM {
160
162
  /**
161
- * FCID
163
+ * 资源ID
164
+ * @description 由某一danuni服务确定的某一剧集下不同资源(不同视频站/字幕组具有细节差异)的ID
162
165
  */
163
- FCID: string;
166
+ SOID: string;
164
167
  /**
165
168
  * 弹幕出现位置(单位s;精度为ms,即保留三位小数)
166
169
  */
167
170
  progress: number;
168
171
  /**
169
- * 类型 1 2 3:普通弹幕 4:底部弹幕 5:顶部弹幕 6:逆向弹幕 7:高级弹幕 8:代码弹幕 9:BAS弹幕(pool必须为2)
172
+ * 弹幕类型
170
173
  */
171
174
  mode: Modes;
172
175
  /**
@@ -199,7 +202,7 @@ export declare class UniDM {
199
202
  * 权重 用于屏蔽等级 区间:[1,10]
200
203
  * @description 参考B站,源弹幕有该参数则直接利用,
201
204
  * 本实现默认取5,再经过ruleset匹配加减分数
202
- * @description 特殊情况下接受值为0,即设置0需转换为默认权重(5)
205
+ * @description 0时表示暂时未计算权重
203
206
  */
204
207
  weight: number;
205
208
  /**
@@ -215,18 +218,7 @@ export declare class UniDM {
215
218
  * 初始来源平台
216
219
  * `danuni`与任意空值(可隐式转换为false的值)等价
217
220
  */
218
- platform?: (platfrom | string) | undefined;
219
- /**
220
- * Same Platform Multiple Origin
221
- * @description 解决B站等同一番剧存在港澳台站、多语言配音(不同一CID)的问题,同时方便过滤
222
- * @description 示例:
223
- * - main: 主站
224
- * - hm: 仅港澳
225
- * - t: 仅台
226
- * - hmt: 仅港澳台
227
- * - lang:{ISO语言代号}: 多语言
228
- */
229
- SPMO?: string | undefined;
221
+ platform?: (PlatformDanmakuSource | string) | undefined;
230
222
  /**
231
223
  * 弹幕原始数据(不推荐使用)
232
224
  * @description 适用于无法解析的B站代码弹幕、Artplayer弹幕样式等
@@ -240,15 +232,16 @@ export declare class UniDM {
240
232
  */
241
233
  constructor(
242
234
  /**
243
- * FCID
235
+ * 资源ID
236
+ * @description 由某一danuni服务确定的某一剧集下不同资源(不同视频站/字幕组具有细节差异)的ID
244
237
  */
245
- FCID: string,
238
+ SOID: string,
246
239
  /**
247
240
  * 弹幕出现位置(单位s;精度为ms,即保留三位小数)
248
241
  */
249
242
  progress?: number,
250
243
  /**
251
- * 类型 1 2 3:普通弹幕 4:底部弹幕 5:顶部弹幕 6:逆向弹幕 7:高级弹幕 8:代码弹幕 9:BAS弹幕(pool必须为2)
244
+ * 弹幕类型
252
245
  */
253
246
  mode?: Modes,
254
247
  /**
@@ -281,7 +274,7 @@ export declare class UniDM {
281
274
  * 权重 用于屏蔽等级 区间:[1,10]
282
275
  * @description 参考B站,源弹幕有该参数则直接利用,
283
276
  * 本实现默认取5,再经过ruleset匹配加减分数
284
- * @description 特殊情况下接受值为0,即设置0需转换为默认权重(5)
277
+ * @description 0时表示暂时未计算权重
285
278
  */
286
279
  weight?: number,
287
280
  /**
@@ -297,18 +290,7 @@ export declare class UniDM {
297
290
  * 初始来源平台
298
291
  * `danuni`与任意空值(可隐式转换为false的值)等价
299
292
  */
300
- platform?: (platfrom | string) | undefined,
301
- /**
302
- * Same Platform Multiple Origin
303
- * @description 解决B站等同一番剧存在港澳台站、多语言配音(不同一CID)的问题,同时方便过滤
304
- * @description 示例:
305
- * - main: 主站
306
- * - hm: 仅港澳
307
- * - t: 仅台
308
- * - hmt: 仅港澳台
309
- * - lang:{ISO语言代号}: 多语言
310
- */
311
- SPMO?: string | undefined,
293
+ platform?: (PlatformDanmakuSource | string) | undefined,
312
294
  /**
313
295
  * 弹幕原始数据(不推荐使用)
314
296
  * @description 适用于无法解析的B站代码弹幕、Artplayer弹幕样式等
@@ -322,12 +304,16 @@ export declare class UniDM {
322
304
  /**
323
305
  * 弹幕id
324
306
  * @description sha3-256(content+senderID+ctime)截取前8位
325
- * @description 同一FCID下唯一
307
+ * @description 同一SOID下唯一
326
308
  */
327
309
  toDMID(): string;
328
310
  isSameAs(dan: UniDM, _check2?: boolean): boolean;
329
- minify(): Partial<UniDMObj> & Pick<UniDMObj, "FCID">;
330
- downgradeAdvcancedDan(): this | undefined;
311
+ minify(): Partial<UniDMObj> & Pick<UniDMObj, "SOID">;
312
+ downgradeAdvcancedDan({ include, exclude, cleanExtra, }?: {
313
+ include?: (keyof Extra)[];
314
+ exclude?: (keyof Extra)[];
315
+ cleanExtra?: boolean;
316
+ }): UniDM;
331
317
  /**
332
318
  * 将各种类型的时间进行格式化
333
319
  * @param oriCtime
@@ -337,13 +323,13 @@ export declare class UniDM {
337
323
  */
338
324
  static transCtime(oriCtime: ctime, tsUnit?: 'ms' | 's'): Date;
339
325
  static transMode(oriMode: number, fmt: 'bili' | 'dplayer' | 'artplayer' | 'ddplay'): Modes;
340
- static fromBili(args: DMBili, SPMO?: string, cid?: bigint): UniDM;
341
- static fromBiliCommand(args: DMBiliCommand, SPMO?: string, cid?: bigint): UniDM;
326
+ static fromBili(args: DMBili, cid?: bigint): UniDM;
327
+ static fromBiliCommand(args: DMBiliCommand, cid?: bigint): UniDM;
342
328
  static fromDplayer(args: DMDplayer, playerID: string, domain: string): UniDM;
343
329
  toDplayer(): DMDplayer;
344
330
  static fromArtplayer(args: DMArtplayer, playerID: string, domain: string): UniDM;
345
331
  toArtplayer(): DMArtplayer;
346
- static fromDDplay(args: DMDDplay, episodeId: string, domain?: string): UniDM;
332
+ static fromDDplay(args: DMDDplay, episodeId: string, domain?: PlatformDanmakuOnlySource): UniDM;
347
333
  toDDplay(): DMDDplay;
348
334
  }
349
335
  export {};
@@ -1,15 +1,5 @@
1
1
  import type { ctime } from './dm-gen';
2
- export declare const domainPreset: {
3
- acfun: string;
4
- baha: string;
5
- bgm: string;
6
- bili: string;
7
- bglobal: string;
8
- ddplay: string;
9
- tucao: string;
10
- };
11
- export type platfrom = 'acfun' | 'baha' | 'bili' | 'bglobal' | 'ddplay' | 'danuni' | 'tucao' | 'other';
12
- export declare const platforms: platfrom[];
2
+ import type { PlatformSource } from './platform';
13
3
  export declare class UniID {
14
4
  /**
15
5
  * @description 每个domain下应为唯一值
@@ -23,16 +13,9 @@ export declare class UniID {
23
13
  * - `{any}.danuni` (若使用IP或无域名,请使用该domain,防止隐私泄露/无法解析)
24
14
  * #### 注意
25
15
  * - `any`值建议为UUID/ULID/NanoID以防同步错误
26
- * ### 非DanUni弹幕服务预设(默认采用其最短服务域名)
27
- * - `acfun.cn`
28
- * - `ani.gamer.com.tw` (Baha)
29
- * - `bgm.tv` (bangumi)
30
- * - `b23.tv` (比bilibili.com短,省空间)
31
- * - `biliintl.com` (即bilibili.tv)
32
- * - `dandanplay.com`
33
- * - `tucao` (由于其域名常变,故分配固定解析,运行时解析)
16
+ * ### 非DanUni弹幕服务建议使用预设,或自行填写域名
34
17
  */
35
- domain: string;
18
+ domain: PlatformSource | string;
36
19
  constructor(
37
20
  /**
38
21
  * @description 每个domain下应为唯一值
@@ -46,18 +29,11 @@ export declare class UniID {
46
29
  * - `{any}.danuni` (若使用IP或无域名,请使用该domain,防止隐私泄露/无法解析)
47
30
  * #### 注意
48
31
  * - `any`值建议为UUID/ULID/NanoID以防同步错误
49
- * ### 非DanUni弹幕服务预设(默认采用其最短服务域名)
50
- * - `acfun.cn`
51
- * - `ani.gamer.com.tw` (Baha)
52
- * - `bgm.tv` (bangumi)
53
- * - `b23.tv` (比bilibili.com短,省空间)
54
- * - `biliintl.com` (即bilibili.tv)
55
- * - `dandanplay.com`
56
- * - `tucao` (由于其域名常变,故分配固定解析,运行时解析)
32
+ * ### 非DanUni弹幕服务建议使用预设,或自行填写域名
57
33
  */
58
- domain: string);
34
+ domain: PlatformSource | string);
59
35
  toString(): string;
60
- static fromNull(domain?: string): UniID;
36
+ static fromNull(domain?: PlatformSource | 'runtime' | string): UniID;
61
37
  static fromBili({ cid, mid, midHash, }: {
62
38
  cid?: number | bigint | string;
63
39
  mid?: number | bigint;
@@ -65,8 +41,8 @@ export declare class UniID {
65
41
  }): UniID;
66
42
  static fromUnknown(id: string,
67
43
  /**
68
- * 可使用预设`acfun` `baha` `bili` `bglobal` `ddplay` `tucao`代替其域名
44
+ * 可使用预设
69
45
  */
70
- domain: platfrom | string): UniID;
46
+ domain: PlatformSource | string): UniID;
71
47
  }
72
48
  export declare function createDMID(content: string | undefined, senderID: string, ctime: ctime, slice?: number): string;
@@ -0,0 +1,24 @@
1
+ export declare enum PlatformInfoSource {
2
+ Bangumi = "bgm",
3
+ TMDB = "tmdb"
4
+ }
5
+ export declare const PlatformInfoSources: PlatformInfoSource[];
6
+ export declare enum PlatformVideoSource {
7
+ Acfun = "acfun",
8
+ Baha = "baha",
9
+ Bilibili = "bili",
10
+ BilibiliGlobal = "bglobal",
11
+ Iqiyi = "iqiyi",
12
+ Tencent = "tencent",
13
+ Youku = "youku"
14
+ }
15
+ export declare const PlatformVideoSources: PlatformVideoSource[];
16
+ export declare enum PlatformDanmakuOnlySource {
17
+ DanDanPlay = "ddplay",
18
+ TuCao = "tucao"
19
+ }
20
+ export declare const PlatformDanmakuOnlySources: PlatformDanmakuOnlySource[];
21
+ export type PlatformDanmakuSource = PlatformVideoSource | PlatformDanmakuOnlySource;
22
+ export declare const PlatformDanmakuSources: (PlatformVideoSource | PlatformDanmakuOnlySource)[];
23
+ export type PlatformSource = PlatformInfoSource | PlatformDanmakuSource;
24
+ export declare const PlatformSources: (PlatformInfoSource | PlatformVideoSource | PlatformDanmakuOnlySource)[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dan-uni/dan-any",
3
- "version": "0.2.4",
3
+ "version": "0.4.7",
4
4
  "description": "A danmaku transformer lib, supporting danmaku from different platforms.",
5
5
  "keywords": [
6
6
  "bangumi",
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "author": "rinne",
19
19
  "main": "dist/index.js",
20
- "module": "dist/index.js",
20
+ "module": "src/index.ts",
21
21
  "types": "dist/src/index.d.ts",
22
22
  "browser": "dist/index.umd.min.js",
23
23
  "scripts": {
@@ -32,15 +32,18 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "base16384": "^1.0.0",
35
- "canvas": "^3.1.0",
36
- "fast-xml-parser": "^4.5.1",
35
+ "canvas": "^3.1.2",
36
+ "fast-xml-parser": "^5.2.5",
37
+ "fs-extra": "^11.3.0",
38
+ "hh-mm-ss": "^1.2.0",
37
39
  "jssha": "^3.3.1"
38
40
  },
39
41
  "devDependencies": {
40
- "@bufbuild/buf": "^1.50.0",
41
- "@bufbuild/protobuf": "^2.2.3",
42
- "@bufbuild/protoc-gen-es": "^2.2.3",
43
- "@types/pako": "^2.0.3",
44
- "protobufjs": "^7.4.0"
42
+ "@bufbuild/buf": "^1.55.1",
43
+ "@bufbuild/protobuf": "^2.6.0",
44
+ "@bufbuild/protoc-gen-es": "^2.6.0",
45
+ "@types/fs-extra": "^11.0.4",
46
+ "@types/hh-mm-ss": "^1.2.3",
47
+ "protobufjs": "^7.5.3"
45
48
  }
46
49
  }