yz-yuki-plugin 2.0.5-5 → 2.0.5-7
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.
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**获取dm参数 */
|
|
2
|
+
async function getDmImg() {
|
|
3
|
+
const dm_img_list = [];
|
|
4
|
+
//Buffer.from("WebGL 1", 'utf-8').toString("base64") //webgl version的值 WebGL 1 的base64 编码
|
|
5
|
+
const dm_img_str = 'V2ViR0wgMS';
|
|
6
|
+
//webgl unmasked renderer的值拼接webgl unmasked vendor的值的base64编码
|
|
7
|
+
const dm_cover_img_str = 'QU5HTEUgKEludGVsLCBJbnRlbChSKSBIRCBHcmFwaGljcyBEaXJlY3QzRDExIHZzXzVfMCBwc181XzApLCBvciBzaW1pbGFyR29vZ2xlIEluYy4gKEludGVsKQ';
|
|
8
|
+
return {
|
|
9
|
+
dm_img_list: dm_img_list,
|
|
10
|
+
dm_img_str: dm_img_str,
|
|
11
|
+
dm_cover_img_str: dm_cover_img_str
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { getDmImg };
|
|
@@ -3,6 +3,7 @@ import lodash from 'lodash';
|
|
|
3
3
|
import { BiliApi } from './bilibili.api.js';
|
|
4
4
|
import { readSyncCookie, cookieWithBiliTicket, readSavedCookieItems, readSavedCookieOtherItems } from './bilibili.models.js';
|
|
5
5
|
import { getWbiSign } from './bilibili.wbi.js';
|
|
6
|
+
import { getDmImg } from './bilibili.dm.img.js';
|
|
6
7
|
|
|
7
8
|
class BiliGetWebData {
|
|
8
9
|
constructor(e) { }
|
|
@@ -11,6 +12,7 @@ class BiliGetWebData {
|
|
|
11
12
|
const url = BiliApi.BILIBIL_API.biliDynamicInfoList;
|
|
12
13
|
let { cookie } = await readSyncCookie();
|
|
13
14
|
cookie = await cookieWithBiliTicket(cookie);
|
|
15
|
+
const dmImg = await getDmImg();
|
|
14
16
|
const data = {
|
|
15
17
|
'offset': '',
|
|
16
18
|
'host_mid': uid,
|
|
@@ -18,7 +20,7 @@ class BiliGetWebData {
|
|
|
18
20
|
'platform': 'web',
|
|
19
21
|
'features': 'itemOpusStyle,listOnlyfans,opusBigCover,onlyfansVote',
|
|
20
22
|
'web_location': '333.999',
|
|
21
|
-
|
|
23
|
+
...dmImg,
|
|
22
24
|
'x-bili-device-req-json': { platform: 'web', device: 'pc' },
|
|
23
25
|
'x-bili-web-req-json': { spm_id: '333.999' }
|
|
24
26
|
};
|
|
@@ -17,13 +17,10 @@ class BiliTask {
|
|
|
17
17
|
this.privateKey = 'Yz:yuki:bili:upPush:private:';
|
|
18
18
|
}
|
|
19
19
|
async hendleEventDynamicData(uid, count = 0) {
|
|
20
|
+
let { cookie } = await readSyncCookie();
|
|
20
21
|
const resp = await new BiliGetWebData().getBiliDynamicListDataByUid(uid);
|
|
21
22
|
const resjson = await resp.data;
|
|
22
|
-
|
|
23
|
-
if (resjson.code === 0) {
|
|
24
|
-
return resjson;
|
|
25
|
-
}
|
|
26
|
-
else if (resjson.code === -352) {
|
|
23
|
+
if (!resjson || resjson.code !== 0 || resjson.code === -352) {
|
|
27
24
|
await postGateway(cookie);
|
|
28
25
|
if (count < 3) {
|
|
29
26
|
await this.randomDelay(2000, 8000); // 随机延时2-8秒
|
|
@@ -32,12 +29,9 @@ class BiliTask {
|
|
|
32
29
|
}
|
|
33
30
|
else {
|
|
34
31
|
count = 0;
|
|
35
|
-
return resjson;
|
|
36
32
|
}
|
|
37
33
|
}
|
|
38
|
-
|
|
39
|
-
return resjson;
|
|
40
|
-
}
|
|
34
|
+
return resjson;
|
|
41
35
|
}
|
|
42
36
|
async runTask() {
|
|
43
37
|
let biliConfigData = await Config.getUserConfig('bilibili', 'config');
|
|
@@ -89,12 +83,12 @@ class BiliTask {
|
|
|
89
83
|
}
|
|
90
84
|
else if (resp.code !== 0) {
|
|
91
85
|
logger.error(`获取 ${subInfoOfup.uid} 动态失败,resCode:${resp.code}`);
|
|
92
|
-
|
|
86
|
+
continue;
|
|
93
87
|
}
|
|
94
88
|
}
|
|
95
89
|
else {
|
|
96
|
-
logger.error(`获取 ${subInfoOfup.uid}
|
|
97
|
-
|
|
90
|
+
logger.error(`获取 ${subInfoOfup.uid} 动态失败,无响应数据,请待下次任务自动重试`);
|
|
91
|
+
continue;
|
|
98
92
|
}
|
|
99
93
|
}
|
|
100
94
|
const chatIds = Array.from(new Set([...Object((chatTypeMap.get(subInfoOfup.uid) && chatTypeMap.get(subInfoOfup.uid).chatIds) || []), chatId]));
|