@bililive-tools/douyu-recorder 1.3.0 → 1.4.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
@@ -47,6 +47,7 @@ interface Options {
47
47
  saveSCDanma?: boolean; // 保存高能弹幕
48
48
  saveCover?: boolean; // 保存封面
49
49
  videoFormat?: "auto"; // 视频格式: "auto", "ts", "mkv" ,auto模式下, 分段使用 "ts",不分段使用 "mp4"
50
+ onlyAudio?: boolean; // 只录制音频,默认为否
50
51
  }
51
52
  ```
52
53
 
package/lib/dy_api.d.ts CHANGED
@@ -6,6 +6,7 @@ export declare function getLiveInfo(opts: {
6
6
  cdn?: string;
7
7
  rate?: number;
8
8
  rejectSignFnCache?: boolean;
9
+ onlyAudio?: boolean;
9
10
  }): Promise<{
10
11
  living: false;
11
12
  } | {
package/lib/dy_api.js CHANGED
@@ -21,6 +21,8 @@ export async function getLiveInfo(opts) {
21
21
  cdn: opts.cdn ?? "",
22
22
  // 相当于清晰度类型的 id,给 -1 会由后端决定,0为原画
23
23
  rate: String(opts.rate ?? 0),
24
+ // 是否只录制音频
25
+ fa: opts.onlyAudio ? "1" : "0",
24
26
  }));
25
27
  if (res.status !== 200) {
26
28
  if (res.status === 403 && res.data === "鉴权失败" && !opts.rejectSignFnCache) {
package/lib/index.js CHANGED
@@ -155,6 +155,7 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, banLiveId, isMan
155
155
  quality: this.quality,
156
156
  source: this.source,
157
157
  strictQuality,
158
+ onlyAudio: this.onlyAudio,
158
159
  });
159
160
  }
160
161
  catch (err) {
@@ -220,7 +221,7 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, banLiveId, isMan
220
221
  room_id: this.channelId,
221
222
  platform: provider?.id,
222
223
  liveStartTimestamp: liveInfo.startTime?.getTime(),
223
- recordStopTimestamp: Date.now(),
224
+ // recordStopTimestamp: Date.now(),
224
225
  title: title,
225
226
  user_name: owner,
226
227
  });
package/lib/stream.d.ts CHANGED
@@ -12,6 +12,7 @@ export declare function getStream(opts: Pick<Recorder, "channelId" | "quality">
12
12
  rejectCache?: boolean;
13
13
  strictQuality?: boolean;
14
14
  source?: string;
15
+ onlyAudio?: boolean;
15
16
  }): Promise<{
16
17
  living: true;
17
18
  sources: import("./dy_api.js").SourceProfile[];
package/lib/stream.js CHANGED
@@ -48,6 +48,7 @@ export async function getStream(opts) {
48
48
  channelId: opts.channelId,
49
49
  rate: qn,
50
50
  cdn: opts.source === "auto" ? undefined : opts.source,
51
+ onlyAudio: opts.onlyAudio,
51
52
  });
52
53
  if (!liveInfo.living)
53
54
  throw new Error("It must be called getStream when living");
@@ -68,6 +69,7 @@ export async function getStream(opts) {
68
69
  liveInfo = await getLiveInfo({
69
70
  channelId: opts.channelId,
70
71
  rate: liveInfo.streams[0].rate,
72
+ onlyAudio: opts.onlyAudio,
71
73
  });
72
74
  if (!liveInfo.living)
73
75
  throw new Error("It must be called getStream when living");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bililive-tools/douyu-recorder",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "bililive-tools douyu recorder implemention",
5
5
  "main": "./lib/index.js",
6
6
  "type": "module",