@bililive-tools/douyin-recorder 1.11.1 → 1.12.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 CHANGED
@@ -251,6 +251,41 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, banLiveId, isMan
251
251
  this.emit("Message", comment);
252
252
  extraDataController.addMessage(comment);
253
253
  });
254
+ client.on("privilegeScreenChat", (msg) => {
255
+ const extraDataController = downloader.getExtraDataController();
256
+ if (!extraDataController)
257
+ return;
258
+ const comment = {
259
+ type: "comment",
260
+ // 抖音飘屏没有时间戳数据,默认使用当前时间
261
+ timestamp: Date.now(),
262
+ text: msg.content,
263
+ color: "#e0c39c",
264
+ sender: {
265
+ uid: msg.user.id,
266
+ name: msg.user.nickName,
267
+ },
268
+ };
269
+ this.emit("Message", comment);
270
+ extraDataController.addMessage(comment);
271
+ });
272
+ client.on("screenChat", (msg) => {
273
+ const extraDataController = downloader.getExtraDataController();
274
+ if (!extraDataController)
275
+ return;
276
+ const comment = {
277
+ type: "comment",
278
+ timestamp: this.useServerTimestamp ? Number(msg.eventTime) / 1000000 : Date.now(),
279
+ text: msg.content,
280
+ color: "#d7f6fc",
281
+ sender: {
282
+ uid: msg.user.id,
283
+ name: msg.user.nickName,
284
+ },
285
+ };
286
+ this.emit("Message", comment);
287
+ extraDataController.addMessage(comment);
288
+ });
254
289
  client.on("gift", (msg) => {
255
290
  const extraDataController = downloader.getExtraDataController();
256
291
  if (!extraDataController)
@@ -269,7 +304,7 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, banLiveId, isMan
269
304
  color: "#ffffff",
270
305
  sender: {
271
306
  uid: msg.user.id,
272
- name: msg.user.nickName,
307
+ name: msg?.user?.nickName || "unknown",
273
308
  // avatar: msg.ic,
274
309
  // extra: {
275
310
  // level: msg.level,
package/lib/utils.d.ts CHANGED
@@ -8,5 +8,4 @@ export declare function assert(assertion: unknown, msg?: string): asserts assert
8
8
  export declare function assertStringType(data: unknown, msg?: string): asserts data is string;
9
9
  export declare function assertNumberType(data: unknown, msg?: string): asserts data is number;
10
10
  export declare function assertObjectType(data: unknown, msg?: string): asserts data is object;
11
- export declare function replaceExtName(filePath: string, newExtName: string): string;
12
11
  export declare function get__ac_signature(one_time_stamp: any, one_site: any, one_nonce: any, ua_n: any): string;
package/lib/utils.js CHANGED
@@ -39,9 +39,6 @@ export function assertNumberType(data, msg) {
39
39
  export function assertObjectType(data, msg) {
40
40
  assert(typeof data === "object", msg);
41
41
  }
42
- export function replaceExtName(filePath, newExtName) {
43
- return path.join(path.dirname(filePath), path.basename(filePath, path.extname(filePath)) + newExtName);
44
- }
45
42
  export function get__ac_signature(one_time_stamp, one_site, one_nonce, ua_n) {
46
43
  function cal_one_str(one_str, orgi_iv) {
47
44
  var k = orgi_iv;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bililive-tools/douyin-recorder",
3
- "version": "1.11.1",
3
+ "version": "1.12.1",
4
4
  "description": "@bililive-tools douyin recorder implemention",
5
5
  "main": "./lib/index.js",
6
6
  "type": "module",
@@ -38,8 +38,8 @@
38
38
  "lodash-es": "^4.17.21",
39
39
  "mitt": "^3.0.1",
40
40
  "sm-crypto": "^0.3.13",
41
- "@bililive-tools/manager": "^1.10.0",
42
- "douyin-danma-listener": "0.3.1"
41
+ "douyin-danma-listener": "0.4.0",
42
+ "@bililive-tools/manager": "^1.13.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/node": "*"