@bililive-tools/bilibili-recorder 1.6.0 → 1.7.1
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/lib/danma.d.ts +1 -1
- package/lib/index.js +22 -15
- package/package.json +2 -2
package/lib/danma.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ declare class DanmaClient extends EventEmitter {
|
|
|
8
8
|
private useServerTimestamp;
|
|
9
9
|
constructor(roomId: number, { auth, uid, useServerTimestamp, }: {
|
|
10
10
|
auth: string | undefined;
|
|
11
|
-
uid: number
|
|
11
|
+
uid: number;
|
|
12
12
|
useServerTimestamp?: boolean;
|
|
13
13
|
});
|
|
14
14
|
start(): Promise<void>;
|
package/lib/index.js
CHANGED
|
@@ -86,16 +86,23 @@ const ffmpegInputOptions = [
|
|
|
86
86
|
const checkLiveStatusAndRecord = async function ({ getSavePath, isManualStart, banLiveId, }) {
|
|
87
87
|
if (this.recordHandle != null)
|
|
88
88
|
return this.recordHandle;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
89
|
+
try {
|
|
90
|
+
const { living, liveId, owner: _owner, title: _title } = await getLiveStatus(this.channelId);
|
|
91
|
+
this.liveInfo = {
|
|
92
|
+
living,
|
|
93
|
+
owner: _owner,
|
|
94
|
+
title: _title,
|
|
95
|
+
avatar: "",
|
|
96
|
+
cover: "",
|
|
97
|
+
liveId: liveId,
|
|
98
|
+
};
|
|
99
|
+
this.state = "idle";
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
this.state = "check-error";
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
105
|
+
if (this.liveInfo.liveId === banLiveId) {
|
|
99
106
|
this.tempStopIntervalCheck = true;
|
|
100
107
|
}
|
|
101
108
|
else {
|
|
@@ -103,7 +110,7 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, isManualStart, b
|
|
|
103
110
|
}
|
|
104
111
|
if (this.tempStopIntervalCheck)
|
|
105
112
|
return null;
|
|
106
|
-
if (!living)
|
|
113
|
+
if (!this.liveInfo.living)
|
|
107
114
|
return null;
|
|
108
115
|
// 检查标题是否包含关键词,如果包含则不自动录制
|
|
109
116
|
// 手动开始录制时不检查标题关键词
|
|
@@ -111,11 +118,11 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, isManualStart, b
|
|
|
111
118
|
this.titleKeywords &&
|
|
112
119
|
typeof this.titleKeywords === "string" &&
|
|
113
120
|
this.titleKeywords.trim()) {
|
|
114
|
-
const hasTitleKeyword = hasKeyword(
|
|
121
|
+
const hasTitleKeyword = hasKeyword(this.liveInfo.title, this.titleKeywords);
|
|
115
122
|
if (hasTitleKeyword) {
|
|
116
123
|
this.emit("DebugLog", {
|
|
117
124
|
type: "common",
|
|
118
|
-
text: `跳过录制:直播间标题 "${
|
|
125
|
+
text: `跳过录制:直播间标题 "${this.liveInfo.title}" 包含关键词 "${this.titleKeywords}"`,
|
|
119
126
|
});
|
|
120
127
|
return null;
|
|
121
128
|
}
|
|
@@ -149,7 +156,7 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, isManualStart, b
|
|
|
149
156
|
catch (err) {
|
|
150
157
|
if (this.qualityRetry > 0)
|
|
151
158
|
this.qualityRetry -= 1;
|
|
152
|
-
this.state = "
|
|
159
|
+
this.state = "check-error";
|
|
153
160
|
throw err;
|
|
154
161
|
}
|
|
155
162
|
this.state = "recording";
|
|
@@ -259,7 +266,7 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, isManualStart, b
|
|
|
259
266
|
});
|
|
260
267
|
let danmaClient = new DanmaClient(roomId, {
|
|
261
268
|
auth: this.auth,
|
|
262
|
-
uid: this.uid,
|
|
269
|
+
uid: Number(this.uid),
|
|
263
270
|
useServerTimestamp: this.useServerTimestamp,
|
|
264
271
|
});
|
|
265
272
|
if (!this.disableProvideCommentsWhenRecording) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bililive-tools/bilibili-recorder",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"description": "bililive-tools bilibili recorder implemention",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"tiny-bilibili-ws": "^1.0.2",
|
|
40
40
|
"lodash-es": "^4.17.21",
|
|
41
41
|
"axios": "^1.7.8",
|
|
42
|
-
"@bililive-tools/manager": "^1.6.
|
|
42
|
+
"@bililive-tools/manager": "^1.6.1"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "tsc",
|