@laplace.live/internal 1.3.22 → 1.3.24
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/bilibili.d.ts +26 -0
- package/src/namespaces/danmakus.d.ts +241 -103
package/package.json
CHANGED
|
@@ -4265,6 +4265,32 @@ export declare namespace BilibiliInternal {
|
|
|
4265
4265
|
msg: string
|
|
4266
4266
|
}
|
|
4267
4267
|
|
|
4268
|
+
/**
|
|
4269
|
+
* 举报直播间弹幕
|
|
4270
|
+
*
|
|
4271
|
+
* 举报类型可通过 https://api.live.bilibili.com/xlive/web-ucenter/v1/dMReport/ForReason 获取
|
|
4272
|
+
* @link https://api.live.bilibili.com/xlive/web-ucenter/v1/dMReport/Report
|
|
4273
|
+
*/
|
|
4274
|
+
export interface DanmuReport {
|
|
4275
|
+
/**
|
|
4276
|
+
* - `0`: 举报成功
|
|
4277
|
+
* - `-101`: 账号未登录
|
|
4278
|
+
* - `-111`: csrf 校验失败
|
|
4279
|
+
* - `-400`: 请求错误
|
|
4280
|
+
* - `-403`: 无权限
|
|
4281
|
+
*/
|
|
4282
|
+
code: number
|
|
4283
|
+
/**
|
|
4284
|
+
* 通常为 `"0"`
|
|
4285
|
+
*/
|
|
4286
|
+
message: string
|
|
4287
|
+
data: {
|
|
4288
|
+
/** 举报 ID */
|
|
4289
|
+
id: number
|
|
4290
|
+
}
|
|
4291
|
+
ttl: number
|
|
4292
|
+
}
|
|
4293
|
+
|
|
4268
4294
|
/**
|
|
4269
4295
|
* 创建订单
|
|
4270
4296
|
*
|
|
@@ -264,15 +264,19 @@ export declare namespace Danmakus {
|
|
|
264
264
|
/**
|
|
265
265
|
* Payload shape discriminator (`DanmakuPayloadKindV3`). Selects which
|
|
266
266
|
* `DanmakuPayloadV3` fields are populated — and, in the MessagePack
|
|
267
|
-
* transport, the positional layout of
|
|
267
|
+
* transport, the positional layout of `payloadArgs` (see `Msgpack`).
|
|
268
268
|
*
|
|
269
|
-
* - 0
|
|
270
|
-
* - 1
|
|
271
|
-
* - 2
|
|
272
|
-
* - 3
|
|
273
|
-
* - 4
|
|
274
|
-
* - 5
|
|
275
|
-
* - 6
|
|
269
|
+
* - 0 `None`: 无负载(控制 / 进场事件)
|
|
270
|
+
* - 1 `TextMessage`: 纯文本弹幕 → `rawText`
|
|
271
|
+
* - 2 `RoomEmojiMessage`: 房间表情 → `roomEmojiId`
|
|
272
|
+
* - 3 `Gift`: 礼物 → `name`, `count`, `price`, `mysteryBoxName`, `mysteryBoxPrice`
|
|
273
|
+
* - 4 `Guard`: 上舰 → `name`, `count`, `price`
|
|
274
|
+
* - 5 `SuperChat`: → `text`, `price`
|
|
275
|
+
* - 6 `TitleChange`: 标题变动 → `previousTitle`, `currentTitle`
|
|
276
|
+
* - 7 `AreaChange`: 分区变动 → `previous(Parent)Area`, `current(Parent)Area`
|
|
277
|
+
* - 8 `Warning`: 超管警告 → `text`
|
|
278
|
+
* - 9 `RecordStart`: 录制开始 → `text`
|
|
279
|
+
* - 10 `RecordInterrupt`: 录制中断 → `text`
|
|
276
280
|
*/
|
|
277
281
|
export type DanmakuPayloadKind = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
|
|
278
282
|
|
|
@@ -291,37 +295,46 @@ export declare namespace Danmakus {
|
|
|
291
295
|
/** Variant payload of a danmaku record (`DanmakuPayloadV3`); see `DanmakuPayloadKind` */
|
|
292
296
|
export interface DanmakuPayloadV3 {
|
|
293
297
|
/** kind 1: 弹幕正文 */
|
|
294
|
-
rawText
|
|
298
|
+
rawText?: string
|
|
295
299
|
/** kind 2: 0-based index into `DanmakuFrameV3.roomEmojis` */
|
|
296
|
-
roomEmojiId
|
|
300
|
+
roomEmojiId?: number
|
|
297
301
|
/** kind 3/4: 礼物 / 大航海名称 */
|
|
298
|
-
name
|
|
299
|
-
count
|
|
302
|
+
name?: string
|
|
303
|
+
count?: number
|
|
300
304
|
/** kind 3/4/5: 金额,单位元(人民币) */
|
|
301
|
-
price
|
|
302
|
-
mysteryBoxName
|
|
303
|
-
mysteryBoxPrice
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
305
|
+
price?: number
|
|
306
|
+
mysteryBoxName?: string
|
|
307
|
+
mysteryBoxPrice?: number
|
|
308
|
+
/** kind 6 */
|
|
309
|
+
previousTitle?: string
|
|
310
|
+
/** kind 6 */
|
|
311
|
+
currentTitle?: string
|
|
312
|
+
/** kind 7 */
|
|
313
|
+
previousParentArea?: string
|
|
314
|
+
previousArea?: string
|
|
315
|
+
currentParentArea?: string
|
|
316
|
+
currentArea?: string
|
|
317
|
+
/** kind 5: SuperChat 正文;kind 8/9/10: 提示文本 */
|
|
318
|
+
text?: string
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* A single danmaku/event record (`DanmakuRecordV3`).
|
|
323
|
+
*
|
|
324
|
+
* Note (vs the MessagePack transport): here `ts` is absolute and `actorId`
|
|
325
|
+
* is a **0-based** index into `DanmakuFrameV3.actors` with `undefined` = 系统;
|
|
326
|
+
* the msgpack wire is 1-based with `0` = 系统. See {@link Msgpack}.
|
|
327
|
+
*/
|
|
315
328
|
export interface DanmakuRecordV3 {
|
|
316
329
|
/** 绝对时间戳,unix ms */
|
|
317
330
|
ts: number
|
|
318
331
|
type: DanmakuProps['type']
|
|
319
|
-
/** 0-based index into `DanmakuFrameV3.actors`; `
|
|
320
|
-
actorId
|
|
332
|
+
/** 0-based index into `DanmakuFrameV3.actors`; `undefined` = 系统 / 无主体 */
|
|
333
|
+
actorId?: number
|
|
321
334
|
/** 如存在,这条弹幕由用户补充上传,非本站直接采集 */
|
|
322
|
-
uploadAccountId
|
|
335
|
+
uploadAccountId?: number
|
|
323
336
|
payloadKind: DanmakuPayloadKind
|
|
324
|
-
payload
|
|
337
|
+
payload?: DanmakuPayloadV3 | null
|
|
325
338
|
}
|
|
326
339
|
|
|
327
340
|
/** Normalized danmaku frame (`DanmakuFrameV3`) shared by the v3 endpoints */
|
|
@@ -417,16 +430,27 @@ export declare namespace Danmakus {
|
|
|
417
430
|
}
|
|
418
431
|
|
|
419
432
|
/**
|
|
420
|
-
* MessagePack transport for the v3
|
|
433
|
+
* MessagePack transport for the v3 endpoints.
|
|
434
|
+
*
|
|
435
|
+
* The wire layout is **not fully described by swagger** (msgpack bodies show
|
|
436
|
+
* up as opaque schemas there). The authoritative definitions are the official
|
|
437
|
+
* web client's models, which this namespace mirrors 1:1:
|
|
438
|
+
* - `DanmakuVue/src/api/DanmakuMessagePackModels.ts` (the `*Wire` tuples)
|
|
439
|
+
* - `DanmakuVue/src/api/DanmakuMessagePackDecoder.ts` (decode semantics)
|
|
440
|
+
* - `DanmakuVue/src/api/IndexBackgroundModels.ts`
|
|
421
441
|
*
|
|
422
442
|
* ## Endpoints (all respond with `application/x-msgpack`)
|
|
423
443
|
*
|
|
424
|
-
* | Endpoint
|
|
425
|
-
* |
|
|
426
|
-
* | `GET /api/v3/lives/{liveId}/full`
|
|
427
|
-
* | `GET /api/v3/lives/{liveId}/delta`
|
|
428
|
-
* | `GET /api/v3/meta/index-background`
|
|
429
|
-
* | `GET /api/v3/user-analysis-jobs/{id}/result` |
|
|
444
|
+
* | Endpoint | Decoded as | Encoding |
|
|
445
|
+
* | -------------------------------------------- | ---------- | -------- |
|
|
446
|
+
* | `GET /api/v3/lives/{liveId}/full` | {@link Msgpack.LiveFullEnvelopeWire} | positional |
|
|
447
|
+
* | `GET /api/v3/lives/{liveId}/delta` | {@link Msgpack.LiveDeltaEnvelopeWire} | positional |
|
|
448
|
+
* | `GET /api/v3/meta/index-background` | {@link Msgpack.IndexBackgroundDanmakuEnvelopeWire} | positional |
|
|
449
|
+
* | `GET /api/v3/user-analysis-jobs/{id}/result` | {@link UserAnalyzeResult} | keyed map |
|
|
450
|
+
*
|
|
451
|
+
* The live & index-background bodies are **positional arrays** (field order =
|
|
452
|
+
* the tuple order below); the user-analysis result is an ordinary **keyed
|
|
453
|
+
* map** that decodes straight to its object shape.
|
|
430
454
|
*
|
|
431
455
|
* `/full` query: `include=extra` (populate `live[17]`), `includeEnter=true`
|
|
432
456
|
* (include 进场 events, default false).
|
|
@@ -443,64 +467,79 @@ export declare namespace Danmakus {
|
|
|
443
467
|
* )
|
|
444
468
|
* const [channel, live, frame] = decode(
|
|
445
469
|
* new Uint8Array(await res.arrayBuffer()),
|
|
446
|
-
* ) as Danmakus.Msgpack.
|
|
470
|
+
* ) as Danmakus.Msgpack.LiveFullEnvelopeWire
|
|
447
471
|
* ```
|
|
448
472
|
*
|
|
449
|
-
* Note: the body is a positional **array**, not an object, and `
|
|
450
|
-
* (
|
|
451
|
-
* map keys (`@msgpack/msgpack`
|
|
452
|
-
* `strict_map_key=False`).
|
|
473
|
+
* Note: the body is a positional **array**, not an object, and `extra[0]`
|
|
474
|
+
* (`onlineRank`) is an integer-keyed map (keyed by unix-ms) — use a decoder
|
|
475
|
+
* that allows non-string map keys (`@msgpack/msgpack` with `{ useMap: true }`,
|
|
476
|
+
* or python `msgpack` with `strict_map_key=False`).
|
|
453
477
|
*
|
|
454
478
|
* ## Wire-format rules (differ from the JSON transport!)
|
|
455
479
|
*
|
|
456
|
-
* 1. **Records are positional tuples**, see {@link Msgpack.
|
|
457
|
-
* 2. **Indices are 1-based**; `0` means "none". `actorId`/`roomEmojiId`
|
|
458
|
-
*
|
|
459
|
-
*
|
|
460
|
-
* 3. **Timestamps are delta-encoded.** `frame[0]` is a base
|
|
461
|
-
* record's `
|
|
462
|
-
* a running sum: `absTs =
|
|
463
|
-
*
|
|
480
|
+
* 1. **Records are positional tuples**, see {@link Msgpack.LiveFullRecordWire}.
|
|
481
|
+
* 2. **Indices are 1-based**; `0`/`<=0` means "none". `actorId`/`roomEmojiId`
|
|
482
|
+
* resolve as `table[id - 1]`. (The JSON transport is 0-based and uses
|
|
483
|
+
* `undefined` for "none".)
|
|
484
|
+
* 3. **Timestamps are delta-encoded.** `frame[0]` (`baseTs`) is a base
|
|
485
|
+
* unix-ms; each record's `dt` is the gap from the previous record.
|
|
486
|
+
* Reconstruct with a running sum: `absTs = baseTs + Σ dt` up to and
|
|
487
|
+
* including that record.
|
|
488
|
+
* 4. **Prices are integer milli-yuan** (value `/ 1000` = 元) — both
|
|
489
|
+
* `live.totalIncomeMilli` and the price slots in `payloadArgs`. The JSON
|
|
464
490
|
* transport already divides (e.g. msgpack `30000` ⇄ JSON `30`).
|
|
465
|
-
* 5.
|
|
491
|
+
* 5. `stopDate <= 0` means the live is ongoing (decode to `null`).
|
|
492
|
+
* 6. Each `/delta` response is **self-contained**: its records reference that
|
|
466
493
|
* response's own `actors`/`roomEmojis` tables, not a global one.
|
|
467
494
|
*
|
|
468
495
|
* ## Reconstructing records
|
|
469
496
|
*
|
|
470
497
|
* ```ts
|
|
471
|
-
* const [
|
|
472
|
-
* let ts =
|
|
473
|
-
* for (const [dt, type, actorId, , kind,
|
|
498
|
+
* const [baseTs, actors, emojis, records] = frame
|
|
499
|
+
* let ts = baseTs
|
|
500
|
+
* for (const [dt, type, actorId, , kind, args] of records) {
|
|
474
501
|
* ts += dt
|
|
475
|
-
* const actor = actorId ? actors[actorId - 1] :
|
|
502
|
+
* const actor = actorId > 0 ? actors[actorId - 1] : undefined // [uid, name]
|
|
476
503
|
* // kind 1 → [text]; kind 2 → [emojiId]; kind 3 → [name, count, priceMilli, ...]
|
|
477
504
|
* }
|
|
478
505
|
* ```
|
|
479
506
|
*
|
|
480
507
|
* ## Polling `/delta` for a live stream
|
|
481
508
|
*
|
|
482
|
-
* Call with `afterSeq=0` for the full frame so far, then
|
|
483
|
-
*
|
|
484
|
-
*
|
|
509
|
+
* Call with `afterSeq=0` for the full frame so far, then on each poll pass the
|
|
510
|
+
* previous response's `live.latestSeq` (`live[19]`) as the next `afterSeq`;
|
|
511
|
+
* each call returns only records newer than that sequence.
|
|
485
512
|
*/
|
|
486
513
|
export namespace Msgpack {
|
|
487
|
-
/** `[
|
|
488
|
-
export type
|
|
514
|
+
/** `[uid, name, roomId]` */
|
|
515
|
+
export type LiveFullChannelWire = [uid: number, name: string, roomId: number]
|
|
489
516
|
|
|
490
|
-
/** `[uid, name]` — element of `
|
|
491
|
-
export type
|
|
517
|
+
/** `[uid, name]` — element of `LiveFullFrameWire[1]` */
|
|
518
|
+
export type LiveFullActorWire = [uid: number, name: string]
|
|
492
519
|
|
|
493
|
-
/** `[resource]` — element of `
|
|
494
|
-
export type
|
|
520
|
+
/** `[resource]` — element of `LiveFullFrameWire[2]` (`name` dropped vs JSON) */
|
|
521
|
+
export type LiveFullRoomEmojiWire = [resource: string]
|
|
495
522
|
|
|
496
523
|
/**
|
|
497
|
-
*
|
|
498
|
-
* `
|
|
524
|
+
* `[onlineRank, wordCloud]` — present only when `/full?include=extra`,
|
|
525
|
+
* otherwise `null`; either slot may itself be `null`.
|
|
499
526
|
*/
|
|
500
|
-
export type
|
|
501
|
-
|
|
527
|
+
export type LiveFullExtraWire = [
|
|
528
|
+
/** unix-ms → 在线人数 */
|
|
529
|
+
onlineRank?: Record<string, number> | null,
|
|
530
|
+
/** 词 → 次数 */
|
|
531
|
+
wordCloud?: Record<string, number> | null,
|
|
532
|
+
]
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* `LiveFullRecordWire[5]` (`payloadArgs`) — variant tuple selected by
|
|
536
|
+
* `payloadKind`. The source types this loosely as `unknown[] | null`; the
|
|
537
|
+
* union below is the exact per-kind layout used by the decoder. `price*`
|
|
538
|
+
* slots are **milli-yuan**; `roomEmojiId` is a 1-based index.
|
|
539
|
+
*/
|
|
540
|
+
export type PayloadArgs =
|
|
502
541
|
| [rawText: string] // kind 1 — 纯文本弹幕
|
|
503
|
-
| [roomEmojiId: number] // kind 2 —
|
|
542
|
+
| [roomEmojiId: number] // kind 2 — 房间表情
|
|
504
543
|
| [
|
|
505
544
|
name: string,
|
|
506
545
|
count: number,
|
|
@@ -510,51 +549,56 @@ export declare namespace Danmakus {
|
|
|
510
549
|
] // kind 3 — 礼物
|
|
511
550
|
| [name: string, count: number, priceMilli: number] // kind 4 — 上舰
|
|
512
551
|
| [text: string, priceMilli: number] // kind 5 — SuperChat
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
552
|
+
| [previousTitle: string, currentTitle: string] // kind 6 — 标题变动
|
|
553
|
+
| [previousParentArea: string, previousArea: string, currentParentArea: string, currentArea: string] // kind 7 — 分区变动
|
|
554
|
+
| [text: string] // kind 8/9/10 — 警告 / 录制开始 / 录制中断
|
|
555
|
+
|
|
556
|
+
/** `[dt, type, actorId, uploadAccountId, payloadKind, payloadArgs?]` */
|
|
557
|
+
export type LiveFullRecordWire = [
|
|
558
|
+
/** 距上一条记录的毫秒增量;绝对值 = `LiveFullFrameWire[0]` + 累加和 */
|
|
559
|
+
dt: number,
|
|
518
560
|
type: DanmakuProps['type'],
|
|
519
|
-
/** 1-based index into `
|
|
561
|
+
/** 1-based index into `LiveFullFrameWire[1]`; `<=0` = 系统 / 无主体 */
|
|
520
562
|
actorId: number,
|
|
521
|
-
/** 1-based account id of an uploader;
|
|
563
|
+
/** 1-based account id of an uploader; `<=0` = 本站采集 */
|
|
522
564
|
uploadAccountId: number,
|
|
523
565
|
payloadKind: DanmakuPayloadKind,
|
|
524
|
-
|
|
566
|
+
payloadArgs?: PayloadArgs | null,
|
|
525
567
|
]
|
|
526
568
|
|
|
527
569
|
/** `[baseTs, actors, roomEmojis, records]` */
|
|
528
|
-
export type
|
|
570
|
+
export type LiveFullFrameWire = [
|
|
529
571
|
/** 基准时间戳,unix ms */
|
|
530
572
|
baseTs: number,
|
|
531
|
-
actors:
|
|
532
|
-
roomEmojis:
|
|
533
|
-
records:
|
|
573
|
+
actors: LiveFullActorWire[],
|
|
574
|
+
roomEmojis: LiveFullRoomEmojiWire[],
|
|
575
|
+
records: LiveFullRecordWire[],
|
|
534
576
|
]
|
|
535
577
|
|
|
536
578
|
/**
|
|
537
|
-
*
|
|
538
|
-
* `[liveId, startDate, stopDate, danmakusCount,
|
|
539
|
-
*
|
|
579
|
+
* A contributed recording, flattened.
|
|
580
|
+
* `[liveId, startDate, stopDate, danmakusCount, userName, userId,
|
|
581
|
+
* isOfficial, isFull, rangeDanmakusCount]`
|
|
540
582
|
*/
|
|
541
|
-
export type
|
|
583
|
+
export type LiveFullVersionWire = [
|
|
542
584
|
liveId: string,
|
|
543
585
|
startDate: number,
|
|
544
586
|
stopDate: number,
|
|
545
587
|
danmakusCount: number,
|
|
546
|
-
|
|
547
|
-
|
|
588
|
+
userName: string,
|
|
589
|
+
userId: number,
|
|
548
590
|
isOfficial: boolean,
|
|
549
591
|
isFull: boolean,
|
|
550
592
|
rangeDanmakusCount: number,
|
|
551
593
|
]
|
|
552
594
|
|
|
553
595
|
/**
|
|
554
|
-
* Positional projection of the live's metadata. For
|
|
555
|
-
*
|
|
596
|
+
* Positional projection of the live's metadata. For the full typed metadata
|
|
597
|
+
* prefer JSON `GET /api/v3/lives/{liveId}` ({@link LiveResponseV3}); this
|
|
598
|
+
* drops `likeCount`/`payCount`/`onlineRank` and adds
|
|
599
|
+
* `totalDanmakusCount`/`latestSeq`.
|
|
556
600
|
*/
|
|
557
|
-
export type
|
|
601
|
+
export type LiveFullLiveWire = [
|
|
558
602
|
liveId: string,
|
|
559
603
|
title: string,
|
|
560
604
|
coverUrl: string,
|
|
@@ -563,26 +607,120 @@ export declare namespace Danmakus {
|
|
|
563
607
|
isFinish: boolean,
|
|
564
608
|
isFull: boolean,
|
|
565
609
|
isMerged: boolean,
|
|
566
|
-
/**
|
|
567
|
-
|
|
568
|
-
/**
|
|
569
|
-
|
|
610
|
+
/** 本帧弹幕数 */
|
|
611
|
+
danmakusCount: number,
|
|
612
|
+
/** 所有版本合并后的弹幕总数 */
|
|
613
|
+
totalDanmakusCount: number,
|
|
570
614
|
interactionCount: number,
|
|
571
615
|
watchCount: number,
|
|
572
616
|
/** 收益,单位 milli-yuan(/1000 = 元) */
|
|
573
617
|
totalIncomeMilli: number,
|
|
574
618
|
maxOnlineCount: number,
|
|
575
619
|
commentCount: number,
|
|
576
|
-
area
|
|
577
|
-
parentArea
|
|
578
|
-
/** 仅当 `include=extra`
|
|
579
|
-
extra
|
|
580
|
-
versions
|
|
581
|
-
/**
|
|
582
|
-
|
|
620
|
+
area?: string | null,
|
|
621
|
+
parentArea?: string | null,
|
|
622
|
+
/** 仅当 `include=extra` 时存在 */
|
|
623
|
+
extra?: LiveFullExtraWire | null,
|
|
624
|
+
versions?: LiveFullVersionWire[] | null,
|
|
625
|
+
/** 最新序号;轮询 `/delta` 时作为下一次的 `afterSeq` */
|
|
626
|
+
latestSeq?: number,
|
|
627
|
+
]
|
|
628
|
+
|
|
629
|
+
/** msgpack body of `/api/v3/lives/{liveId}/full`: `[channel, live, frame]` */
|
|
630
|
+
export type LiveFullEnvelopeWire = [channel: LiveFullChannelWire, live: LiveFullLiveWire, frame: LiveFullFrameWire]
|
|
631
|
+
|
|
632
|
+
/** msgpack body of `/api/v3/lives/{liveId}/delta` — identical shape to {@link LiveFullEnvelopeWire} */
|
|
633
|
+
export type LiveDeltaEnvelopeWire = LiveFullEnvelopeWire
|
|
634
|
+
|
|
635
|
+
/** `[id, liveId, uId, liveTitle, message, sendDate]` */
|
|
636
|
+
export type IndexBackgroundDanmakuCardWire = [
|
|
637
|
+
id: string,
|
|
638
|
+
liveId: string,
|
|
639
|
+
uId: number,
|
|
640
|
+
liveTitle: string,
|
|
641
|
+
message: string,
|
|
642
|
+
sendDate: number,
|
|
583
643
|
]
|
|
584
644
|
|
|
585
|
-
/** msgpack body of `/api/v3/
|
|
586
|
-
export type
|
|
645
|
+
/** msgpack body of `/api/v3/meta/index-background`: `[cards]` */
|
|
646
|
+
export type IndexBackgroundDanmakuEnvelopeWire = [cards: IndexBackgroundDanmakuCardWire[]]
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* 创建用户分析任务请求体(JSON)
|
|
651
|
+
* @link https://ukamnads.icu/api/v3/user-analysis-jobs (POST,需鉴权)
|
|
652
|
+
*/
|
|
653
|
+
export interface CreateUserAnalyzeJobRequest {
|
|
654
|
+
userId: number
|
|
655
|
+
startTime?: number
|
|
656
|
+
endTime?: number
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
/** Response of `POST /api/v3/user-analysis-jobs` */
|
|
660
|
+
export interface CreateUserAnalyzeJobResponse {
|
|
661
|
+
jobId: string
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
/** 用户分析任务事件类型(SSE event name / `UserAnalyzeEvent.type`) */
|
|
665
|
+
export type UserAnalyzeEventType =
|
|
666
|
+
| 'created'
|
|
667
|
+
| 'queued'
|
|
668
|
+
| 'indexing'
|
|
669
|
+
| 'loading'
|
|
670
|
+
| 'aggregating'
|
|
671
|
+
| 'completed'
|
|
672
|
+
| 'failed'
|
|
673
|
+
| 'canceled'
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* 进度事件。通过 SSE 推送:
|
|
677
|
+
* @link https://ukamnads.icu/api/v3/user-analysis-jobs/{jobId}/events
|
|
678
|
+
* 也可轮询 `GET /api/v3/user-analysis-jobs/{jobId}` 获取最新状态。
|
|
679
|
+
*/
|
|
680
|
+
export interface UserAnalyzeEvent {
|
|
681
|
+
type: UserAnalyzeEventType
|
|
682
|
+
message: string
|
|
683
|
+
progress: number
|
|
684
|
+
loadedLives: number
|
|
685
|
+
totalLives: number
|
|
686
|
+
loadedDanmakus: number
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/** `UserAnalyzeSummary` */
|
|
690
|
+
export interface UserAnalyzeSummary {
|
|
691
|
+
totalMessages: number
|
|
692
|
+
/** 元 */
|
|
693
|
+
totalPayment: number
|
|
694
|
+
blockCount: number
|
|
695
|
+
activeDays: number
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
/** Item of `UserAnalyzeChannelResult.lives` */
|
|
699
|
+
export interface UserAnalyzeLiveResult {
|
|
700
|
+
live: LiveItem
|
|
701
|
+
danmakus: DanmakuProps[]
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
/** Item of `UserAnalyzeResult.channels` */
|
|
705
|
+
export interface UserAnalyzeChannelResult {
|
|
706
|
+
channel: ChannelInfo
|
|
707
|
+
lives: UserAnalyzeLiveResult[]
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* 用户分析结果(msgpack,keyed map — 直接 decode 成对象)
|
|
712
|
+
* @link https://ukamnads.icu/api/v3/user-analysis-jobs/{jobId}/result
|
|
713
|
+
*
|
|
714
|
+
* Fetch with `Accept: application/x-msgpack` and decode; unlike the live
|
|
715
|
+
* endpoints this body is an ordinary keyed map, not a positional tuple.
|
|
716
|
+
*/
|
|
717
|
+
export interface UserAnalyzeResult {
|
|
718
|
+
userId: number
|
|
719
|
+
startTime: number
|
|
720
|
+
endTime: number
|
|
721
|
+
nameHistory: string[]
|
|
722
|
+
wordCloud: Record<string, number>
|
|
723
|
+
summary: UserAnalyzeSummary
|
|
724
|
+
channels: UserAnalyzeChannelResult[]
|
|
587
725
|
}
|
|
588
726
|
}
|