@bililive-tools/bilibili-recorder 1.16.0 → 1.16.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/index.js +42 -29
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -216,8 +216,8 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, isManualStart, b
|
|
|
216
216
|
});
|
|
217
217
|
};
|
|
218
218
|
downloader.on("videoFileCreated", handleVideoCreated);
|
|
219
|
-
downloader.on("videoFileCompleted", (
|
|
220
|
-
this.emit("videoFileCompleted",
|
|
219
|
+
downloader.on("videoFileCompleted", (data) => {
|
|
220
|
+
this.emit("videoFileCompleted", data);
|
|
221
221
|
});
|
|
222
222
|
downloader.on("DebugLog", (data) => {
|
|
223
223
|
this.emit("DebugLog", data);
|
|
@@ -233,34 +233,47 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, isManualStart, b
|
|
|
233
233
|
uid: Number(this.uid),
|
|
234
234
|
useServerTimestamp: this.useServerTimestamp,
|
|
235
235
|
});
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
236
|
+
// 开启了禁止提供弹幕功能,并且也没有设置标题关键词,才完全禁止连接弹幕服务器,否则都连接弹幕服务器,前者不处理弹幕消息,后者根据标题关键词来判断是否停止录制
|
|
237
|
+
const enableDanmaListen = !this.disableProvideCommentsWhenRecording ||
|
|
238
|
+
utils.shouldCheckTitleKeywords(isManualStart, this.titleKeywords);
|
|
239
|
+
danmaClient.on("Message", (msg) => {
|
|
240
|
+
if (this.disableProvideCommentsWhenRecording)
|
|
241
|
+
return;
|
|
242
|
+
const extraDataController = downloader.getExtraDataController();
|
|
243
|
+
if (!extraDataController)
|
|
244
|
+
return;
|
|
245
|
+
if (msg.type === "super_chat" && this.saveSCDanma === false)
|
|
246
|
+
return;
|
|
247
|
+
if ((msg.type === "give_gift" || msg.type === "guard") && this.saveGiftDanma === false)
|
|
248
|
+
return;
|
|
249
|
+
this.emit("Message", msg);
|
|
250
|
+
extraDataController.addMessage(msg);
|
|
251
|
+
});
|
|
252
|
+
danmaClient.on("onRoomInfoChange", (msg) => {
|
|
253
|
+
if (utils.shouldCheckTitleKeywords(isManualStart, this.titleKeywords)) {
|
|
254
|
+
const title = msg?.body?.title ?? "";
|
|
255
|
+
const hasTitleKeyword = utils.hasBlockedTitleKeywords(title, this.titleKeywords);
|
|
256
|
+
if (hasTitleKeyword) {
|
|
257
|
+
this.state = "title-blocked";
|
|
258
|
+
this.emit("DebugLog", {
|
|
259
|
+
type: "common",
|
|
260
|
+
text: `检测到标题包含关键词,停止录制:直播间标题 "${title}" 包含关键词 "${this.titleKeywords}"`,
|
|
261
|
+
});
|
|
262
|
+
// 停止录制
|
|
263
|
+
this.recordHandle && this.recordHandle.stop("直播间标题包含关键词");
|
|
261
264
|
}
|
|
262
|
-
}
|
|
263
|
-
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
if (enableDanmaListen) {
|
|
268
|
+
try {
|
|
269
|
+
danmaClient.start();
|
|
270
|
+
}
|
|
271
|
+
catch (err) {
|
|
272
|
+
this.emit("DebugLog", {
|
|
273
|
+
type: "error",
|
|
274
|
+
text: `弹幕连接失败,错误信息: ${String(err)}`,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
264
277
|
}
|
|
265
278
|
const downloaderArgs = downloader.getArguments();
|
|
266
279
|
downloader.run();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bililive-tools/bilibili-recorder",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.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.15.0",
|
|
42
|
-
"@bililive-tools/manager": "^1.16.
|
|
42
|
+
"@bililive-tools/manager": "^1.16.2"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "tsc",
|