bililive-cli 3.22.0 → 3.22.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.
@@ -2,8 +2,8 @@
2
2
 
3
3
  var require$$0 = require('fs');
4
4
  var require$$0$1 = require('path');
5
- var index$1 = require('./index-ByKMHGR7.cjs');
6
- var index = require('./index-Db-mrTi0.cjs');
5
+ var index$1 = require('./index-CmRhhp3m.cjs');
6
+ var index = require('./index-B-Cevjk4.cjs');
7
7
  require('node:dns');
8
8
  require('constants');
9
9
  require('stream');
@@ -4,7 +4,7 @@ var path$3 = require('node:path');
4
4
  var http$4 = require('node:http');
5
5
  var urlLib = require('node:url');
6
6
  var https = require('node:https');
7
- var index$1 = require('./index-ByKMHGR7.cjs');
7
+ var index$1 = require('./index-CmRhhp3m.cjs');
8
8
  var require$$0$5 = require('tty');
9
9
  var require$$1$4 = require('util');
10
10
  var require$$0$b = require('assert');
@@ -62606,7 +62606,7 @@ class MultipartBody {
62606
62606
  let fileFromPathWarned = false;
62607
62607
  async function fileFromPath(path, ...args) {
62608
62608
  // this import fails in environments that don't handle export maps correctly, like old versions of Jest
62609
- const { fileFromPath: _fileFromPath } = await Promise.resolve().then(function () { return require('./fileFromPath-1V4Za2hv.cjs'); });
62609
+ const { fileFromPath: _fileFromPath } = await Promise.resolve().then(function () { return require('./fileFromPath-D1rsnNRo.cjs'); });
62610
62610
  if (!fileFromPathWarned) {
62611
62611
  console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path)}) instead`);
62612
62612
  fileFromPathWarned = true;
@@ -79275,7 +79275,7 @@ let handler;
79275
79275
  let appConfig;
79276
79276
  let container;
79277
79277
  const fileCache = createFileCache();
79278
- path$3.dirname(urlLib.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-Db-mrTi0.cjs', document.baseURI).href))));
79278
+ path$3.dirname(urlLib.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-B-Cevjk4.cjs', document.baseURI).href))));
79279
79279
  const authMiddleware = (passKey) => {
79280
79280
  return async (ctx, next) => {
79281
79281
  const authHeader = ctx.headers["authorization"] || ctx.request.query.auth;
@@ -12144,6 +12144,7 @@ const APP_DEFAULT_CONFIG = {
12144
12144
  douyu: {
12145
12145
  quality: 0,
12146
12146
  source: "auto",
12147
+ cookie: "",
12147
12148
  checkInterval: undefined,
12148
12149
  maxThreadCount: undefined,
12149
12150
  waitTime: undefined,
@@ -54947,7 +54948,7 @@ async function trash(paths, options) {
54947
54948
  } else if (process$2.platform === 'win32') {
54948
54949
  module = await Promise.resolve().then(function () { return require('./windows-C30k1cv-.cjs'); });
54949
54950
  } else {
54950
- module = await Promise.resolve().then(function () { return require('./linux-C-4qLKcq.cjs'); });
54951
+ module = await Promise.resolve().then(function () { return require('./linux-BFUWjr8o.cjs'); });
54951
54952
  }
54952
54953
 
54953
54954
  return module.default(paths);
@@ -191874,7 +191875,7 @@ const handleRestartTask = (taskId) => {
191874
191875
 
191875
191876
  let ntsuspend;
191876
191877
  function getNtSuspend() {
191877
- ntsuspend ??= node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-ByKMHGR7.cjs', document.baseURI).href)))("ntsuspend");
191878
+ ntsuspend ??= node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-CmRhhp3m.cjs', document.baseURI).href)))("ntsuspend");
191878
191879
  return ntsuspend;
191879
191880
  }
191880
191881
  class DanmuTask extends AbstractTask {
@@ -233369,6 +233370,7 @@ class HttpClient {
233369
233370
  method: mergedOpts.method || "GET",
233370
233371
  headers: {
233371
233372
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
233373
+ ...(mergedOpts.cookie ? { Cookie: mergedOpts.cookie } : {}),
233372
233374
  ...mergedOpts.headers,
233373
233375
  },
233374
233376
  body: mergedOpts.body,
@@ -233394,6 +233396,7 @@ class HttpClient {
233394
233396
  method: "GET",
233395
233397
  headers: {
233396
233398
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
233399
+ ...(mergedOpts.cookie ? { Cookie: mergedOpts.cookie } : {}),
233397
233400
  ...mergedOpts?.headers,
233398
233401
  },
233399
233402
  dispatcher: agent,
@@ -233435,6 +233438,7 @@ class HttpClient {
233435
233438
  headers: {
233436
233439
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
233437
233440
  "Content-Type": contentType,
233441
+ ...(mergedOpts.cookie ? { Cookie: mergedOpts.cookie } : {}),
233438
233442
  ...mergedOpts?.headers,
233439
233443
  },
233440
233444
  body: requestBody,
@@ -233461,6 +233465,7 @@ class HttpClient {
233461
233465
  headers: {
233462
233466
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
233463
233467
  Accept: "*/*",
233468
+ ...(mergedOpts.cookie ? { Cookie: mergedOpts.cookie } : {}),
233464
233469
  ...mergedOpts?.headers,
233465
233470
  },
233466
233471
  dispatcher: agent,
@@ -238592,8 +238597,8 @@ registry.register("xhs", (opts) => new XhsParser(opts));
238592
238597
  registry.register("xiaohongshu", (opts) => new XhsParser(opts));
238593
238598
  registry.register("tiktok", (opts) => new TikTokParser(opts));
238594
238599
 
238595
- async function getInfo$5(channelId) {
238596
- const parser = new DouyuParser();
238600
+ async function getInfo$5(channelId, auth) {
238601
+ const parser = new DouyuParser({ cookie: auth });
238597
238602
  const data = await parser.getRoomInfo(channelId);
238598
238603
  const startTime = data.liveStartTime || new Date();
238599
238604
  const recordStartTime = new Date();
@@ -238615,7 +238620,7 @@ async function getStream$7(opts) {
238615
238620
  if (opts.source === "auto" && opts.avoidEdgeCDN) {
238616
238621
  cdn = "hw-h5";
238617
238622
  }
238618
- const parser = new DouyuParser();
238623
+ const parser = new DouyuParser({ cookie: opts.auth });
238619
238624
  const shouldHevc = opts.codecName === "hevc";
238620
238625
  const isOldApi = opts.api === "old";
238621
238626
  let liveInfo = await parser.getLiveInfo(opts.channelId, {
@@ -238649,20 +238654,18 @@ async function getStream$7(opts) {
238649
238654
  throw new Error("Source list is empty");
238650
238655
  }
238651
238656
  // 是否存在画质下没有source的情况,可能需要切换画质
238652
- if (liveInfo.currentStream.rate !== qn) {
238653
- if (liveInfo.streams.length === 0) {
238654
- throw new Error("Can not get expect quality because of no available stream");
238655
- }
238656
- else {
238657
- liveInfo = await parser.getLiveInfo(opts.channelId, {
238658
- rate: liveInfo.streams[0].rate,
238659
- onlyAudio: opts.onlyAudio,
238660
- hevc: shouldHevc,
238661
- });
238662
- if (!liveInfo.living)
238663
- throw new Error("It must be called getStream when living");
238664
- }
238665
- }
238657
+ // if (liveInfo.currentStream.rate !== qn) {
238658
+ // if (liveInfo.streams.length === 0) {
238659
+ // throw new Error("Can not get expect quality because of no available stream");
238660
+ // } else {
238661
+ // liveInfo = await parser.getLiveInfo(opts.channelId, {
238662
+ // rate: liveInfo.streams[0].rate,
238663
+ // onlyAudio: opts.onlyAudio,
238664
+ // hevc: shouldHevc,
238665
+ // });
238666
+ // if (!liveInfo.living) throw new Error("It must be called getStream when living");
238667
+ // }
238668
+ // }
238666
238669
  return liveInfo;
238667
238670
  }
238668
238671
 
@@ -245069,6 +245072,7 @@ function createRecorder$5(opts) {
245069
245072
  avoidEdgeCDN: true,
245070
245073
  codecName: this.codecName,
245071
245074
  api: this.api,
245075
+ auth: this.auth,
245072
245076
  });
245073
245077
  return res.currentStream;
245074
245078
  },
@@ -245136,6 +245140,7 @@ const checkLiveStatusAndRecord$5 = async function ({ getSavePath, banLiveId, isM
245136
245140
  avoidEdgeCDN: true,
245137
245141
  codecName: this.codecName,
245138
245142
  api: this.api,
245143
+ auth: this.auth,
245139
245144
  });
245140
245145
  }
245141
245146
  catch (err) {
@@ -381261,7 +381266,10 @@ class RecorderConfig {
381261
381266
  return get$1(globalConfig, "douyu.source");
381262
381267
  }
381263
381268
  else if (key === "cookie") {
381264
- if (setting.providerId === "DouYin") {
381269
+ if (setting.providerId === "DouYu") {
381270
+ return get$1(globalConfig, "douyu.cookie");
381271
+ }
381272
+ else if (setting.providerId === "DouYin") {
381265
381273
  return get$1(globalConfig, "douyin.cookie");
381266
381274
  }
381267
381275
  else if (setting.providerId === "XHS") {
@@ -381362,6 +381370,9 @@ class RecorderConfig {
381362
381370
  }
381363
381371
  }
381364
381372
  }
381373
+ else if (setting.providerId === "DouYu") {
381374
+ auth = getValue("cookie");
381375
+ }
381365
381376
  else if (setting.providerId === "DouYin") {
381366
381377
  auth = getValue("cookie");
381367
381378
  uid = setting?.uid;
package/lib/index.cjs CHANGED
@@ -3715,7 +3715,7 @@ const {
3715
3715
  Help,
3716
3716
  } = commander;
3717
3717
 
3718
- var version = "3.22.0";
3718
+ var version = "3.22.1";
3719
3719
 
3720
3720
  process.on("uncaughtException", function (error) {
3721
3721
  console.error(`${new Date().toISOString()} uncaughtException`, error);
@@ -3741,8 +3741,8 @@ program
3741
3741
  throw new Error(`${c.configFolder}参数不存在,请先重新运行 config gen 命令`);
3742
3742
  }
3743
3743
  // 下面两行顺序不能换(
3744
- const { init } = await Promise.resolve().then(function () { return require('./index-ByKMHGR7.cjs'); }).then(function (n) { return n.index; });
3745
- const { serverStart } = await Promise.resolve().then(function () { return require('./index-Db-mrTi0.cjs'); }).then(function (n) { return n.index; });
3744
+ const { init } = await Promise.resolve().then(function () { return require('./index-CmRhhp3m.cjs'); }).then(function (n) { return n.index; });
3745
+ const { serverStart } = await Promise.resolve().then(function () { return require('./index-B-Cevjk4.cjs'); }).then(function (n) { return n.index; });
3746
3746
  const globalConfig = {
3747
3747
  ffmpegPresetPath: path$1.join(c.configFolder, "ffmpeg_presets.json"),
3748
3748
  videoPresetPath: path$1.join(c.configFolder, "presets.json"),
@@ -4,7 +4,7 @@ var os$3 = require('node:os');
4
4
  var path$5 = require('node:path');
5
5
  var fs$3 = require('node:fs');
6
6
  var crypto = require('node:crypto');
7
- var index = require('./index-ByKMHGR7.cjs');
7
+ var index = require('./index-CmRhhp3m.cjs');
8
8
  var require$$0$1 = require('fs');
9
9
  var require$$0 = require('path');
10
10
  var require$$0$2 = require('child_process');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bililive-cli",
3
- "version": "3.22.0",
3
+ "version": "3.22.1",
4
4
  "type": "module",
5
5
  "description": "biliLive-tools的cli程序",
6
6
  "main": "./lib/index.js",
@@ -41,9 +41,9 @@
41
41
  "commander": "^12.1.0",
42
42
  "rimraf": "^6.0.1",
43
43
  "tsx": "^4.19.2",
44
- "@biliLive-tools/shared": "3.22.0",
45
- "@biliLive-tools/types": "3.22.0",
46
- "@biliLive-tools/http": "3.22.0"
44
+ "@biliLive-tools/shared": "3.22.1",
45
+ "@biliLive-tools/http": "3.22.1",
46
+ "@biliLive-tools/types": "3.22.1"
47
47
  },
48
48
  "scripts": {
49
49
  "start": "tsx src/index.ts",