@bililive-tools/douyu-recorder 1.5.0 → 1.5.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 +17 -5
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -400,8 +400,8 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, banLiveId, isMan
|
|
|
400
400
|
if (!this.recordHandle)
|
|
401
401
|
return;
|
|
402
402
|
this.state = "stopping-record";
|
|
403
|
-
client.stop();
|
|
404
403
|
try {
|
|
404
|
+
client.stop();
|
|
405
405
|
await recorder.stop();
|
|
406
406
|
}
|
|
407
407
|
catch (err) {
|
|
@@ -445,14 +445,26 @@ export const provider = {
|
|
|
445
445
|
const res = await requester.get(channelURL);
|
|
446
446
|
const html = res.data;
|
|
447
447
|
const matched = html.match(/\$ROOM\.room_id.?=(.*?);/);
|
|
448
|
-
|
|
448
|
+
let roomId = undefined;
|
|
449
|
+
if (matched) {
|
|
450
|
+
roomId = matched[1].trim();
|
|
451
|
+
}
|
|
452
|
+
else {
|
|
453
|
+
// 解析<link rel="canonical" href="xxxxxxx"/>中的href
|
|
454
|
+
const canonicalLink = html.match(/<link rel="canonical" href="(.*?)"/);
|
|
455
|
+
if (canonicalLink) {
|
|
456
|
+
const url = canonicalLink[1];
|
|
457
|
+
roomId = url.split("/").pop();
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
if (!roomId)
|
|
449
461
|
return null;
|
|
450
|
-
const
|
|
451
|
-
const roomInfo = await getRoomInfo(Number(room_id));
|
|
462
|
+
const roomInfo = await getRoomInfo(Number(roomId));
|
|
452
463
|
return {
|
|
453
|
-
id:
|
|
464
|
+
id: roomId,
|
|
454
465
|
title: roomInfo.room.room_name,
|
|
455
466
|
owner: roomInfo.room.nickname,
|
|
467
|
+
avatar: roomInfo.room.avatar?.big,
|
|
456
468
|
};
|
|
457
469
|
},
|
|
458
470
|
createRecorder(opts) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bililive-tools/douyu-recorder",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "bililive-tools douyu recorder implemention",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"lodash-es": "^4.17.21",
|
|
42
42
|
"axios": "^1.7.8",
|
|
43
43
|
"douyu-api": "^0.1.0",
|
|
44
|
-
"@bililive-tools/manager": "^1.4.
|
|
44
|
+
"@bililive-tools/manager": "^1.4.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/ws": "^8.5.13"
|