@bililive-tools/bilibili-recorder 1.6.0 → 1.7.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.
- package/lib/danma.d.ts +1 -1
- package/lib/index.js +21 -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,22 @@ 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
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
this.state = "check-error";
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
104
|
+
if (this.liveInfo.liveId === banLiveId) {
|
|
99
105
|
this.tempStopIntervalCheck = true;
|
|
100
106
|
}
|
|
101
107
|
else {
|
|
@@ -103,7 +109,7 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, isManualStart, b
|
|
|
103
109
|
}
|
|
104
110
|
if (this.tempStopIntervalCheck)
|
|
105
111
|
return null;
|
|
106
|
-
if (!living)
|
|
112
|
+
if (!this.liveInfo.living)
|
|
107
113
|
return null;
|
|
108
114
|
// 检查标题是否包含关键词,如果包含则不自动录制
|
|
109
115
|
// 手动开始录制时不检查标题关键词
|
|
@@ -111,11 +117,11 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, isManualStart, b
|
|
|
111
117
|
this.titleKeywords &&
|
|
112
118
|
typeof this.titleKeywords === "string" &&
|
|
113
119
|
this.titleKeywords.trim()) {
|
|
114
|
-
const hasTitleKeyword = hasKeyword(
|
|
120
|
+
const hasTitleKeyword = hasKeyword(this.liveInfo.title, this.titleKeywords);
|
|
115
121
|
if (hasTitleKeyword) {
|
|
116
122
|
this.emit("DebugLog", {
|
|
117
123
|
type: "common",
|
|
118
|
-
text: `跳过录制:直播间标题 "${
|
|
124
|
+
text: `跳过录制:直播间标题 "${this.liveInfo.title}" 包含关键词 "${this.titleKeywords}"`,
|
|
119
125
|
});
|
|
120
126
|
return null;
|
|
121
127
|
}
|
|
@@ -149,7 +155,7 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, isManualStart, b
|
|
|
149
155
|
catch (err) {
|
|
150
156
|
if (this.qualityRetry > 0)
|
|
151
157
|
this.qualityRetry -= 1;
|
|
152
|
-
this.state = "
|
|
158
|
+
this.state = "check-error";
|
|
153
159
|
throw err;
|
|
154
160
|
}
|
|
155
161
|
this.state = "recording";
|
|
@@ -259,7 +265,7 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, isManualStart, b
|
|
|
259
265
|
});
|
|
260
266
|
let danmaClient = new DanmaClient(roomId, {
|
|
261
267
|
auth: this.auth,
|
|
262
|
-
uid: this.uid,
|
|
268
|
+
uid: Number(this.uid),
|
|
263
269
|
useServerTimestamp: this.useServerTimestamp,
|
|
264
270
|
});
|
|
265
271
|
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.0",
|
|
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",
|