@bililive-tools/douyu-recorder 1.7.0 → 1.7.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.
Files changed (2) hide show
  1. package/lib/index.js +13 -5
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -109,6 +109,7 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, banLiveId, isMan
109
109
  try {
110
110
  const liveInfo = await getInfo(this.channelId);
111
111
  this.liveInfo = liveInfo;
112
+ this.state = "idle";
112
113
  }
113
114
  catch (error) {
114
115
  this.state = "check-error";
@@ -458,11 +459,18 @@ export const provider = {
458
459
  roomId = matched[1].trim();
459
460
  }
460
461
  else {
461
- // 解析<link rel="canonical" href="xxxxxxx"/>中的href
462
- const canonicalLink = html.match(/<link rel="canonical" href="(.*?)"/);
463
- if (canonicalLink) {
464
- const url = canonicalLink[1];
465
- roomId = url.split("/").pop();
462
+ // 解析出query中的rid参数
463
+ const rid = new URL(channelURL).searchParams.get("rid");
464
+ if (rid) {
465
+ roomId = rid;
466
+ }
467
+ else {
468
+ // 解析<link rel="canonical" href="xxxxxxx"/>中的href
469
+ const canonicalLink = html.match(/<link rel="canonical" href="(.*?)"/);
470
+ if (canonicalLink) {
471
+ const url = canonicalLink[1];
472
+ roomId = url.split("/").pop();
473
+ }
466
474
  }
467
475
  }
468
476
  if (!roomId)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bililive-tools/douyu-recorder",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "bililive-tools douyu recorder implemention",
5
5
  "main": "./lib/index.js",
6
6
  "type": "module",