@dan-uni/dan-any 0.0.2

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.
@@ -0,0 +1,145 @@
1
+ import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1";
2
+ import type { Timestamp } from "@bufbuild/protobuf/wkt";
3
+ import type { Message } from "@bufbuild/protobuf";
4
+ /**
5
+ * Describes the file danuni.proto.
6
+ */
7
+ export declare const file_danuni: GenFile;
8
+ /**
9
+ * @generated from message danuni.danmaku.v1.Danmaku
10
+ */
11
+ export type Danmaku = Message<"danuni.danmaku.v1.Danmaku"> & {
12
+ /**
13
+ * @generated from field: string FCID = 1;
14
+ */
15
+ FCID: string;
16
+ /**
17
+ * @generated from field: string DMID = 2;
18
+ */
19
+ DMID: string;
20
+ /**
21
+ * @generated from field: int32 progress = 3;
22
+ */
23
+ progress: number;
24
+ /**
25
+ * @generated from field: danuni.danmaku.v1.Mode mode = 4;
26
+ */
27
+ mode: Mode;
28
+ /**
29
+ * @generated from field: int32 fontsize = 5;
30
+ */
31
+ fontsize: number;
32
+ /**
33
+ * @generated from field: int32 color = 6;
34
+ */
35
+ color: number;
36
+ /**
37
+ * @generated from field: string senderID = 7;
38
+ */
39
+ senderID: string;
40
+ /**
41
+ * @generated from field: string content = 8;
42
+ */
43
+ content: string;
44
+ /**
45
+ * @generated from field: google.protobuf.Timestamp ctime = 9;
46
+ */
47
+ ctime?: Timestamp;
48
+ /**
49
+ * @generated from field: int32 weight = 10;
50
+ */
51
+ weight: number;
52
+ /**
53
+ * @generated from field: danuni.danmaku.v1.Pool pool = 11;
54
+ */
55
+ pool: Pool;
56
+ /**
57
+ * @generated from field: repeated string attr = 12;
58
+ */
59
+ attr: string[];
60
+ /**
61
+ * @generated from field: string platform = 13;
62
+ */
63
+ platform: string;
64
+ /**
65
+ * @generated from field: optional string SPMO = 14;
66
+ */
67
+ SPMO?: string;
68
+ /**
69
+ * @generated from field: optional string extra = 15;
70
+ */
71
+ extra?: string;
72
+ };
73
+ /**
74
+ * Describes the message danuni.danmaku.v1.Danmaku.
75
+ * Use `create(DanmakuSchema)` to create a new message.
76
+ */
77
+ export declare const DanmakuSchema: GenMessage<Danmaku>;
78
+ /**
79
+ * @generated from message danuni.danmaku.v1.DanmakuReply
80
+ */
81
+ export type DanmakuReply = Message<"danuni.danmaku.v1.DanmakuReply"> & {
82
+ /**
83
+ * @generated from field: repeated danuni.danmaku.v1.Danmaku danmakus = 1;
84
+ */
85
+ danmakus: Danmaku[];
86
+ };
87
+ /**
88
+ * Describes the message danuni.danmaku.v1.DanmakuReply.
89
+ * Use `create(DanmakuReplySchema)` to create a new message.
90
+ */
91
+ export declare const DanmakuReplySchema: GenMessage<DanmakuReply>;
92
+ /**
93
+ * @generated from enum danuni.danmaku.v1.Mode
94
+ */
95
+ export declare enum Mode {
96
+ /**
97
+ * @generated from enum value: Normal = 0;
98
+ */
99
+ Normal = 0,
100
+ /**
101
+ * @generated from enum value: Bottom = 1;
102
+ */
103
+ Bottom = 1,
104
+ /**
105
+ * @generated from enum value: Top = 2;
106
+ */
107
+ Top = 2,
108
+ /**
109
+ * @generated from enum value: Reverse = 3;
110
+ */
111
+ Reverse = 3,
112
+ /**
113
+ * @generated from enum value: Ext = 4;
114
+ */
115
+ Ext = 4
116
+ }
117
+ /**
118
+ * Describes the enum danuni.danmaku.v1.Mode.
119
+ */
120
+ export declare const ModeSchema: GenEnum<Mode>;
121
+ /**
122
+ * @generated from enum danuni.danmaku.v1.Pool
123
+ */
124
+ export declare enum Pool {
125
+ /**
126
+ * @generated from enum value: Def = 0;
127
+ */
128
+ Def = 0,
129
+ /**
130
+ * @generated from enum value: Sub = 1;
131
+ */
132
+ Sub = 1,
133
+ /**
134
+ * @generated from enum value: Adv = 2;
135
+ */
136
+ Adv = 2,
137
+ /**
138
+ * @generated from enum value: Ix = 3;
139
+ */
140
+ Ix = 3
141
+ }
142
+ /**
143
+ * Describes the enum danuni.danmaku.v1.Pool.
144
+ */
145
+ export declare const PoolSchema: GenEnum<Pool>;
@@ -0,0 +1,314 @@
1
+ import type { DM_JSON_BiliCommandGrpc } from '..';
2
+ import type { platfrom } from './id-gen';
3
+ export type DMAttr = 'Protect' | 'FromLive' | 'HighLike' | 'Compatible' | 'Reported';
4
+ interface DMBili {
5
+ id: bigint;
6
+ progress: number;
7
+ mode: number;
8
+ fontsize: number;
9
+ color: number;
10
+ midHash: string;
11
+ /**
12
+ * 特殊类型解析:
13
+ * - [ohh] : /oh{2,}/gi
14
+ * - [前方高能]
15
+ * - [...] (JS数组) : 高级弹幕
16
+ */
17
+ content: string;
18
+ ctime: bigint;
19
+ pool: number;
20
+ weight?: number;
21
+ action?: string;
22
+ idStr?: string;
23
+ attr?: number;
24
+ animation?: string;
25
+ extra?: string;
26
+ colorful?: number;
27
+ type?: number;
28
+ oid?: bigint;
29
+ }
30
+ interface DMBiliCommand extends DM_JSON_BiliCommandGrpc {
31
+ }
32
+ interface DMDplayer {
33
+ /**
34
+ * 进度(秒)
35
+ */
36
+ progress: number;
37
+ mode: number;
38
+ color: number;
39
+ midHash: string;
40
+ content: string;
41
+ }
42
+ interface DMArtplayer {
43
+ /**
44
+ * 进度(秒)
45
+ */
46
+ progress: number;
47
+ mode: number;
48
+ color: number;
49
+ content: string;
50
+ border?: boolean;
51
+ style?: object;
52
+ }
53
+ interface DMDDplay {
54
+ cid: number;
55
+ /**
56
+ * content
57
+ */
58
+ m: string;
59
+ /**
60
+ * p[0]
61
+ */
62
+ progress: number;
63
+ /**
64
+ * p[1]
65
+ */
66
+ mode: number;
67
+ /**
68
+ * p[2]
69
+ */
70
+ color: number;
71
+ /**
72
+ * p[3]
73
+ */
74
+ uid: string;
75
+ }
76
+ export interface Extra {
77
+ artplayer?: ExtraArtplayer;
78
+ bili?: ExtraBili;
79
+ danuni?: ExtraDanUni;
80
+ }
81
+ interface ExtraArtplayer {
82
+ style?: object;
83
+ border?: boolean;
84
+ }
85
+ interface ExtraBili {
86
+ mode: number;
87
+ pool: number;
88
+ adv?: string;
89
+ code?: string;
90
+ bas?: string;
91
+ command?: DMBiliCommand;
92
+ }
93
+ export interface ExtraDanUni {
94
+ chapter?: {
95
+ duration: number;
96
+ type: ExtraDanUniChapterType;
97
+ };
98
+ }
99
+ export declare enum ExtraDanUniChapterType {
100
+ Chapter = "ch",//其它片段(用于标记章节)
101
+ Review = "rev",//回顾
102
+ OP = "op",//片头
103
+ Intermission = "int",//中场
104
+ ED = "ed",//片尾
105
+ Preview = "prvw",//预告
106
+ Cut = "cut",//删减(删减版中提供删减说明,提供开始位置、长度)
107
+ Duplicates = "dup",//补档(完整版中指明其它平台中删减位置)
108
+ AdBiz = "biz",//商业广告
109
+ AdUnpaid = "promo"
110
+ }
111
+ export declare enum ExtraDanUniChapterAction {
112
+ Disabled = -1,
113
+ ShowOverlay = 0,
114
+ ManualSkip = 1,
115
+ AutoSkip = 2
116
+ }
117
+ export declare enum Modes {
118
+ Normal = 0,
119
+ Bottom = 1,
120
+ Top = 2,
121
+ Reverse = 3,//逆向弹幕
122
+ Ext = 4
123
+ }
124
+ export declare enum Pools {
125
+ Def = 0,//默认池
126
+ Sub = 1,//重要池,建议强制加载,含字幕、科普、空降等
127
+ Adv = 2,//高级弹幕专用池,均需读取extra
128
+ Ix = 3
129
+ }
130
+ export type ctime = string | number | bigint | Date;
131
+ /**
132
+ * 所有 number/bigint 值设为0自动转换为默认
133
+ */
134
+ export declare class UniDM {
135
+ /**
136
+ * FCID
137
+ */
138
+ FCID: string;
139
+ /**
140
+ * 弹幕出现位置(单位ms)
141
+ */
142
+ progress: number;
143
+ /**
144
+ * 类型 1 2 3:普通弹幕 4:底部弹幕 5:顶部弹幕 6:逆向弹幕 7:高级弹幕 8:代码弹幕 9:BAS弹幕(pool必须为2)
145
+ */
146
+ mode: Modes;
147
+ /**
148
+ * 字号
149
+ * @default 25
150
+ * - 18:小
151
+ * - 25:标准
152
+ * - 36:大
153
+ */
154
+ fontsize: number;
155
+ /**
156
+ * 颜色
157
+ * @description 为DEC值(十进制RGB888值),默认白色
158
+ * @default 16777215
159
+ */
160
+ color: number;
161
+ /**
162
+ * 发送者 senderID
163
+ */
164
+ senderID: string;
165
+ /**
166
+ * 正文
167
+ */
168
+ content: string;
169
+ /**
170
+ * 发送时间
171
+ */
172
+ ctime: Date;
173
+ /**
174
+ * 权重 用于屏蔽等级 区间:[1,10]
175
+ * @description 参考B站,源弹幕有该参数则直接利用,
176
+ * 本实现默认取5,再经过ruleset匹配加减分数
177
+ * @description 特殊情况下接受值为0,即设置0需转换为默认权重(5)
178
+ */
179
+ weight: number;
180
+ /**
181
+ * 弹幕池 0:普通池 1:字幕池 2:特殊池(代码/BAS弹幕) 3:互动池(互动弹幕中选择投票快速发送的弹幕)
182
+ */
183
+ pool: Pools;
184
+ /**
185
+ * 弹幕属性位(bin求AND)
186
+ * bit0:保护 bit1:直播 bit2:高赞
187
+ */
188
+ attr: DMAttr[];
189
+ /**
190
+ * 初始来源平台
191
+ * `danuni`与任意空值(可隐式转换为false的值)等价
192
+ */
193
+ platform?: (platfrom | string) | undefined;
194
+ /**
195
+ * Same Platform Multiple Origin
196
+ * @description 解决B站等同一番剧存在港澳台站、多语言配音(不同一CID)的问题,同时方便过滤
197
+ * @description 示例:
198
+ * - main: 主站
199
+ * - hm: 仅港澳
200
+ * - t: 仅台
201
+ * - hmt: 仅港澳台
202
+ * - lang:{ISO语言代号}: 多语言
203
+ */
204
+ SPMO?: string | undefined;
205
+ /**
206
+ * 弹幕原始数据(不推荐使用)
207
+ * @description 适用于无法解析的B站代码弹幕、Artplayer弹幕样式等
208
+ * @description 初步约定:
209
+ * - Artplayer: style不为空时,将其JSON.stringify()存入
210
+ */
211
+ extraStr?: string | undefined;
212
+ DMID?: string | undefined;
213
+ /**
214
+ * 同步时确认位置的参数
215
+ */
216
+ constructor(
217
+ /**
218
+ * FCID
219
+ */
220
+ FCID: string,
221
+ /**
222
+ * 弹幕出现位置(单位ms)
223
+ */
224
+ progress?: number,
225
+ /**
226
+ * 类型 1 2 3:普通弹幕 4:底部弹幕 5:顶部弹幕 6:逆向弹幕 7:高级弹幕 8:代码弹幕 9:BAS弹幕(pool必须为2)
227
+ */
228
+ mode?: Modes,
229
+ /**
230
+ * 字号
231
+ * @default 25
232
+ * - 18:小
233
+ * - 25:标准
234
+ * - 36:大
235
+ */
236
+ fontsize?: number,
237
+ /**
238
+ * 颜色
239
+ * @description 为DEC值(十进制RGB888值),默认白色
240
+ * @default 16777215
241
+ */
242
+ color?: number,
243
+ /**
244
+ * 发送者 senderID
245
+ */
246
+ senderID?: string,
247
+ /**
248
+ * 正文
249
+ */
250
+ content?: string,
251
+ /**
252
+ * 发送时间
253
+ */
254
+ ctime?: Date,
255
+ /**
256
+ * 权重 用于屏蔽等级 区间:[1,10]
257
+ * @description 参考B站,源弹幕有该参数则直接利用,
258
+ * 本实现默认取5,再经过ruleset匹配加减分数
259
+ * @description 特殊情况下接受值为0,即设置0需转换为默认权重(5)
260
+ */
261
+ weight?: number,
262
+ /**
263
+ * 弹幕池 0:普通池 1:字幕池 2:特殊池(代码/BAS弹幕) 3:互动池(互动弹幕中选择投票快速发送的弹幕)
264
+ */
265
+ pool?: Pools,
266
+ /**
267
+ * 弹幕属性位(bin求AND)
268
+ * bit0:保护 bit1:直播 bit2:高赞
269
+ */
270
+ attr?: DMAttr[],
271
+ /**
272
+ * 初始来源平台
273
+ * `danuni`与任意空值(可隐式转换为false的值)等价
274
+ */
275
+ platform?: (platfrom | string) | undefined,
276
+ /**
277
+ * Same Platform Multiple Origin
278
+ * @description 解决B站等同一番剧存在港澳台站、多语言配音(不同一CID)的问题,同时方便过滤
279
+ * @description 示例:
280
+ * - main: 主站
281
+ * - hm: 仅港澳
282
+ * - t: 仅台
283
+ * - hmt: 仅港澳台
284
+ * - lang:{ISO语言代号}: 多语言
285
+ */
286
+ SPMO?: string | undefined,
287
+ /**
288
+ * 弹幕原始数据(不推荐使用)
289
+ * @description 适用于无法解析的B站代码弹幕、Artplayer弹幕样式等
290
+ * @description 初步约定:
291
+ * - Artplayer: style不为空时,将其JSON.stringify()存入
292
+ */
293
+ extraStr?: string | undefined, DMID?: string | undefined);
294
+ get extra(): Extra;
295
+ get isFrom3rdPlatform(): boolean;
296
+ /**
297
+ * 弹幕id
298
+ * @description sha3-256(content+senderID+ctime)截取前8位
299
+ * @description 同一FCID下唯一
300
+ */
301
+ toDMID(): string;
302
+ downgradeAdvcancedDan(): this | undefined;
303
+ static transCtime(oriCtime: ctime): Date;
304
+ static transMode(oriMode: number, fmt: 'bili' | 'dplayer' | 'artplayer' | 'ddplay'): Modes;
305
+ static fromBili(args: DMBili, SPMO?: string, cid?: bigint): UniDM;
306
+ static fromBiliCommand(args: DMBiliCommand, SPMO?: string, cid?: bigint): UniDM;
307
+ static fromDplayer(args: DMDplayer, playerID: string, domain: string): UniDM;
308
+ toDplayer(): DMDplayer;
309
+ static fromArtplayer(args: DMArtplayer, playerID: string, domain: string): UniDM;
310
+ toArtplayer(): DMArtplayer;
311
+ static fromDDplay(args: DMDDplay, episodeId: string, domain?: string): UniDM;
312
+ toDDplay(): DMDDplay;
313
+ }
314
+ export {};
@@ -0,0 +1,72 @@
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[];
13
+ export declare class UniID {
14
+ /**
15
+ * @description 每个domain下应为唯一值
16
+ * @example danuni: 推荐为UUID/ULID/NanoID
17
+ * bili: midHash hash算法为CRC32
18
+ */
19
+ id: string;
20
+ /**
21
+ * @description 弹幕首次出现的平台域名(注意可以为如localhost等根域名)
22
+ * ### 预设
23
+ * - `{any}.danuni` (若使用IP或无域名,请使用该domain,防止隐私泄露/无法解析)
24
+ * #### 注意
25
+ * - `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` (由于其域名常变,故分配固定解析,运行时解析)
34
+ */
35
+ domain: string;
36
+ constructor(
37
+ /**
38
+ * @description 每个domain下应为唯一值
39
+ * @example danuni: 推荐为UUID/ULID/NanoID
40
+ * bili: midHash hash算法为CRC32
41
+ */
42
+ id: string,
43
+ /**
44
+ * @description 弹幕首次出现的平台域名(注意可以为如localhost等根域名)
45
+ * ### 预设
46
+ * - `{any}.danuni` (若使用IP或无域名,请使用该domain,防止隐私泄露/无法解析)
47
+ * #### 注意
48
+ * - `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` (由于其域名常变,故分配固定解析,运行时解析)
57
+ */
58
+ domain: string);
59
+ toString(): string;
60
+ static fromNull(domain?: string): UniID;
61
+ static fromBili({ cid, mid, midHash, }: {
62
+ cid?: number | bigint | string;
63
+ mid?: number | bigint;
64
+ midHash?: string;
65
+ }): UniID;
66
+ static fromUnknown(id: string,
67
+ /**
68
+ * 可使用预设`acfun` `baha` `bili` `bglobal` `ddplay` `tucao`代替其域名
69
+ */
70
+ domain: platfrom | string): UniID;
71
+ }
72
+ export declare function createDMID(content: string | undefined, senderID: string, ctime: ctime, slice?: number): string;
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@dan-uni/dan-any",
3
+ "version": "0.0.2",
4
+ "description": "The toolbox of dan-uni.",
5
+ "keywords": [
6
+ "bangumi",
7
+ "danmaku"
8
+ ],
9
+ "license": "LGPL-3.0-or-later",
10
+ "homepage": "https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/ani-uni/danuni/issues"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/ani-uni/danuni.git"
17
+ },
18
+ "author": "rinne",
19
+ "main": "dist/index.js",
20
+ "module": "dist/index.js",
21
+ "types": "dist/index.d.ts",
22
+ "browser": "dist/index.umd.min.js",
23
+ "scripts": {
24
+ "test": "vitest",
25
+ "test:ui": "vitest --ui",
26
+ "coverage": "vitest run --coverage",
27
+ "bench": "vitest bench",
28
+ "lint": "eslint",
29
+ "build": "pnpm buf && rollup -c",
30
+ "build:types": "tsc",
31
+ "dev": "pnpm build && node bundle.js",
32
+ "buf": "buf generate"
33
+ },
34
+ "dependencies": {
35
+ "fast-xml-parser": "^4.5.1",
36
+ "jssha": "^3.3.1"
37
+ },
38
+ "devDependencies": {
39
+ "@bufbuild/buf": "^1.50.0",
40
+ "@bufbuild/protobuf": "^2.2.3",
41
+ "@bufbuild/protoc-gen-es": "^2.2.3",
42
+ "protobufjs": "^7.4.0",
43
+ "tslib": "^2.8.1"
44
+ }
45
+ }
@@ -0,0 +1,51 @@
1
+ import babel from '@rollup/plugin-babel'
2
+ import commonjs from '@rollup/plugin-commonjs'
3
+ import json from '@rollup/plugin-json'
4
+ import resolve from '@rollup/plugin-node-resolve'
5
+ import terser from '@rollup/plugin-terser'
6
+ import typescript from '@rollup/plugin-typescript'
7
+
8
+ // prettier 不识别 with 参数
9
+ // import pkg from './package.json'
10
+ import pkg from './package.json' with { type: 'json' }
11
+
12
+ const name = 'DanAny'
13
+
14
+ /** @type {import('rollup').RollupOptions} */
15
+ export default {
16
+ input: 'src/index.ts',
17
+ output: [
18
+ {
19
+ file: 'dist/index.min.js',
20
+ format: 'iife',
21
+ name,
22
+ plugins: [terser()],
23
+ },
24
+ {
25
+ file: 'dist/index.umd.min.js',
26
+ format: 'umd',
27
+ name,
28
+ plugins: [terser()],
29
+ },
30
+ {
31
+ file: 'dist/index.js',
32
+ format: 'esm',
33
+ plugins: [terser()],
34
+ },
35
+ ],
36
+ external: [pkg.peerDependencies, pkg.dependencies],
37
+ plugins: [
38
+ json(),
39
+ commonjs(),
40
+ resolve(),
41
+ typescript({
42
+ outDir: 'dist',
43
+ declaration: true,
44
+ declarationDir: 'dist',
45
+ }),
46
+ babel({
47
+ babelHelpers: 'bundled',
48
+ exclude: 'node_modules/**', // 只编译我们的源代码
49
+ }),
50
+ ],
51
+ }
@@ -0,0 +1,51 @@
1
+ //基于以下注释,根据vitest生成测试用例
2
+ import { describe, it } from 'vitest'
3
+
4
+ import { UniPool } from './index'
5
+
6
+ describe('转化自', () => {
7
+ it('bili(xml)', () => {
8
+ const xml = `<i>
9
+ <chatserver>chat.bilibili.com</chatserver>
10
+ <chatid>1156756312</chatid>
11
+ <mission>0</mission>
12
+ <maxlimit>2947</maxlimit>
13
+ <state>0</state>
14
+ <real_name>0</real_name>
15
+ <source>k-v</source>
16
+ <d p="13.213,1,25,16777215,1686314041,3,ff41173d,1335658005672492032">喜欢</d>
17
+ <d p="13.213,1,25,16777215,1686590010,0,296b35b5,1337972999512832512">来了 哈哈~~</d>
18
+ <d p="13.246,1,25,16777215,1686276875,0,5664cfc4,1335346233459549696">就是</d>
19
+ <d p="13.266,1,25,16777215,1686283375,0,c7e6646f,1335400761013670912">什么鬼?</d>
20
+ <d p="13.284,1,25,16777215,1686291338,0,38662881,1335467554877267456">哇哦</d>
21
+ <d p="13.306,1,25,16777215,1686268410,0,4c01de10,1335275224983600896">试试</d>
22
+ <d p="13.331,1,25,16777215,1686948453,3,56a3c5d5,1340979831550069760">不喜欢</d>
23
+ <d p="13.374,1,25,16777215,1686300770,3,647fe355,1335546672880933888">不喜欢</d>
24
+ <d p="13.376,1,25,16777215,1686297921,0,469d94b8,1335522778300134400">哦豁</d>
25
+ <d p="13.419,1,25,8700107,1686268005,0,be402447,1335271828100244224">太酷啦</d>
26
+ <d p="13.419,1,25,16777215,1686316828,3,7ffb6619,1335681385016736768">喜欢</d>
27
+ <d p="13.459,1,25,16777215,1686299729,0,45834405,1335537942797634048">一般,不好看</d>
28
+ <d p="13.462,1,25,16777215,1686302133,0,3cab672c,1335558106620590080">哈哈哈</d>
29
+ <d p="13.481,1,25,16777215,1686297342,0,ce67fafd,1335517923728804864">?</d>
30
+ <d p="13.499,1,25,16777215,1686301548,3,2848bf1c,1335553202649003264">不喜欢</d>
31
+ </i>`,
32
+ pool = UniPool.fromBiliXML(xml)
33
+ console.info(xml)
34
+ console.info(pool)
35
+ })
36
+ it('bili(json)', () => {
37
+ const json = [
38
+ {
39
+ text: '', // 弹幕文本
40
+ time: 10, // 弹幕时间, 默认为当前播放器时间
41
+ mode: 0, // 弹幕模式: 0: 滚动(默认),1: 顶部,2: 底部
42
+ color: '#FFFFFF', // 弹幕颜色,默认为白色
43
+ border: false, // 弹幕是否有描边, 默认为 false
44
+ style: { border: '10rem' }, // 弹幕自定义样式, 默认为空对象
45
+ },
46
+ ],
47
+ pool = UniPool.fromArtplayer(json, 'playerid-test', 'acfun')
48
+ console.info(json)
49
+ console.info(pool)
50
+ })
51
+ })