@bililive-tools/douyin-recorder 1.17.4 → 1.18.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/lib/index.js +9 -7
- package/package.json +8 -4
package/lib/index.js
CHANGED
|
@@ -18,6 +18,7 @@ function createRecorder(opts) {
|
|
|
18
18
|
availableSources: [],
|
|
19
19
|
qualityRetry: opts.qualityRetry ?? 0,
|
|
20
20
|
useServerTimestamp: opts.useServerTimestamp ?? true,
|
|
21
|
+
cookieMode: opts.cookieMode ?? "all",
|
|
21
22
|
state: "idle",
|
|
22
23
|
cache: null,
|
|
23
24
|
appendTimeline: null,
|
|
@@ -31,7 +32,7 @@ function createRecorder(opts) {
|
|
|
31
32
|
async getLiveInfo() {
|
|
32
33
|
const channelId = this.channelId;
|
|
33
34
|
const info = await getInfo(channelId, {
|
|
34
|
-
auth: this.auth,
|
|
35
|
+
auth: this.cookieMode === "danma" ? undefined : this.auth,
|
|
35
36
|
uid: this.uid,
|
|
36
37
|
});
|
|
37
38
|
return {
|
|
@@ -46,7 +47,7 @@ function createRecorder(opts) {
|
|
|
46
47
|
streamPriorities: this.streamPriorities,
|
|
47
48
|
sourcePriorities: this.sourcePriorities,
|
|
48
49
|
strictQuality: false,
|
|
49
|
-
auth: this.auth,
|
|
50
|
+
auth: this.cookieMode === "danma" ? undefined : this.auth,
|
|
50
51
|
formatPriorities: this.formatPriorities,
|
|
51
52
|
doubleScreen: this.doubleScreen,
|
|
52
53
|
api: this.api,
|
|
@@ -72,7 +73,7 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, banLiveId, isMan
|
|
|
72
73
|
// 如果已经在录制中,只在需要检查标题关键词时才获取最新信息
|
|
73
74
|
if (this.recordHandle != null) {
|
|
74
75
|
const shouldStop = await utils.checkTitleKeywordsWhileRecording(this, isManualStart, (channelId) => getInfo(channelId, {
|
|
75
|
-
auth: this.auth,
|
|
76
|
+
auth: this.cookieMode === "danma" ? undefined : this.auth,
|
|
76
77
|
api: this.api,
|
|
77
78
|
uid: this.uid,
|
|
78
79
|
}));
|
|
@@ -86,7 +87,7 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, banLiveId, isMan
|
|
|
86
87
|
let isLiveRadio = false;
|
|
87
88
|
try {
|
|
88
89
|
const liveInfo = await getInfo(this.channelId, {
|
|
89
|
-
auth: this.auth,
|
|
90
|
+
auth: this.cookieMode === "danma" ? undefined : this.auth,
|
|
90
91
|
api: this.api,
|
|
91
92
|
uid: this.uid,
|
|
92
93
|
});
|
|
@@ -124,7 +125,7 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, banLiveId, isMan
|
|
|
124
125
|
streamPriorities: this.streamPriorities,
|
|
125
126
|
sourcePriorities: this.sourcePriorities,
|
|
126
127
|
strictQuality: strictQuality,
|
|
127
|
-
auth: this.auth,
|
|
128
|
+
auth: this.cookieMode === "danma" ? undefined : this.auth,
|
|
128
129
|
formatPriorities: this.formatPriorities,
|
|
129
130
|
doubleScreen: this.doubleScreen,
|
|
130
131
|
api: this.api,
|
|
@@ -195,7 +196,7 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, banLiveId, isMan
|
|
|
195
196
|
proxy: this.proxy,
|
|
196
197
|
}, onEnd, async () => {
|
|
197
198
|
const info = await getInfo(this.channelId, {
|
|
198
|
-
auth: this.auth,
|
|
199
|
+
auth: this.cookieMode === "danma" ? undefined : this.auth,
|
|
199
200
|
});
|
|
200
201
|
return info;
|
|
201
202
|
});
|
|
@@ -235,8 +236,9 @@ const checkLiveStatusAndRecord = async function ({ getSavePath, banLiveId, isMan
|
|
|
235
236
|
// 礼物延迟处理时间(毫秒),可根据实际情况调整
|
|
236
237
|
const GIFT_DELAY = 5000;
|
|
237
238
|
const client = new DouYinDanmaClient(this?.liveInfo?.liveId, {
|
|
238
|
-
cookie: this.auth,
|
|
239
|
+
cookie: this.cookieMode === "stream" ? undefined : this.auth,
|
|
239
240
|
});
|
|
241
|
+
console.log("DouYinDanmaClient", this?.liveInfo?.liveId, this.cookieMode, this.auth);
|
|
240
242
|
client.on("chat", (msg) => {
|
|
241
243
|
const extraDataController = downloader.getExtraDataController();
|
|
242
244
|
if (!extraDataController)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bililive-tools/douyin-recorder",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"description": "@bililive-tools douyin recorder implemention",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -30,7 +30,11 @@
|
|
|
30
30
|
"录制",
|
|
31
31
|
"抖音"
|
|
32
32
|
],
|
|
33
|
-
"repository":
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "https://github.com/renmu123/biliLive-tools",
|
|
36
|
+
"directory": "packages/DouYinRecorder"
|
|
37
|
+
},
|
|
34
38
|
"author": "WhiteMind",
|
|
35
39
|
"license": "LGPL",
|
|
36
40
|
"dependencies": {
|
|
@@ -38,8 +42,8 @@
|
|
|
38
42
|
"lodash-es": "^4.17.21",
|
|
39
43
|
"mitt": "^3.0.1",
|
|
40
44
|
"sm-crypto": "^0.3.13",
|
|
41
|
-
"@bililive-tools/manager": "^1.
|
|
42
|
-
"douyin-danma-listener": "0.4.
|
|
45
|
+
"@bililive-tools/manager": "^1.18.0",
|
|
46
|
+
"douyin-danma-listener": "0.4.2"
|
|
43
47
|
},
|
|
44
48
|
"devDependencies": {
|
|
45
49
|
"@types/node": "*"
|