@bililive-tools/huya-recorder 1.1.0 → 1.2.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/README.md CHANGED
@@ -45,6 +45,7 @@ interface Options {
45
45
  saveGiftDanma?: boolean; // 保存礼物弹幕
46
46
  saveCover?: boolean; // 保存封面
47
47
  api?: "auto" | "mp" | "web"; // 默认为auto,在星秀区使用mp接口,其他使用web接口,你也可以强制指定
48
+ videoFormat?: "auto"; // 视频格式: "auto", "ts", "mkv" ,auto模式下, 分段使用 "ts",不分段使用 "mp4"
48
49
  }
49
50
  ```
50
51
 
package/lib/index.js CHANGED
@@ -82,7 +82,6 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, banLiveId, isMan
82
82
  const liveInfo = await getInfo(this.channelId);
83
83
  const { living, owner, title, liveId } = liveInfo;
84
84
  this.liveInfo = liveInfo;
85
- this.emit("LiveStart", { liveId });
86
85
  if (liveInfo.liveId === banLiveId) {
87
86
  this.tempStopIntervalCheck = true;
88
87
  }
@@ -93,6 +92,7 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, banLiveId, isMan
93
92
  return null;
94
93
  if (!living)
95
94
  return null;
95
+ this.emit("LiveStart", { liveId });
96
96
  let res;
97
97
  // TODO: 先不做什么错误处理,就简单包一下预期上会有错误的地方
98
98
  try {
@@ -145,6 +145,7 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, banLiveId, isMan
145
145
  segment: this.segment ?? 0,
146
146
  getSavePath: (opts) => getSavePath({ owner, title, startTime: opts.startTime }),
147
147
  disableDanma: this.disableProvideCommentsWhenRecording,
148
+ videoFormat: this.videoFormat ?? "auto",
148
149
  }, onEnd);
149
150
  const savePath = getSavePath({
150
151
  owner,
package/lib/stream.js CHANGED
@@ -64,6 +64,11 @@ export async function getStream(opts) {
64
64
  if (!expectSource) {
65
65
  expectSource = info.sources[0];
66
66
  }
67
+ if (expectSource.name === "TX") {
68
+ expectSource.url = expectSource.url
69
+ .replace("&ctype=tars_mp", "&ctype=huya_webh5")
70
+ .replace("&fs=bhct", "&fs=bgct");
71
+ }
67
72
  }
68
73
  return {
69
74
  ...info,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bililive-tools/huya-recorder",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "bililive-tools huya recorder implemention",
5
5
  "main": "./lib/index.js",
6
6
  "type": "module",
@@ -37,8 +37,8 @@
37
37
  "mitt": "^3.0.1",
38
38
  "lodash-es": "^4.17.21",
39
39
  "axios": "^1.7.8",
40
- "@bililive-tools/manager": "^1.1.0",
41
- "huya-danma-listener": "0.1.0"
40
+ "@bililive-tools/manager": "^1.2.0",
41
+ "huya-danma-listener": "0.1.1"
42
42
  },
43
43
  "devDependencies": {},
44
44
  "scripts": {