@laplace.live/internal 1.3.20 → 1.3.22
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/package.json +1 -1
- package/src/namespaces/danmakus.d.ts +341 -339
package/package.json
CHANGED
|
@@ -16,32 +16,52 @@ export declare namespace Danmakus {
|
|
|
16
16
|
data: RankingItem[]
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
/**
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Channel info, shared by `RankingItem`, `ChannelInfoProps` and
|
|
21
|
+
* `WatchedChannelsItem` (maps to `APIChannelInfo` in the spec).
|
|
22
|
+
*/
|
|
23
|
+
export interface ChannelInfo {
|
|
21
24
|
uId: number
|
|
22
25
|
uName: string
|
|
23
26
|
roomId: number
|
|
24
27
|
faceUrl: string
|
|
25
28
|
frameUrl: string
|
|
26
29
|
isLiving: boolean
|
|
30
|
+
isDeleted: boolean
|
|
27
31
|
title: string
|
|
28
32
|
tags: string[]
|
|
29
33
|
lastLiveDate: number
|
|
30
34
|
lastLiveDanmakuCount: number
|
|
31
35
|
totalDanmakuCount: number
|
|
32
|
-
totalIncome:
|
|
33
|
-
value: string
|
|
34
|
-
type: 'Big Number'
|
|
35
|
-
}
|
|
36
|
+
totalIncome: number
|
|
36
37
|
totalLiveCount: number
|
|
37
38
|
totalLiveSecond: number
|
|
38
39
|
addDate: Date
|
|
39
40
|
/** can be empty in some rare case due to some program error */
|
|
40
41
|
livingInfo?: LiveItem
|
|
41
42
|
commentCount: number
|
|
43
|
+
fansCount: number
|
|
44
|
+
followCount: number
|
|
45
|
+
lastUpdateStatAt: number
|
|
42
46
|
lastLiveIncome: number
|
|
47
|
+
recordingStatus?: ChannelRecordingStatus | null
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Recording status of a channel (`APIChannelRecordingStatus`) */
|
|
51
|
+
export interface ChannelRecordingStatus {
|
|
52
|
+
publicUsers: ChannelRecordingUser[]
|
|
53
|
+
privateCount: number
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Item of `ChannelRecordingStatus.publicUsers` (`APIChannelRecordingUser`) */
|
|
57
|
+
export interface ChannelRecordingUser {
|
|
58
|
+
accountId: number
|
|
59
|
+
name: string
|
|
43
60
|
}
|
|
44
61
|
|
|
62
|
+
/** Item of `RankingProps` */
|
|
63
|
+
export interface RankingItem extends ChannelInfo {}
|
|
64
|
+
|
|
45
65
|
/**
|
|
46
66
|
* 频道信息(直播记录列表)
|
|
47
67
|
* @link https://ukamnads.icu/api/v2/channel?uId=2132180406
|
|
@@ -74,45 +94,42 @@ export declare namespace Danmakus {
|
|
|
74
94
|
}
|
|
75
95
|
|
|
76
96
|
/** Props of `ChannelData` */
|
|
77
|
-
export interface ChannelInfoProps {
|
|
78
|
-
uId: number
|
|
79
|
-
uName: string
|
|
80
|
-
roomId: number
|
|
81
|
-
faceUrl: string
|
|
82
|
-
frameUrl: string
|
|
83
|
-
isLiving: boolean
|
|
84
|
-
title: string
|
|
85
|
-
tags: string[]
|
|
86
|
-
lastLiveDate: number
|
|
87
|
-
lastLiveDanmakuCount: number
|
|
88
|
-
totalDanmakuCount: number
|
|
89
|
-
totalIncome: number
|
|
90
|
-
totalLiveCount: number
|
|
91
|
-
totalLiveSecond: number
|
|
92
|
-
addDate: Date
|
|
93
|
-
commentCount: number
|
|
94
|
-
lastLiveIncome: number
|
|
95
|
-
}
|
|
97
|
+
export interface ChannelInfoProps extends ChannelInfo {}
|
|
96
98
|
|
|
97
|
-
/** General live stream item */
|
|
99
|
+
/** General live stream item (`APILiveInfo`) */
|
|
98
100
|
export interface LiveItem {
|
|
99
101
|
liveId: string
|
|
100
102
|
isFinish: boolean
|
|
101
103
|
isFull: boolean
|
|
104
|
+
isMerged: boolean
|
|
102
105
|
parentArea: string
|
|
103
106
|
area: string
|
|
104
107
|
coverUrl: string
|
|
105
108
|
danmakusCount: number
|
|
106
109
|
startDate: number
|
|
107
|
-
stopDate: number
|
|
110
|
+
stopDate: number | null
|
|
108
111
|
title: string
|
|
109
112
|
totalIncome: number
|
|
110
113
|
watchCount: number
|
|
111
114
|
likeCount: number
|
|
112
115
|
payCount: number
|
|
113
116
|
interactionCount: number
|
|
114
|
-
onlineRank: number
|
|
117
|
+
onlineRank: number | null
|
|
115
118
|
maxOnlineCount: number
|
|
119
|
+
commentCount: number
|
|
120
|
+
/** present when requested with `includeExtra=true` */
|
|
121
|
+
extra?: ExtraProps
|
|
122
|
+
versions?: LiveVersionInfo[]
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** Item of `LiveItem.versions` (`APILiveVersionInfo`) */
|
|
126
|
+
export interface LiveVersionInfo {
|
|
127
|
+
live: LiveItem
|
|
128
|
+
userName: string
|
|
129
|
+
userId: number
|
|
130
|
+
isOfficial: boolean
|
|
131
|
+
isFull: boolean
|
|
132
|
+
rangeDanmakusCount: number
|
|
116
133
|
}
|
|
117
134
|
|
|
118
135
|
/** General danmaku event props */
|
|
@@ -130,17 +147,23 @@ export declare namespace Danmakus {
|
|
|
130
147
|
* - 7: 直播中止
|
|
131
148
|
* - 8: 直播继续
|
|
132
149
|
* - 9: 用户封禁
|
|
150
|
+
* - 10, 11, 12: 见 API(未公开说明)
|
|
133
151
|
*/
|
|
134
|
-
type: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
|
|
152
|
+
type: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
|
|
135
153
|
sendDate: number
|
|
136
154
|
message: string
|
|
137
|
-
price: number
|
|
155
|
+
price: number | null
|
|
138
156
|
ct: string
|
|
139
|
-
count: number
|
|
157
|
+
count: number | null
|
|
140
158
|
/**
|
|
141
159
|
* 如存在,这条弹幕由用户补充上传,非本站直接采集,内容和时间可能存在偏差,本站不保证准确性。
|
|
142
160
|
*/
|
|
143
161
|
uploadAccountId?: number
|
|
162
|
+
/** 盲盒名称 */
|
|
163
|
+
mysteryBoxName?: string
|
|
164
|
+
/** 盲盒价格 */
|
|
165
|
+
mysteryBoxPrice?: number
|
|
166
|
+
debugSourceFingerprint?: number
|
|
144
167
|
}
|
|
145
168
|
|
|
146
169
|
/** Extra props for live item */
|
|
@@ -171,26 +194,7 @@ export declare namespace Danmakus {
|
|
|
171
194
|
hasMore: boolean
|
|
172
195
|
data: {
|
|
173
196
|
channel: ChannelInfoProps
|
|
174
|
-
live:
|
|
175
|
-
liveId: string
|
|
176
|
-
isFinish: boolean
|
|
177
|
-
isFull: boolean
|
|
178
|
-
parentArea: string
|
|
179
|
-
area: string
|
|
180
|
-
coverUrl: string
|
|
181
|
-
danmakusCount: number
|
|
182
|
-
startDate: number
|
|
183
|
-
stopDate: number
|
|
184
|
-
title: string
|
|
185
|
-
totalIncome: number
|
|
186
|
-
watchCount: number
|
|
187
|
-
likeCount: number
|
|
188
|
-
payCount: number
|
|
189
|
-
interactionCount: number
|
|
190
|
-
onlineRank: number
|
|
191
|
-
maxOnlineCount: number
|
|
192
|
-
extra: ExtraProps
|
|
193
|
-
}
|
|
197
|
+
live: LiveItem
|
|
194
198
|
danmakus: DanmakuProps[]
|
|
195
199
|
}
|
|
196
200
|
}
|
|
@@ -208,26 +212,13 @@ export declare namespace Danmakus {
|
|
|
208
212
|
data: WatchedChannelsItem[]
|
|
209
213
|
}
|
|
210
214
|
|
|
211
|
-
/**
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
isLiving: boolean
|
|
219
|
-
title: string
|
|
220
|
-
tags: string[]
|
|
221
|
-
lastLiveDate: number
|
|
222
|
-
lastLiveDanmakuCount: number
|
|
223
|
-
totalDanmakuCount: number
|
|
224
|
-
totalIncome: number
|
|
225
|
-
totalLiveCount: number
|
|
226
|
-
totalLiveSecond: number
|
|
227
|
-
addDate: Date
|
|
228
|
-
commentCount: number
|
|
229
|
-
lastLiveIncome: number
|
|
230
|
-
}
|
|
215
|
+
/**
|
|
216
|
+
* Item of `WatchedChannels`.
|
|
217
|
+
*
|
|
218
|
+
* Note: the spec types `/api/v2/user/watchedChannels` `data` loosely as
|
|
219
|
+
* `any`; this mirrors the channel info actually returned (`APIChannelInfo`).
|
|
220
|
+
*/
|
|
221
|
+
export interface WatchedChannelsItem extends ChannelInfo {}
|
|
231
222
|
|
|
232
223
|
/**
|
|
233
224
|
* 用户观看/事件记录
|
|
@@ -256,170 +247,84 @@ export declare namespace Danmakus {
|
|
|
256
247
|
danmakus: DanmakuProps[]
|
|
257
248
|
}
|
|
258
249
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
250
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
251
|
+
// v3 API
|
|
252
|
+
//
|
|
253
|
+
// The v3 endpoints replace the flat `DanmakuProps[]` list with a normalized
|
|
254
|
+
// "frame": danmaku records reference interned `actors` and `roomEmojis`
|
|
255
|
+
// tables by index, which dramatically shrinks the payload for long lives.
|
|
256
|
+
//
|
|
257
|
+
// Two transports exist for the same data:
|
|
258
|
+
// - JSON (`GET /api/v3/lives/{liveId}/danmakus`) — readable, fields named
|
|
259
|
+
// - MessagePack (`GET /api/v3/lives/{liveId}/full|delta`) — compact, fields positional
|
|
260
|
+
//
|
|
261
|
+
// The MessagePack endpoints are documented in the `Msgpack` block below.
|
|
262
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
263
263
|
|
|
264
264
|
/**
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
* -
|
|
270
|
-
* -
|
|
271
|
-
* -
|
|
272
|
-
* -
|
|
273
|
-
* -
|
|
274
|
-
* -
|
|
275
|
-
* -
|
|
276
|
-
* - 10: 盲盒
|
|
277
|
-
*/
|
|
278
|
-
export type DanmakuPayloadKindV3 = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* v3 弹幕事件类型 `DanmakuRecordV3.type`
|
|
282
|
-
* 0-10 与 {@link DanmakuPayloadKindV3} 含义一致,11/12 为 v3 新增类型(spec 未标注具体含义)
|
|
265
|
+
* Payload shape discriminator (`DanmakuPayloadKindV3`). Selects which
|
|
266
|
+
* `DanmakuPayloadV3` fields are populated — and, in the MessagePack
|
|
267
|
+
* transport, the positional layout of the payload tuple (see `Msgpack`).
|
|
268
|
+
*
|
|
269
|
+
* - 0: 无负载(控制 / 进场事件,如直播中止、进入直播间)
|
|
270
|
+
* - 1: 纯文本弹幕 → `rawText`
|
|
271
|
+
* - 2: 房间表情 → `roomEmojiId`
|
|
272
|
+
* - 3: 礼物 → `name`, `count`, `price`, `mysteryBoxName`, `mysteryBoxPrice`
|
|
273
|
+
* - 4: 上舰 → `name`, `count`, `price`
|
|
274
|
+
* - 5: SuperChat → `text`, `price`
|
|
275
|
+
* - 6–10: 标题 / 分区变动等(见 `DanmakuPayloadV3` 的 `previous*` / `current*` 字段)
|
|
283
276
|
*/
|
|
284
|
-
export type
|
|
285
|
-
|
|
286
|
-
/** 用户分析任务状态 `UserAnalyzeJobV3Summary.status`(spec 未标注枚举含义) */
|
|
287
|
-
export type UserAnalyzeJobStatusV3 = 0 | 1 | 2 | 3 | 4
|
|
288
|
-
|
|
289
|
-
/** 用户分析任务事件类型 `UserAnalyzeEventV3.type`(spec 未标注枚举含义) */
|
|
290
|
-
export type UserAnalyzeEventTypeV3 = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
|
|
291
|
-
|
|
292
|
-
/** v3 频道信息 (`APIChannelInfo`) */
|
|
293
|
-
export interface ChannelInfoV3 {
|
|
294
|
-
uId: number
|
|
295
|
-
uName: string
|
|
296
|
-
roomId: number
|
|
297
|
-
faceUrl: string
|
|
298
|
-
frameUrl: string
|
|
299
|
-
isLiving: boolean
|
|
300
|
-
isDeleted: boolean
|
|
301
|
-
title: string
|
|
302
|
-
tags: string[]
|
|
303
|
-
lastLiveDate: number
|
|
304
|
-
lastLiveDanmakuCount: number
|
|
305
|
-
totalDanmakuCount: number
|
|
306
|
-
totalIncome: number
|
|
307
|
-
totalLiveCount: number
|
|
308
|
-
totalLiveSecond: number
|
|
309
|
-
addDate: Date
|
|
310
|
-
/** present only when the channel is currently living */
|
|
311
|
-
livingInfo?: LiveInfoV3
|
|
312
|
-
commentCount: number
|
|
313
|
-
fansCount: number
|
|
314
|
-
followCount: number
|
|
315
|
-
lastUpdateStatAt: number
|
|
316
|
-
lastLiveIncome: number
|
|
317
|
-
recordingStatus?: ChannelRecordingStatusV3
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
/** v3 录播状态 (`APIChannelRecordingStatus`) */
|
|
321
|
-
export interface ChannelRecordingStatusV3 {
|
|
322
|
-
publicUsers: ChannelRecordingUserV3[]
|
|
323
|
-
privateCount: number
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
/** Item of `ChannelRecordingStatusV3` (`APIChannelRecordingUser`) */
|
|
327
|
-
export interface ChannelRecordingUserV3 {
|
|
328
|
-
accountId: number
|
|
329
|
-
name: string
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
/** v3 单场直播信息 (`APILiveInfo`) */
|
|
333
|
-
export interface LiveInfoV3 {
|
|
334
|
-
liveId: string
|
|
335
|
-
isFinish: boolean
|
|
336
|
-
isFull: boolean
|
|
337
|
-
isMerged: boolean
|
|
338
|
-
parentArea: string
|
|
339
|
-
area: string
|
|
340
|
-
coverUrl: string
|
|
341
|
-
danmakusCount: number
|
|
342
|
-
startDate: number
|
|
343
|
-
/** null while the live is still ongoing */
|
|
344
|
-
stopDate: number
|
|
345
|
-
title: string
|
|
346
|
-
totalIncome: number
|
|
347
|
-
watchCount: number
|
|
348
|
-
likeCount: number
|
|
349
|
-
payCount: number
|
|
350
|
-
interactionCount: number
|
|
351
|
-
/** nullable */
|
|
352
|
-
onlineRank: number
|
|
353
|
-
maxOnlineCount: number
|
|
354
|
-
commentCount: number
|
|
355
|
-
extra?: LiveExtraDataV3
|
|
356
|
-
versions?: LiveVersionInfoV3[]
|
|
357
|
-
}
|
|
277
|
+
export type DanmakuPayloadKind = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
|
|
358
278
|
|
|
359
|
-
/**
|
|
360
|
-
export interface LiveVersionInfoV3 {
|
|
361
|
-
live: LiveInfoV3
|
|
362
|
-
userName: string
|
|
363
|
-
userId: number
|
|
364
|
-
isOfficial: boolean
|
|
365
|
-
isFull: boolean
|
|
366
|
-
rangeDanmakusCount: number
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
/** v3 直播扩展数据 (`LiveResponeExtraData`) */
|
|
370
|
-
export interface LiveExtraDataV3 {
|
|
371
|
-
wordCloud: { [key: string]: number }
|
|
372
|
-
onlineRank: { [key: string]: number }
|
|
373
|
-
blockUsers: number[]
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
/** v3 弹幕发送者 (`ActorV3`) */
|
|
279
|
+
/** Interned speaker (`ActorV3`), referenced by `DanmakuRecordV3.actorId` */
|
|
377
280
|
export interface ActorV3 {
|
|
378
281
|
uid: number
|
|
379
282
|
name: string
|
|
380
283
|
}
|
|
381
284
|
|
|
382
|
-
/**
|
|
285
|
+
/** Interned room emoji (`RoomEmojiV3`), referenced by `payload.roomEmojiId` */
|
|
383
286
|
export interface RoomEmojiV3 {
|
|
384
287
|
name: string
|
|
385
288
|
resource: string
|
|
386
289
|
}
|
|
387
290
|
|
|
388
|
-
/**
|
|
389
|
-
* v3 弹幕负载 (`DanmakuPayloadV3`)
|
|
390
|
-
*
|
|
391
|
-
* 各字段按 {@link DanmakuRecordV3.payloadKind} 的不同而有所取舍,多数字段可缺省。
|
|
392
|
-
*/
|
|
291
|
+
/** Variant payload of a danmaku record (`DanmakuPayloadV3`); see `DanmakuPayloadKind` */
|
|
393
292
|
export interface DanmakuPayloadV3 {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
293
|
+
/** kind 1: 弹幕正文 */
|
|
294
|
+
rawText: string | null
|
|
295
|
+
/** kind 2: 0-based index into `DanmakuFrameV3.roomEmojis` */
|
|
296
|
+
roomEmojiId: number | null
|
|
297
|
+
/** kind 3/4: 礼物 / 大航海名称 */
|
|
298
|
+
name: string | null
|
|
299
|
+
count: number | null
|
|
300
|
+
/** kind 3/4/5: 金额,单位元(人民币) */
|
|
301
|
+
price: number | null
|
|
302
|
+
mysteryBoxName: string | null
|
|
303
|
+
mysteryBoxPrice: number | null
|
|
304
|
+
previousTitle: string | null
|
|
305
|
+
currentTitle: string | null
|
|
306
|
+
previousParentArea: string | null
|
|
307
|
+
previousArea: string | null
|
|
308
|
+
currentParentArea: string | null
|
|
309
|
+
currentArea: string | null
|
|
310
|
+
/** kind 5: SuperChat 正文 */
|
|
311
|
+
text: string | null
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/** A single danmaku/event record (`DanmakuRecordV3`) */
|
|
411
315
|
export interface DanmakuRecordV3 {
|
|
316
|
+
/** 绝对时间戳,unix ms */
|
|
412
317
|
ts: number
|
|
413
|
-
type:
|
|
414
|
-
/** index into `DanmakuFrameV3.actors
|
|
415
|
-
actorId
|
|
318
|
+
type: DanmakuProps['type']
|
|
319
|
+
/** 0-based index into `DanmakuFrameV3.actors`; `null` = 系统 / 无主体 */
|
|
320
|
+
actorId: number | null
|
|
416
321
|
/** 如存在,这条弹幕由用户补充上传,非本站直接采集 */
|
|
417
|
-
uploadAccountId
|
|
418
|
-
payloadKind:
|
|
322
|
+
uploadAccountId: number | null
|
|
323
|
+
payloadKind: DanmakuPayloadKind
|
|
419
324
|
payload: DanmakuPayloadV3
|
|
420
325
|
}
|
|
421
326
|
|
|
422
|
-
/**
|
|
327
|
+
/** Normalized danmaku frame (`DanmakuFrameV3`) shared by the v3 endpoints */
|
|
423
328
|
export interface DanmakuFrameV3 {
|
|
424
329
|
actors: ActorV3[]
|
|
425
330
|
roomEmojis: RoomEmojiV3[]
|
|
@@ -427,160 +332,257 @@ export declare namespace Danmakus {
|
|
|
427
332
|
}
|
|
428
333
|
|
|
429
334
|
/**
|
|
430
|
-
*
|
|
431
|
-
* @link https://ukamnads.icu/api/v3/lives/{liveId}
|
|
335
|
+
* 单场直播弹幕切片(JSON)
|
|
336
|
+
* @link https://ukamnads.icu/api/v3/lives/{liveId}/danmakus
|
|
337
|
+
*
|
|
338
|
+
* Query: `offset` (default 0), `limit` (default 2000, max 1e7),
|
|
339
|
+
* `userId` (filter by speaker), `type` (repeatable, filter by event type).
|
|
432
340
|
*/
|
|
433
|
-
export interface
|
|
434
|
-
/** 200: success */
|
|
341
|
+
export interface LiveDanmakusPageV3 {
|
|
435
342
|
code: number
|
|
436
343
|
message: string
|
|
437
|
-
data:
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
344
|
+
data: {
|
|
345
|
+
total: number
|
|
346
|
+
offset: number
|
|
347
|
+
limit: number
|
|
348
|
+
hasMore: boolean
|
|
349
|
+
frame: DanmakuFrameV3
|
|
350
|
+
}
|
|
444
351
|
}
|
|
445
352
|
|
|
446
353
|
/**
|
|
447
|
-
*
|
|
448
|
-
* @link https://ukamnads.icu/api/v3/lives/{liveId}
|
|
354
|
+
* 单场直播元数据(JSON,无弹幕)
|
|
355
|
+
* @link https://ukamnads.icu/api/v3/lives/{liveId}
|
|
356
|
+
*
|
|
357
|
+
* Query: `include` (`extra` to populate `live.extra`). This is the
|
|
358
|
+
* authoritative, typed source for live/channel metadata — prefer it over
|
|
359
|
+
* decoding the positional header of the MessagePack endpoints.
|
|
449
360
|
*/
|
|
450
|
-
export interface
|
|
451
|
-
/** 200: success */
|
|
361
|
+
export interface LiveResponseV3 {
|
|
452
362
|
code: number
|
|
453
363
|
message: string
|
|
454
|
-
data:
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
export interface LiveDanmakusV3Data {
|
|
459
|
-
total: number
|
|
460
|
-
offset: number
|
|
461
|
-
limit: number
|
|
462
|
-
hasMore: boolean
|
|
463
|
-
frame: DanmakuFrameV3
|
|
364
|
+
data: {
|
|
365
|
+
channel: ChannelInfoProps
|
|
366
|
+
live: LiveItem
|
|
367
|
+
}
|
|
464
368
|
}
|
|
465
369
|
|
|
466
370
|
/**
|
|
467
|
-
*
|
|
468
|
-
* @link https://ukamnads.icu/api/v3/users/{userId}/history
|
|
371
|
+
* 用户历史记录(JSON)
|
|
372
|
+
* @link https://ukamnads.icu/api/v3/users/{userId}/history
|
|
373
|
+
*
|
|
374
|
+
* Query: `page` (1-based, default 1), `pageSize` (default 10),
|
|
375
|
+
* `channelUserId` (filter by streamer).
|
|
469
376
|
*/
|
|
470
|
-
export interface
|
|
471
|
-
/** 200: success */
|
|
377
|
+
export interface UserHistoryResponseV3 {
|
|
472
378
|
code: number
|
|
473
379
|
message: string
|
|
474
|
-
data:
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
/** Item of `UserHistoryV3Data` (`UserHistoryItemV3`) */
|
|
487
|
-
export interface UserHistoryItemV3 {
|
|
488
|
-
channel: ChannelInfoV3
|
|
489
|
-
live: LiveInfoV3
|
|
490
|
-
danmakus: DanmakuFrameV3
|
|
380
|
+
data: {
|
|
381
|
+
total: number
|
|
382
|
+
page: number
|
|
383
|
+
pageSize: number
|
|
384
|
+
hasMore: boolean
|
|
385
|
+
items: {
|
|
386
|
+
channel: ChannelInfoProps
|
|
387
|
+
live: LiveItem
|
|
388
|
+
danmakus: DanmakuFrameV3
|
|
389
|
+
}[]
|
|
390
|
+
}
|
|
491
391
|
}
|
|
492
392
|
|
|
493
393
|
/**
|
|
494
|
-
*
|
|
495
|
-
* @link https://ukamnads.icu/api/v3/users/{userId}/bootstrap
|
|
394
|
+
* 用户页聚合数据(JSON)
|
|
395
|
+
* @link https://ukamnads.icu/api/v3/users/{userId}/bootstrap
|
|
496
396
|
*/
|
|
497
|
-
export interface
|
|
498
|
-
/** 200: success */
|
|
397
|
+
export interface UserBootstrapResponseV3 {
|
|
499
398
|
code: number
|
|
500
399
|
message: string
|
|
501
|
-
data:
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
/** Item of `UserBootstrapV3Data.blocks` (`UserBlockHistoryItemV3`) */
|
|
521
|
-
export interface UserBlockHistoryItemV3 {
|
|
522
|
-
uName: string
|
|
523
|
-
uId: number
|
|
524
|
-
faceUrl: string
|
|
525
|
-
date: number
|
|
526
|
-
liveId: string
|
|
400
|
+
data: {
|
|
401
|
+
history: UserHistoryResponseV3['data']
|
|
402
|
+
watchedChannels: {
|
|
403
|
+
uName: string
|
|
404
|
+
uId: number
|
|
405
|
+
faceUrl: string
|
|
406
|
+
count: number
|
|
407
|
+
}[]
|
|
408
|
+
blocks: {
|
|
409
|
+
uName: string
|
|
410
|
+
uId: number
|
|
411
|
+
faceUrl: string
|
|
412
|
+
date: number
|
|
413
|
+
liveId: string
|
|
414
|
+
}[]
|
|
415
|
+
historyUserNames: string[]
|
|
416
|
+
}
|
|
527
417
|
}
|
|
528
418
|
|
|
529
419
|
/**
|
|
530
|
-
*
|
|
531
|
-
*
|
|
420
|
+
* MessagePack transport for the v3 live endpoints.
|
|
421
|
+
*
|
|
422
|
+
* ## Endpoints (all respond with `application/x-msgpack`)
|
|
423
|
+
*
|
|
424
|
+
* | Endpoint | Body type | Use |
|
|
425
|
+
* | --------------------------------------- | -------------------- | --- |
|
|
426
|
+
* | `GET /api/v3/lives/{liveId}/full` | {@link Msgpack.LiveSnapshot} | 一次性拉取整场直播 |
|
|
427
|
+
* | `GET /api/v3/lives/{liveId}/delta` | {@link Msgpack.LiveSnapshot} | 轮询进行中的直播增量 |
|
|
428
|
+
* | `GET /api/v3/meta/index-background` | msgpack | 首页背景图列表 |
|
|
429
|
+
* | `GET /api/v3/user-analysis-jobs/{id}/result` | msgpack | 用户分析任务结果 |
|
|
430
|
+
*
|
|
431
|
+
* `/full` query: `include=extra` (populate `live[17]`), `includeEnter=true`
|
|
432
|
+
* (include 进场 events, default false).
|
|
433
|
+
* `/delta` query: `afterSeq` (cursor, default 0), `includeEnter`.
|
|
434
|
+
*
|
|
435
|
+
* ## Fetching & decoding
|
|
436
|
+
*
|
|
437
|
+
* ```ts
|
|
438
|
+
* import { decode } from '@msgpack/msgpack'
|
|
439
|
+
*
|
|
440
|
+
* const res = await fetch(
|
|
441
|
+
* `https://ukamnads.icu/api/v3/lives/${liveId}/full`,
|
|
442
|
+
* { headers: { Accept: 'application/x-msgpack' } },
|
|
443
|
+
* )
|
|
444
|
+
* const [channel, live, frame] = decode(
|
|
445
|
+
* new Uint8Array(await res.arrayBuffer()),
|
|
446
|
+
* ) as Danmakus.Msgpack.LiveSnapshot
|
|
447
|
+
* ```
|
|
448
|
+
*
|
|
449
|
+
* Note: the body is a positional **array**, not an object, and `live[17]`
|
|
450
|
+
* (extra) contains integer-keyed maps — pick a decoder that allows non-string
|
|
451
|
+
* map keys (`@msgpack/msgpack` does by default; python `msgpack` needs
|
|
452
|
+
* `strict_map_key=False`).
|
|
453
|
+
*
|
|
454
|
+
* ## Wire-format rules (differ from the JSON transport!)
|
|
455
|
+
*
|
|
456
|
+
* 1. **Records are positional tuples**, see {@link Msgpack.Record}.
|
|
457
|
+
* 2. **Indices are 1-based**; `0` means "none". `actorId`/`roomEmojiId` index
|
|
458
|
+
* into `frame[1]` / `frame[2]` as `table[id - 1]`. (The JSON transport is
|
|
459
|
+
* 0-based and uses `null` for "none".)
|
|
460
|
+
* 3. **Timestamps are delta-encoded.** `frame[0]` is a base unix-ms; each
|
|
461
|
+
* record's `tsDelta` is the gap from the previous record. Reconstruct with
|
|
462
|
+
* a running sum: `absTs = base + Σ tsDelta` up to and including that record.
|
|
463
|
+
* 4. **Prices are integer milli-yuan** (`price / 1000` = 元). The JSON
|
|
464
|
+
* transport already divides (e.g. msgpack `30000` ⇄ JSON `30`).
|
|
465
|
+
* 5. Each `/delta` response is **self-contained**: its records reference that
|
|
466
|
+
* response's own `actors`/`roomEmojis` tables, not a global one.
|
|
467
|
+
*
|
|
468
|
+
* ## Reconstructing records
|
|
469
|
+
*
|
|
470
|
+
* ```ts
|
|
471
|
+
* const [base, actors, emojis, records] = frame
|
|
472
|
+
* let ts = base
|
|
473
|
+
* for (const [dt, type, actorId, , kind, payload] of records) {
|
|
474
|
+
* ts += dt
|
|
475
|
+
* const actor = actorId ? actors[actorId - 1] : null // [uid, name]
|
|
476
|
+
* // kind 1 → [text]; kind 2 → [emojiId]; kind 3 → [name, count, priceMilli, ...]
|
|
477
|
+
* }
|
|
478
|
+
* ```
|
|
479
|
+
*
|
|
480
|
+
* ## Polling `/delta` for a live stream
|
|
481
|
+
*
|
|
482
|
+
* Call with `afterSeq=0` for the full frame so far, then advance the cursor
|
|
483
|
+
* past the records you have already consumed (in practice, the cumulative
|
|
484
|
+
* record count) and poll periodically; each call returns only newer records.
|
|
532
485
|
*/
|
|
533
|
-
export
|
|
534
|
-
/**
|
|
535
|
-
|
|
536
|
-
message: string
|
|
537
|
-
data: EmoiconsMetaV3Data
|
|
538
|
-
}
|
|
486
|
+
export namespace Msgpack {
|
|
487
|
+
/** `[uId, uName, roomId]` */
|
|
488
|
+
export type Channel = [uId: number, uName: string, roomId: number]
|
|
539
489
|
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
version: number
|
|
543
|
-
builtinEmojis: BuiltinEmojiMetaV3[]
|
|
544
|
-
}
|
|
490
|
+
/** `[uid, name]` — element of `Frame[1]` */
|
|
491
|
+
export type Actor = [uid: number, name: string]
|
|
545
492
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
token: string
|
|
549
|
-
url: string
|
|
550
|
-
}
|
|
493
|
+
/** `[resource]` — element of `Frame[2]` (note: `name` is dropped vs JSON) */
|
|
494
|
+
export type RoomEmoji = [resource: string]
|
|
551
495
|
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
496
|
+
/**
|
|
497
|
+
* Variant payload, keyed by the record's `payloadKind`. `price` /
|
|
498
|
+
* `mysteryBoxPrice` are in **milli-yuan** (divide by 1000 for 元).
|
|
499
|
+
*/
|
|
500
|
+
export type Payload =
|
|
501
|
+
| null // kind 0 — 控制 / 进场事件
|
|
502
|
+
| [rawText: string] // kind 1 — 纯文本弹幕
|
|
503
|
+
| [roomEmojiId: number] // kind 2 — 房间表情(1-based index)
|
|
504
|
+
| [
|
|
505
|
+
name: string,
|
|
506
|
+
count: number,
|
|
507
|
+
priceMilli: number,
|
|
508
|
+
mysteryBoxName: string | null,
|
|
509
|
+
mysteryBoxPriceMilli: number | null,
|
|
510
|
+
] // kind 3 — 礼物
|
|
511
|
+
| [name: string, count: number, priceMilli: number] // kind 4 — 上舰
|
|
512
|
+
| [text: string, priceMilli: number] // kind 5 — SuperChat
|
|
513
|
+
|
|
514
|
+
/** `[tsDelta, type, actorId, uploadAccountId, payloadKind, payload]` */
|
|
515
|
+
export type Record = [
|
|
516
|
+
/** 距上一条记录的毫秒增量;绝对值 = `Frame[0]` + 累加和 */
|
|
517
|
+
tsDelta: number,
|
|
518
|
+
type: DanmakuProps['type'],
|
|
519
|
+
/** 1-based index into `Frame[1]`; `0` = 系统 / 无主体 */
|
|
520
|
+
actorId: number,
|
|
521
|
+
/** 1-based account id of an uploader; `0` = 本站采集 */
|
|
522
|
+
uploadAccountId: number,
|
|
523
|
+
payloadKind: DanmakuPayloadKind,
|
|
524
|
+
payload: Payload,
|
|
525
|
+
]
|
|
526
|
+
|
|
527
|
+
/** `[baseTs, actors, roomEmojis, records]` */
|
|
528
|
+
export type Frame = [
|
|
529
|
+
/** 基准时间戳,unix ms */
|
|
530
|
+
baseTs: number,
|
|
531
|
+
actors: Actor[],
|
|
532
|
+
roomEmojis: RoomEmoji[],
|
|
533
|
+
records: Record[],
|
|
534
|
+
]
|
|
566
535
|
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
536
|
+
/**
|
|
537
|
+
* Contributed recording (`APILiveVersionInfo`), flattened.
|
|
538
|
+
* `[liveId, startDate, stopDate, danmakusCount, contributorName,
|
|
539
|
+
* contributorId, isOfficial, isFull, rangeDanmakusCount]`
|
|
540
|
+
*/
|
|
541
|
+
export type LiveVersion = [
|
|
542
|
+
liveId: string,
|
|
543
|
+
startDate: number,
|
|
544
|
+
stopDate: number,
|
|
545
|
+
danmakusCount: number,
|
|
546
|
+
contributorName: string,
|
|
547
|
+
contributorId: number,
|
|
548
|
+
isOfficial: boolean,
|
|
549
|
+
isFull: boolean,
|
|
550
|
+
rangeDanmakusCount: number,
|
|
551
|
+
]
|
|
576
552
|
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
553
|
+
/**
|
|
554
|
+
* Positional projection of the live's metadata. For authoritative typed
|
|
555
|
+
* metadata prefer the JSON `GET /api/v3/lives/{liveId}` ({@link LiveResponseV3}).
|
|
556
|
+
*/
|
|
557
|
+
export type Live = [
|
|
558
|
+
liveId: string,
|
|
559
|
+
title: string,
|
|
560
|
+
coverUrl: string,
|
|
561
|
+
startDate: number,
|
|
562
|
+
stopDate: number,
|
|
563
|
+
isFinish: boolean,
|
|
564
|
+
isFull: boolean,
|
|
565
|
+
isMerged: boolean,
|
|
566
|
+
/** 帧内事件总数(含礼物/SC/控制事件,≥ `danmakusCount`) */
|
|
567
|
+
eventCount: number,
|
|
568
|
+
/** [9] 观看人数(看过)— 推断字段 */
|
|
569
|
+
viewCount: number,
|
|
570
|
+
interactionCount: number,
|
|
571
|
+
watchCount: number,
|
|
572
|
+
/** 收益,单位 milli-yuan(/1000 = 元) */
|
|
573
|
+
totalIncomeMilli: number,
|
|
574
|
+
maxOnlineCount: number,
|
|
575
|
+
commentCount: number,
|
|
576
|
+
area: string,
|
|
577
|
+
parentArea: string,
|
|
578
|
+
/** 仅当 `include=extra` 时存在,否则为 `null`(在线人数曲线等) */
|
|
579
|
+
extra: unknown | null,
|
|
580
|
+
versions: LiveVersion[],
|
|
581
|
+
/** [19] 与 `viewCount` 重复 — 推断字段 */
|
|
582
|
+
viewCountDup: number,
|
|
583
|
+
]
|
|
584
|
+
|
|
585
|
+
/** msgpack body of `/api/v3/lives/{liveId}/full` and `/delta`: `[channel, live, frame]` */
|
|
586
|
+
export type LiveSnapshot = [channel: Channel, live: Live, frame: Frame]
|
|
585
587
|
}
|
|
586
588
|
}
|