floating-live 0.12.1 → 0.14.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.
Files changed (63) hide show
  1. package/README.md +7 -8
  2. package/index.d.ts +2 -2
  3. package/index.js +2 -2
  4. package/package.json +4 -2
  5. package/plugin/acfun/acfunLive.d.ts +3 -3
  6. package/plugin/acfun/acfunLive.js +6 -6
  7. package/plugin/acfun/index.d.ts +1 -0
  8. package/plugin/acfun/index.js +3 -2
  9. package/plugin/bilibili/index.d.ts +1 -0
  10. package/plugin/bilibili/index.js +17 -4
  11. package/plugin/bilibili/parser.d.ts +6 -0
  12. package/plugin/bilibili/{bilibiliLive.js → parser.js} +117 -230
  13. package/plugin/bilibili/room.d.ts +77 -0
  14. package/plugin/bilibili/room.js +261 -0
  15. package/plugin/bilibili/types.d.ts +424 -0
  16. package/plugin/bilibili/utils.d.ts +16 -0
  17. package/plugin/bilibili/utils.js +140 -0
  18. package/plugin/chatPrint/chatPrint.d.ts +2 -2
  19. package/plugin/chatPrint/chatPrint.js +3 -3
  20. package/plugin/chatPrint/index.d.ts +1 -0
  21. package/plugin/chatPrint/index.js +2 -1
  22. package/plugin/consoleEvent/index.d.ts +1 -0
  23. package/plugin/consoleEvent/index.js +16 -21
  24. package/plugin/msgSave/index.d.ts +3 -1
  25. package/plugin/msgSave/index.js +25 -30
  26. package/plugin/msgSave/msgSave.d.ts +5 -5
  27. package/plugin/msgSave/msgSave.js +25 -9
  28. package/src/abstract/LiveRoom.d.ts +44 -0
  29. package/src/{lib → abstract}/LiveRoom.js +12 -7
  30. package/src/{lib → abstract}/Reglist.d.ts +2 -0
  31. package/src/{lib → abstract}/Reglist.js +4 -0
  32. package/src/index.d.ts +17 -46
  33. package/src/index.js +24 -81
  34. package/src/module/ModAuth.d.ts +8 -0
  35. package/src/module/ModAuth.js +28 -0
  36. package/src/module/ModCommand.d.ts +9 -0
  37. package/src/module/ModCommand.js +19 -0
  38. package/src/module/ModMessage.d.ts +9 -0
  39. package/src/module/ModMessage.js +16 -0
  40. package/src/module/{Plugin.d.ts → ModPlugin.d.ts} +5 -11
  41. package/src/module/ModPlugin.js +63 -0
  42. package/src/module/ModRooms.d.ts +37 -0
  43. package/src/module/ModRooms.js +159 -0
  44. package/src/module/ModState.d.ts +6 -0
  45. package/src/module/ModState.js +17 -0
  46. package/src/types/index.d.ts +1 -2
  47. package/src/types/index.js +1 -2
  48. package/src/types/message.d.ts +210 -0
  49. package/src/types/plugin.d.ts +4 -5
  50. package/src/types/room.d.ts +48 -2
  51. package/src/utils.d.ts +2 -2
  52. package/test/type/bilibili_getInfoByRoom.d.ts +492 -0
  53. package/plugin/bilibili/bilibiliLive.d.ts +0 -58
  54. package/src/lib/LiveRoom.d.ts +0 -89
  55. package/src/module/Command.d.ts +0 -3
  56. package/src/module/Command.js +0 -6
  57. package/src/module/Plugin.js +0 -82
  58. package/src/module/Room.d.ts +0 -26
  59. package/src/module/Room.js +0 -118
  60. package/src/types/message/AttributeInfo.d.ts +0 -67
  61. package/src/types/message/MessageData.d.ts +0 -167
  62. /package/{src/types/message/AttributeInfo.js → plugin/bilibili/types.js} +0 -0
  63. /package/src/types/{message/MessageData.js → message.js} +0 -0
@@ -0,0 +1,261 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
+ };
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
+ };
13
+ var _RoomBilibili_auth;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const __1 = require("../..");
16
+ const bilibili_live_ws_1 = require("bilibili-live-ws");
17
+ const parser_1 = require("./parser");
18
+ const LiveRoom_1 = require("../../src/abstract/LiveRoom");
19
+ const utils_1 = require("./utils");
20
+ function getRoomStatus(s) {
21
+ switch (s) {
22
+ case 1:
23
+ return __1.RoomStatus.live;
24
+ case 2:
25
+ return __1.RoomStatus.round;
26
+ default:
27
+ return __1.RoomStatus.off;
28
+ }
29
+ }
30
+ class RoomBilibili extends LiveRoom_1.LiveRoom {
31
+ constructor(
32
+ /** 房间id */
33
+ id,
34
+ /** 生成房间后是否打开 */
35
+ open = false,
36
+ /** 配置项 */
37
+ config) {
38
+ super();
39
+ /** 平台id */
40
+ this.platform = "bilibili";
41
+ /** 直播间room_id */
42
+ this.roomid = 0;
43
+ /** 房间信息 */
44
+ this.detail = {
45
+ /** 直播标题 */
46
+ title: "",
47
+ /** 分区 */
48
+ area: [],
49
+ /** 封面url */
50
+ cover: "",
51
+ };
52
+ this.stats = {
53
+ /** 观看数 */
54
+ view: 0,
55
+ /** 点赞数 */
56
+ like: 0,
57
+ };
58
+ /** 房间是否可用 */
59
+ this.available = false;
60
+ /** 是否连接上房间 */
61
+ this.connected = false;
62
+ /** 主播信息 */
63
+ this.anchor = { name: "", id: 0 };
64
+ /** 直播间弹幕api模块 */
65
+ this.client = null;
66
+ _RoomBilibili_auth.set(this, "");
67
+ this.userId = 0;
68
+ this.buvid = "";
69
+ this.token = "";
70
+ /** 是否处于正在打开的状态 */
71
+ this.opening = false;
72
+ this.id = id; // 直播间号
73
+ this.connectInterval = config?.connectInterval || 100;
74
+ __classPrivateFieldSet(this, _RoomBilibili_auth, config?.auth || "", "f");
75
+ if (open) {
76
+ this.open();
77
+ }
78
+ else {
79
+ this.getInfo();
80
+ }
81
+ }
82
+ /** 获取房间信息 */
83
+ async getInfo() {
84
+ await fetch(`https://api.live.bilibili.com/xlive/web-room/v1/index/getInfoByRoom?room_id=${this.id}`, {
85
+ method: "GET",
86
+ }) // 获取直播间信息
87
+ .then((response) => response.json())
88
+ .then((res) => {
89
+ const { room_info, anchor_info, like_info_v3, watched_show } = res.data;
90
+ this.roomid = room_info.room_id;
91
+ this.status = room_info.lock_status
92
+ ? __1.RoomStatus.banned
93
+ : getRoomStatus(room_info.live_status);
94
+ this.timestamp =
95
+ this.status == __1.RoomStatus.live
96
+ ? room_info.live_start_time * 1000
97
+ : this.timestamp;
98
+ this.detail.title = room_info.title;
99
+ this.detail.area = [room_info.parent_area_name, room_info.area_name];
100
+ this.detail.cover = room_info.cover;
101
+ this.stats.view = watched_show.num;
102
+ this.stats.like = like_info_v3.total_likes;
103
+ this.anchor.id = room_info.uid;
104
+ this.anchor.name = anchor_info.base_info.uname;
105
+ this.anchor.avatar = anchor_info.base_info.face;
106
+ this.liveId = room_info.live_id_str;
107
+ this.available = true;
108
+ console.log("[bilibiliLive] 已获取房间信息");
109
+ this.emit("info", this.info);
110
+ })
111
+ .catch((error) => {
112
+ console.error(error);
113
+ });
114
+ }
115
+ /** 开启直播间监听 */
116
+ async open() {
117
+ // 如果直播间监听已打开或处于正在打开状态,则返回
118
+ if (this.opened || this.opening)
119
+ return;
120
+ this.opening = true;
121
+ await this.getInfo();
122
+ await this.initAuth();
123
+ this.opening = false;
124
+ // 如果直播间不可用,则返回
125
+ if (!this.available)
126
+ return;
127
+ this.opened = true;
128
+ this.createWS();
129
+ this.emit("open");
130
+ }
131
+ /** 设置登录凭据 */
132
+ setAuth(auth) {
133
+ __classPrivateFieldSet(this, _RoomBilibili_auth, auth, "f");
134
+ this.initAuth();
135
+ }
136
+ /** 初始化登录凭据 */
137
+ async initAuth() {
138
+ this.userId = (await (0, utils_1.getLoginUid)(__classPrivateFieldGet(this, _RoomBilibili_auth, "f"))) || 0;
139
+ this.buvid = (await (0, utils_1.getBuvid)(__classPrivateFieldGet(this, _RoomBilibili_auth, "f"))) || "";
140
+ this.token = (await (0, utils_1.getKey)(this.roomid, __classPrivateFieldGet(this, _RoomBilibili_auth, "f"))) || "";
141
+ if (this.opened) {
142
+ // 如果已打开,则重新开一个登录后的连接客户端
143
+ const lastClient = this.client;
144
+ this.createWS();
145
+ this.client?.once("open", () => {
146
+ lastClient?.removeAllListeners();
147
+ lastClient?.close();
148
+ });
149
+ }
150
+ }
151
+ /** 连接直播服务端 */
152
+ createWS() {
153
+ // 与Websocket服务器连接
154
+ console.log("[bilibili-live-ws] 开始连接bilibili直播服务器");
155
+ this.client = new bilibili_live_ws_1.KeepLiveWS(this.roomid, {
156
+ uid: this.userId,
157
+ buvid: this.buvid,
158
+ key: this.token,
159
+ });
160
+ let client = this.client;
161
+ client.interval = this.connectInterval;
162
+ client.on("open", () => {
163
+ console.log("[bilibili-live-ws] 已连接bilibili直播服务器");
164
+ this.emit("connect");
165
+ });
166
+ client.on("close", () => {
167
+ console.log("[bilibili-live-ws] 与bilibili直播服务器的连接已关闭");
168
+ this.emit("disconnect");
169
+ });
170
+ client.on("live", () => {
171
+ console.log("[bilibili-live-ws] 目标房间连接成功");
172
+ });
173
+ client.on("msg", (data) => {
174
+ this.emitRaw(data);
175
+ });
176
+ client.on("DANMU_MSG", this.msg_DANMU_MSG.bind(this));
177
+ //client.on("ENTRY_EFFECT", this.msg_ENTRY_EFFECT.bind(this));
178
+ client.on("INTERACT_WORD", this.msg_INTERACT_WORD.bind(this));
179
+ client.on("SEND_GIFT", this.msg_SEND_GIFT.bind(this));
180
+ client.on("GUARD_BUY", this.msg_GUARD_BUY.bind(this));
181
+ //client.on('COMBO_SEND', this.msg_COMBO_SEND.bind(this))
182
+ client.on("ROOM_BLOCK_MSG", this.msg_ROOM_BLOCK_MSG.bind(this));
183
+ client.on("SUPER_CHAT_MESSAGE", this.msg_SUPER_CHAT_MESSAGE.bind(this));
184
+ client.on("CUT_OFF", this.msg_CUT_OFF.bind(this));
185
+ client.on("PREPARING", this.msg_PREPARING.bind(this));
186
+ client.on("LIVE", this.msg_LIVE.bind(this));
187
+ client.on("ROOM_CHANGE", this.msg_ROOM_CHANGE.bind(this));
188
+ client.on("WATCHED_CHANGE", this.msg_WATCHED_CHANGE.bind(this));
189
+ client.on("LIKE_INFO_V3_UPDATE", this.msg_LIKE_INFO_V3_UPDATE.bind(this));
190
+ client.on("ONLINE_RANK_COUNT", this.msg_ONLINE_RANK_COUNT.bind(this));
191
+ }
192
+ /** 关闭直播间监听 */
193
+ close() {
194
+ if (!this.opened)
195
+ return;
196
+ this.opened = false;
197
+ this.client?.close();
198
+ this.emit("close");
199
+ }
200
+ /** 获取弹幕消息 */
201
+ msg_DANMU_MSG(msg) {
202
+ const m = (0, parser_1.parseMessage)(msg, this);
203
+ m && this.emitMsg(m);
204
+ }
205
+ /** 获取互动消息 */
206
+ msg_INTERACT_WORD(msg) {
207
+ const m = (0, parser_1.parseMessage)(msg, this);
208
+ m && this.emitMsg(m);
209
+ }
210
+ /** 获取礼物消息 */
211
+ msg_SEND_GIFT(msg) {
212
+ const m = (0, parser_1.parseMessage)(msg, this);
213
+ m && this.emitMsg(m);
214
+ }
215
+ /** 获取舰长开通消息 */
216
+ msg_GUARD_BUY(msg) {
217
+ const m = (0, parser_1.parseMessage)(msg, this);
218
+ m && this.emitMsg(m);
219
+ }
220
+ /** 获取醒目留言消息 */
221
+ msg_SUPER_CHAT_MESSAGE(msg) {
222
+ const m = (0, parser_1.parseMessage)(msg, this);
223
+ m && this.emitMsg(m);
224
+ }
225
+ /** 观看数变化 */
226
+ msg_WATCHED_CHANGE(msg) {
227
+ const m = (0, parser_1.parseMessage)(msg, this);
228
+ m && this.emitMsg(m);
229
+ }
230
+ /** 点赞数变化 */
231
+ msg_LIKE_INFO_V3_UPDATE(msg) {
232
+ const m = (0, parser_1.parseMessage)(msg, this);
233
+ m && this.emitMsg(m);
234
+ }
235
+ msg_ONLINE_RANK_COUNT(msg) {
236
+ const m = (0, parser_1.parseMessage)(msg, this);
237
+ m && this.emitMsg(m);
238
+ }
239
+ msg_ROOM_BLOCK_MSG(msg) {
240
+ const m = (0, parser_1.parseMessage)(msg, this);
241
+ m && this.emitMsg(m);
242
+ }
243
+ msg_LIVE(msg) {
244
+ const m = (0, parser_1.parseMessage)(msg, this);
245
+ m && this.emitMsg(m);
246
+ }
247
+ msg_CUT_OFF(msg) {
248
+ const m = (0, parser_1.parseMessage)(msg, this);
249
+ m && this.emitMsg(m);
250
+ }
251
+ msg_PREPARING(msg) {
252
+ const m = (0, parser_1.parseMessage)(msg, this);
253
+ m && this.emitMsg(m);
254
+ }
255
+ msg_ROOM_CHANGE(msg) {
256
+ const m = (0, parser_1.parseMessage)(msg, this);
257
+ m && this.emitMsg(m);
258
+ }
259
+ }
260
+ _RoomBilibili_auth = new WeakMap();
261
+ exports.default = RoomBilibili;
@@ -0,0 +1,424 @@
1
+ import { DanmakuMode } from "../../src/enum";
2
+ export declare namespace RawMessage {
3
+ interface Base {
4
+ cmd: string;
5
+ /** 消息id */
6
+ msg_id?: string;
7
+ /** 发送时间 */
8
+ send_time?: number;
9
+ }
10
+ export interface DANMU_MSG extends Base {
11
+ cmd: "DANMU_MSG";
12
+ info: {
13
+ 0: {
14
+ /** 弹幕模式 */
15
+ 1: DanmakuMode;
16
+ /** 弹幕字号 */
17
+ 2: number;
18
+ /** 弹幕颜色 */
19
+ 3: number;
20
+ /** 时间戳 */
21
+ 4: number;
22
+ /** 是否为图片信息 */
23
+ 12: number;
24
+ /** 图片信息 */
25
+ 13: {
26
+ /** 表情图片id */
27
+ emoticon_unique: string;
28
+ /** 表情图片url */
29
+ url: string;
30
+ /** 表情图片宽度 */
31
+ width: number;
32
+ /** 表情图片高度 */
33
+ height: number;
34
+ };
35
+ /** 附加信息 */
36
+ 15: {
37
+ extra: string;
38
+ };
39
+ /** 活动信息 */
40
+ 16: {
41
+ /** 弹幕不在聊天栏显示 */
42
+ not_show: number;
43
+ };
44
+ };
45
+ /** 弹幕内容 */
46
+ 1: string;
47
+ 2: {
48
+ /** 用户uid */
49
+ 0: number;
50
+ /** 用户名 */
51
+ 1: string;
52
+ /** 用户是否为房管 */
53
+ 2: number;
54
+ };
55
+ /** 粉丝勋章信息 */
56
+ 3: {
57
+ /** 勋章等级 */
58
+ 0: number;
59
+ /** 勋章名称 */
60
+ 1: string;
61
+ /** 勋章id */
62
+ 12: number;
63
+ /** 大航海级别 */
64
+ 10: number;
65
+ };
66
+ /** 大航海级别 */
67
+ 7: number;
68
+ };
69
+ }
70
+ export interface INTERACT_WORD extends Base {
71
+ cmd: "INTERACT_WORD";
72
+ data: {
73
+ /** 用户名 */
74
+ uname: string;
75
+ /** 用户id */
76
+ uid: number;
77
+ /** 互动类型 */
78
+ msg_type: number;
79
+ /** 触发时间*1000000 */
80
+ trigger_time: number;
81
+ /** 粉丝勋章 */
82
+ fans_medal: {
83
+ /** 勋章等级 */
84
+ medal_level: number;
85
+ /** 勋章名称 */
86
+ medal_name: string;
87
+ /** 勋章id */
88
+ target_id: number;
89
+ /** 大航海级别 */
90
+ guard_level: number;
91
+ };
92
+ };
93
+ }
94
+ export interface SEND_GIFT extends Base {
95
+ cmd: "SEND_GIFT";
96
+ data: {
97
+ /** 用户名 */
98
+ uname: string;
99
+ /** 用户id */
100
+ uid: number;
101
+ /** 用户头像 */
102
+ face: string;
103
+ /** 发送时间(s) */
104
+ timestamp: number;
105
+ /** 粉丝勋章 */
106
+ fans_medal: {
107
+ /** 勋章等级 */
108
+ medal_level: number;
109
+ /** 勋章名称 */
110
+ medal_name: string;
111
+ /** 勋章id */
112
+ target_id: number;
113
+ /** 大航海级别 */
114
+ guard_level: number;
115
+ };
116
+ /** 大航海级别 */
117
+ guard_level: number;
118
+ /** 礼物名称 */
119
+ giftName: string;
120
+ /** 礼物id */
121
+ giftId: number;
122
+ /** 礼物总数 */
123
+ num: number;
124
+ total_coin: number;
125
+ coin_type: string;
126
+ action: string;
127
+ combo_id: string;
128
+ batch_combo_id: string;
129
+ };
130
+ }
131
+ export interface GUARD_BUY extends Base {
132
+ cmd: "GUARD_BUY";
133
+ data: {
134
+ /** 用户名 */
135
+ username: string;
136
+ /** 用户id */
137
+ uid: number;
138
+ /** 发送时间(s) */
139
+ start_time: number;
140
+ /** 大航海级别 */
141
+ guard_level: number;
142
+ /** 礼物名称 */
143
+ gift_name: string;
144
+ /** 礼物id */
145
+ gift_id: number;
146
+ /** 礼物总数 */
147
+ num: number;
148
+ /** 礼物价值 */
149
+ price: number;
150
+ };
151
+ }
152
+ export interface SUPER_CHAT_MESSAGE extends Base {
153
+ cmd: "SUPER_CHAT_MESSAGE";
154
+ data: {
155
+ /** sc消息id */
156
+ id: string;
157
+ /** 用户id */
158
+ uid: number;
159
+ /** 用户信息 */
160
+ user_info: {
161
+ /** 用户名 */
162
+ uname: string;
163
+ /** 用户头像 */
164
+ face: string;
165
+ /** 大航海级别 */
166
+ guard_level: number;
167
+ };
168
+ /** 粉丝勋章 */
169
+ medal_info: {
170
+ /** 勋章等级 */
171
+ medal_level: number;
172
+ /** 勋章名称 */
173
+ medal_name: string;
174
+ /** 勋章id */
175
+ target_id: number;
176
+ /** 大航海级别 */
177
+ guard_level: number;
178
+ };
179
+ /** 发送时间(s) */
180
+ ts: number;
181
+ /** 礼物信息 */
182
+ gift: {
183
+ /** 礼物名称 */
184
+ gift_name: string;
185
+ /** 礼物id */
186
+ gift_id: number;
187
+ /** 礼物总数 */
188
+ num: number;
189
+ };
190
+ /** 礼物价值 */
191
+ price: number;
192
+ /** 消息 */
193
+ message: string;
194
+ /** 颜色 */
195
+ background_bottom_color: string;
196
+ /** 消息 */
197
+ time: number;
198
+ };
199
+ }
200
+ export interface WATCHED_CHANGE extends Base {
201
+ cmd: "WATCHED_CHANGE";
202
+ data: {
203
+ num: number;
204
+ };
205
+ }
206
+ export interface LIKE_INFO_V3_UPDATE extends Base {
207
+ cmd: "LIKE_INFO_V3_UPDATE";
208
+ data: {
209
+ click_count: number;
210
+ };
211
+ }
212
+ export interface ONLINE_RANK_COUNT extends Base {
213
+ cmd: "ONLINE_RANK_COUNT";
214
+ data: {
215
+ count?: number;
216
+ online_count?: number;
217
+ };
218
+ }
219
+ export interface ROOM_BLOCK_MSG extends Base {
220
+ cmd: "ROOM_BLOCK_MSG";
221
+ data: {
222
+ /** 用户名 */
223
+ uname: string;
224
+ /** 用户id */
225
+ uid: number;
226
+ /** 执行操作的用户类型 */
227
+ operator: number;
228
+ };
229
+ }
230
+ export interface LIVE extends Base {
231
+ cmd: "LIVE";
232
+ /** 直播时间 */
233
+ live_time: number;
234
+ /** 直播id */
235
+ live_key: string;
236
+ }
237
+ export interface CUT_OFF extends Base {
238
+ cmd: "CUT_OFF";
239
+ /** 切断消息 */
240
+ msg: string;
241
+ }
242
+ export interface PREPARING extends Base {
243
+ cmd: "PREPARING";
244
+ /** 是否为轮播 */
245
+ round?: number;
246
+ }
247
+ export interface ROOM_CHANGE extends Base {
248
+ cmd: "ROOM_CHANGE";
249
+ data: {
250
+ title: string;
251
+ parent_area_name: string;
252
+ area_name: string;
253
+ };
254
+ }
255
+ export type All = DANMU_MSG | INTERACT_WORD | SEND_GIFT | GUARD_BUY | SUPER_CHAT_MESSAGE | WATCHED_CHANGE | LIKE_INFO_V3_UPDATE | ONLINE_RANK_COUNT | ROOM_BLOCK_MSG | LIVE | CUT_OFF | PREPARING | ROOM_CHANGE;
256
+ export {};
257
+ }
258
+ /** 接口返回的直播间信息
259
+ * https://api.live.bilibili.com/xlive/web-room/v1/index/getInfoByRoom?room_id={id} */
260
+ export interface RawInfo {
261
+ room_info: {
262
+ /** 用户uid */
263
+ uid: number;
264
+ /** 房间id */
265
+ room_id: number;
266
+ /** 短id */
267
+ short_id: number;
268
+ /** 直播间标题 */
269
+ title: string;
270
+ /** 直播间封面 */
271
+ cover: string;
272
+ /** 直播间标签 */
273
+ tags: string;
274
+ /** 直播间背景 */
275
+ background: string;
276
+ /** 直播间简介 */
277
+ description: string;
278
+ /** 直播状态 */
279
+ live_status: number;
280
+ /** 直播开始时间(s) */
281
+ live_start_time: number;
282
+ /** 是否被封禁 */
283
+ lock_status: number;
284
+ /** 封禁时间 */
285
+ lock_time: number;
286
+ /** 是否被隐藏 */
287
+ hidden_status: number;
288
+ /** 隐藏时间 */
289
+ hidden_time: number;
290
+ /** 分区id */
291
+ area_id: number;
292
+ /** 分区名 */
293
+ area_name: string;
294
+ /** 一级分区id */
295
+ parent_area_id: number;
296
+ /** 一级分区名 */
297
+ parent_area_name: string;
298
+ /** session */
299
+ up_session: string;
300
+ /** 直播场次id */
301
+ live_id: number;
302
+ /** 直播场次id */
303
+ live_id_str: string;
304
+ /** 观看数 */
305
+ online: number;
306
+ };
307
+ /** 主播信息 */
308
+ anchor_info: {
309
+ /** 基本信息 */
310
+ base_info: {
311
+ /** 用户名 */
312
+ uname: string;
313
+ /** 头像 */
314
+ face: string;
315
+ /** 性别 */
316
+ gender: string;
317
+ /** 官方信息 */
318
+ official_info: {
319
+ role: number;
320
+ title: string;
321
+ desc: string;
322
+ };
323
+ };
324
+ /** 直播信息 */
325
+ live_info: {
326
+ /** 主播等级 */
327
+ level: number;
328
+ /** 等级颜色 */
329
+ level_color: number;
330
+ /** 经验值 */
331
+ score: number;
332
+ /** 下一级所需经验值 */
333
+ upgrade_score: number;
334
+ /** 当前等级 */
335
+ current: [number, number];
336
+ /** 下一等级 */
337
+ next: [number, number];
338
+ /** 直播间排名 */
339
+ rank: string;
340
+ };
341
+ /** 直播间粉丝牌信息 */
342
+ medal_info: {
343
+ /** 粉丝牌名称 */
344
+ medal_name: string;
345
+ /** 粉丝牌id */
346
+ medal_id: number;
347
+ /** 粉丝团成员数 */
348
+ fansclub: number;
349
+ };
350
+ };
351
+ /** 公告信息 */
352
+ news_info: {
353
+ /** uid */
354
+ uid: number;
355
+ /** 创建时间 */
356
+ ctime: string;
357
+ /** 公告内容 */
358
+ content: string;
359
+ };
360
+ /** 分区排名信息 */
361
+ area_rank_info: {
362
+ areaRank: {
363
+ index: number;
364
+ rank: string;
365
+ };
366
+ liveRank: {
367
+ rank: string;
368
+ };
369
+ };
370
+ /** sc信息 */
371
+ super_chat_info: {
372
+ status: number;
373
+ ranked_mark: number;
374
+ message_list: [];
375
+ };
376
+ /** 在线榜单信息 */
377
+ online_gold_rank_info_v2: {
378
+ list: {
379
+ uid: number;
380
+ face: string;
381
+ uname: string;
382
+ score: string;
383
+ rank: number;
384
+ guard_level: number;
385
+ }[];
386
+ };
387
+ watched_show: {
388
+ num: number;
389
+ text_small: string;
390
+ text_large: string;
391
+ };
392
+ show_reserve_status: false;
393
+ /** 点赞信息 */
394
+ like_info_v3: {
395
+ /** 总点赞数 */
396
+ total_likes: number;
397
+ };
398
+ /** 大航海信息 */
399
+ guard_info: {
400
+ count: number;
401
+ anchor_guard_achieve_level: number;
402
+ };
403
+ room_rank_info: {
404
+ user_rank_entry: {
405
+ /** 贡献榜排行 */
406
+ user_contribution_rank_entry: {
407
+ item: {
408
+ uid: number;
409
+ name: string;
410
+ face: string;
411
+ rank: number;
412
+ score: number;
413
+ medal_info: null;
414
+ guard_level: number;
415
+ wealth_level: number;
416
+ }[];
417
+ /** 贡献榜总数 */
418
+ count: number;
419
+ /** 最大显示数量 */
420
+ show_max: number;
421
+ };
422
+ };
423
+ };
424
+ }
@@ -0,0 +1,16 @@
1
+ export declare function parseCookieString(str: string): Record<string, string>;
2
+ /** 获取登录用户的uid */
3
+ export declare function getLoginUid(cookie?: string): Promise<any>;
4
+ /** 获取buvid */
5
+ export declare function getBuvid(cookie?: string): Promise<string | undefined>;
6
+ /** 获取直播间弹幕token */
7
+ export declare function getKey(roomId: number, cookie?: string): Promise<any>;
8
+ /** 生成登录二维码 */
9
+ export declare function generateLoginQRcode(): Promise<{
10
+ url: any;
11
+ key: any;
12
+ }>;
13
+ /** 在终端打印登录二维码 */
14
+ export declare function printQRcode(url: string): void;
15
+ /** 检测登录二维码 */
16
+ export declare function checkLoginQRcode(key: string): Promise<unknown>;