yz-yuki-plugin 2.0.7-2 → 2.0.7-20
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/CHANGELOG.md +6 -0
- package/README.md +23 -22
- package/defaultConfig/bilibili/config.yaml +4 -1
- package/defaultConfig/weibo/config.yaml +4 -1
- package/lib/apps/bilibili.js +64 -31
- package/lib/apps/weibo.js +42 -14
- package/lib/components/dynamic/Content.js +2 -2
- package/lib/components/dynamic/Footer.js +2 -2
- package/lib/components/help/Help.js +2 -2
- package/lib/components/version/Version.js +2 -2
- package/lib/models/bilibili/bilibili.main.get.web.data.js +1 -5
- package/lib/models/bilibili/bilibili.main.query.js +144 -88
- package/lib/models/bilibili/bilibili.main.task.js +167 -83
- package/lib/models/bilibili/bilibili.risk.dm.img.js +4 -4
- package/lib/models/weibo/weibo.main.query.js +80 -33
- package/lib/models/weibo/weibo.main.task.js +149 -66
- package/package.json +6 -6
- package/resources/css/dynamic/Content.css +93 -0
- package/resources/css/dynamic/MainPage.css +3 -1
- package/resources/img/icon/dynamic/bili-dyn-card-vote__cover.svg +1 -0
- package/lib/models/bilibili/bilibili.risk.w_webid.js +0 -46
|
@@ -40,6 +40,7 @@ class WeiboTask {
|
|
|
40
40
|
*/
|
|
41
41
|
async processWeiboData(weiboPushData, uidMap, dynamicList) {
|
|
42
42
|
const requestedDataOfUids = new Map(); // 存放已请求的 uid 映射
|
|
43
|
+
const printedList = new Set(); // 已打印的动态列表
|
|
43
44
|
for (let chatType in weiboPushData) {
|
|
44
45
|
// 遍历 group 和 private
|
|
45
46
|
if (!uidMap.has(chatType)) {
|
|
@@ -51,30 +52,36 @@ class WeiboTask {
|
|
|
51
52
|
for (let chatId in weiboPushData[chatType]) {
|
|
52
53
|
const subUpsOfChat = Array.prototype.slice.call(weiboPushData[chatType][chatId] || []);
|
|
53
54
|
for (let subInfoOfup of subUpsOfChat) {
|
|
55
|
+
const { uid, bot_id, name, type } = subInfoOfup;
|
|
54
56
|
let resp;
|
|
55
57
|
// 检查是否已经请求过该 uid
|
|
56
|
-
if (requestedDataOfUids.has(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
resp = await new WeiboWebDataFetcher().getBloggerDynamicList(subInfoOfup.uid); // 获取指定 uid 的动态列表
|
|
58
|
+
if (!requestedDataOfUids.has(uid)) {
|
|
59
|
+
if (!printedList.has(uid)) {
|
|
60
|
+
logger.info(`正在检测微博动态 [ ${name} : ${uid} ]`);
|
|
61
|
+
printedList.add(uid);
|
|
62
|
+
}
|
|
63
|
+
resp = await new WeiboWebDataFetcher().getBloggerDynamicList(uid); // 获取指定 uid 的动态列表
|
|
63
64
|
if (resp) {
|
|
64
|
-
requestedDataOfUids.set(
|
|
65
|
+
requestedDataOfUids.set(uid, resp); // 将响应数据存储到映射中
|
|
65
66
|
const dynamicData = resp || [];
|
|
66
|
-
dynamicList[
|
|
67
|
+
dynamicList[uid] = dynamicData;
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
chatTypeMap.
|
|
70
|
+
if (!chatTypeMap.has(uid)) {
|
|
71
|
+
chatTypeMap.set(uid, new Map());
|
|
72
|
+
}
|
|
73
|
+
const botChatMap = chatTypeMap.get(uid);
|
|
74
|
+
if (!botChatMap?.has(bot_id)) {
|
|
75
|
+
botChatMap?.set(bot_id, new Map());
|
|
76
|
+
}
|
|
77
|
+
const chatMap = botChatMap?.get(bot_id);
|
|
78
|
+
chatMap?.set(chatId, { upName: name, types: type });
|
|
73
79
|
await this.randomDelay(1000, 4000); // 随机延时1-4秒
|
|
74
80
|
}
|
|
75
81
|
}
|
|
76
82
|
}
|
|
77
83
|
requestedDataOfUids.clear(); // 清空已请求的映射
|
|
84
|
+
printedList.clear(); // 清空已打印的动态列表
|
|
78
85
|
}
|
|
79
86
|
/**
|
|
80
87
|
* 构建uid对应动态数据映射
|
|
@@ -86,36 +93,31 @@ class WeiboTask {
|
|
|
86
93
|
*/
|
|
87
94
|
async makeUidDynamicDataMap(uidMap, dynamicList, now, dynamicTimeRange, weiboConfigData, messageMap) {
|
|
88
95
|
for (let [chatType, chatTypeMap] of uidMap) {
|
|
89
|
-
for (let [
|
|
90
|
-
const tempDynamicList = dynamicList[
|
|
96
|
+
for (let [upUid, bot_idMap] of chatTypeMap) {
|
|
97
|
+
const tempDynamicList = dynamicList[upUid] || [];
|
|
91
98
|
const willPushDynamicList = [];
|
|
92
|
-
const printedList = new Set(); // 已打印的动态列表
|
|
93
99
|
for (let dynamicItem of tempDynamicList) {
|
|
94
100
|
let raw_post = dynamicItem || {};
|
|
95
101
|
let user = raw_post?.mblog?.user || {};
|
|
96
|
-
if (!printedList.has(user?.id)) {
|
|
97
|
-
logger.info(`正在检测微博动态 [ ${user?.screen_name} : ${user?.id} ]`);
|
|
98
|
-
printedList.add(user?.id);
|
|
99
|
-
}
|
|
100
102
|
if (!raw_post?.mblog?.created_at)
|
|
101
103
|
continue;
|
|
102
104
|
if (Number(now - WeiboQuery.getDynamicCreatetDate(raw_post) / 1000) > dynamicTimeRange) {
|
|
103
105
|
logger.debug(`超过间隔,跳过 [ ${user?.screen_name} : ${user?.id} ] ${raw_post?.mblog?.created_at} 的动态`);
|
|
104
106
|
continue;
|
|
105
107
|
} // 如果超过推送时间间隔,跳过当前循环
|
|
106
|
-
if (dynamicItem
|
|
107
|
-
continue;
|
|
108
|
+
if (dynamicItem?.type === 'DYNAMIC_TYPE_FORWARD' && !weiboConfigData.pushTransmit) {
|
|
109
|
+
continue;
|
|
110
|
+
} // 如果关闭了转发动态的推送,跳过当前循环
|
|
108
111
|
willPushDynamicList.push(dynamicItem);
|
|
109
112
|
}
|
|
110
|
-
printedList.clear();
|
|
111
|
-
const pushMapInfo = value || {}; // 获取当前 uid 对应的推送信息
|
|
112
|
-
const { chatIds, bot_id, upName, type } = pushMapInfo;
|
|
113
113
|
// 遍历待推送的动态数组,发送动态消息
|
|
114
|
-
for (let
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
114
|
+
for (let [bot_id, chatIdMap] of bot_idMap) {
|
|
115
|
+
for (let [chatId, subUpInfo] of chatIdMap) {
|
|
116
|
+
const { upName, types } = subUpInfo;
|
|
117
|
+
for (let pushDynamicData of willPushDynamicList) {
|
|
118
|
+
if (types && types.length > 0 && !types.includes(pushDynamicData.type)) {
|
|
119
|
+
continue;
|
|
120
|
+
} // 如果禁用了某类型的动态推送,跳过当前循环
|
|
119
121
|
await this.makeDynamicMessageMap(chatId, bot_id, upName, pushDynamicData, weiboConfigData, chatType, messageMap); // 发送动态消息
|
|
120
122
|
await this.randomDelay(1000, 2000); // 随机延时1-2秒
|
|
121
123
|
}
|
|
@@ -342,41 +344,101 @@ class WeiboTask {
|
|
|
342
344
|
* @param biliConfigData 微博配置数据
|
|
343
345
|
*/
|
|
344
346
|
async sendDynamicMessage(messageMap, weiboConfigData) {
|
|
347
|
+
let forwardSendDynamic = weiboConfigData.forwardSendDynamic === 0 || weiboConfigData.forwardSendDynamic === false ? false : true; // 转发动态是否合并发送,默认 true
|
|
345
348
|
const LogMark = new Set(); // 日志mark
|
|
346
349
|
for (const [chatType, botMap] of messageMap) {
|
|
347
350
|
for (const [bot_id, chatMap] of botMap) {
|
|
348
351
|
for (const [chatId, messageCombinationList] of chatMap) {
|
|
349
|
-
//
|
|
352
|
+
// 区分群聊和私聊
|
|
353
|
+
let markKey = chatType === 'group' ? this.groupKey : this.privateKey;
|
|
354
|
+
if (!LogMark.has('1')) {
|
|
355
|
+
global?.logger?.mark('优纪插件: 微博动态执行推送');
|
|
356
|
+
LogMark.add('1');
|
|
357
|
+
}
|
|
358
|
+
// 统计图片数量和文字长度
|
|
359
|
+
let imageCount = 0;
|
|
360
|
+
let textLength = 0;
|
|
350
361
|
for (const messageCombination of messageCombinationList) {
|
|
351
|
-
const {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
362
|
+
const { messages } = messageCombination;
|
|
363
|
+
for (const msg of messages) {
|
|
364
|
+
if (typeof msg === 'object' && msg.type === 'image') {
|
|
365
|
+
imageCount++;
|
|
366
|
+
}
|
|
367
|
+
else if (typeof msg === 'string') {
|
|
368
|
+
textLength += msg.length;
|
|
369
|
+
}
|
|
357
370
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
371
|
+
}
|
|
372
|
+
// 满足条件才使用合并转发
|
|
373
|
+
const useForward = imageCount > 2 || textLength > 300;
|
|
374
|
+
if (forwardSendDynamic && useForward) {
|
|
375
|
+
const forwardNodes = [];
|
|
376
|
+
// 合并所有消息
|
|
377
|
+
const forwardSendMardKeyList = [];
|
|
378
|
+
forwardNodes.push({
|
|
379
|
+
name: '优纪酱通知',
|
|
380
|
+
uin: String(80000000),
|
|
381
|
+
message: ['有新的微博动态了~'],
|
|
382
|
+
time: Date.now()
|
|
383
|
+
});
|
|
384
|
+
for (const messageCombination of messageCombinationList) {
|
|
385
|
+
const { sendMode, dynamicUUid_str, dynamicType, messages } = messageCombination;
|
|
386
|
+
const sendMarkKey = `${markKey}${chatId}:${dynamicUUid_str}`;
|
|
387
|
+
// 原子性设置标记,防止并发重复
|
|
388
|
+
const setResult = await Redis.set(sendMarkKey, '1', { NX: true, EX: 3600 * 72 });
|
|
389
|
+
if (!setResult) {
|
|
390
|
+
continue; // 已有标记,跳过
|
|
391
|
+
}
|
|
392
|
+
forwardSendMardKeyList.push(sendMarkKey); // 收集合并转发的标记键
|
|
393
|
+
// 每条动态一个 node
|
|
394
|
+
forwardNodes.push({
|
|
395
|
+
name: '匿名消息',
|
|
396
|
+
uin: String(80000000),
|
|
397
|
+
message: messages,
|
|
398
|
+
time: Date.now()
|
|
399
|
+
});
|
|
361
400
|
}
|
|
362
|
-
|
|
363
|
-
if (
|
|
364
|
-
|
|
401
|
+
// 尝试合并转发动态
|
|
402
|
+
if ((await this.sendMsgApi(chatId, bot_id, chatType, '优纪酱微博动态通知~')) &&
|
|
403
|
+
(await this.sendForwardMsgApi(chatId, bot_id, chatType, forwardNodes))) {
|
|
404
|
+
await this.randomDelay(1000, 2000);
|
|
405
|
+
continue; // 合并转发成功,跳过后续单条发送逻辑
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
for (const sendMarkKey of forwardSendMardKeyList) {
|
|
409
|
+
await Redis.del(sendMarkKey); // 发送消息失败,删除合并转发成功标记
|
|
410
|
+
}
|
|
365
411
|
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
412
|
+
}
|
|
413
|
+
// 合并转发失败,回退为原有方式
|
|
414
|
+
for (const messageCombination of messageCombinationList) {
|
|
415
|
+
const { sendMode, dynamicUUid_str, dynamicType, messages } = messageCombination;
|
|
416
|
+
const sendMarkKey = `${markKey}${chatId}:${dynamicUUid_str}`;
|
|
417
|
+
// 原子性设置标记,防止并发重复
|
|
418
|
+
const setResult = await Redis.set(sendMarkKey, '1', { NX: true, EX: 3600 * 72 });
|
|
419
|
+
if (!setResult) {
|
|
420
|
+
continue; // 已有标记,跳过
|
|
369
421
|
}
|
|
422
|
+
let sendSuccess = true;
|
|
370
423
|
if (sendMode === 'SINGLE') {
|
|
371
424
|
for (let i = 0; i < messages.length; i++) {
|
|
372
|
-
await this.
|
|
425
|
+
if (!(await this.sendMsgApi(chatId, bot_id, chatType, messages[i]))) {
|
|
426
|
+
sendSuccess = false;
|
|
427
|
+
break;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
if (!sendSuccess) {
|
|
431
|
+
await Redis.del(sendMarkKey); // 失败删除标记
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
await this.randomDelay(1000, 2000);
|
|
373
435
|
}
|
|
374
|
-
await Redis.set(sendMarkKey, '1', { EX: 3600 * 72 }); // 发送成功后设置标记
|
|
375
|
-
await this.randomDelay(1000, 2000); // 随机延时1-2秒
|
|
376
436
|
}
|
|
377
437
|
else if (sendMode === 'MERGE') {
|
|
378
|
-
await this.
|
|
379
|
-
|
|
438
|
+
if (!(await this.sendMsgApi(chatId, bot_id, chatType, messages))) {
|
|
439
|
+
await Redis.del(sendMarkKey); // 失败删除标记
|
|
440
|
+
}
|
|
441
|
+
await this.randomDelay(1000, 2000);
|
|
380
442
|
}
|
|
381
443
|
}
|
|
382
444
|
}
|
|
@@ -391,22 +453,43 @@ class WeiboTask {
|
|
|
391
453
|
* @param chatType 聊天类型
|
|
392
454
|
* @param message 消息内容
|
|
393
455
|
*/
|
|
394
|
-
async
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
?.pickGroup(String(chatId))
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
}
|
|
456
|
+
async sendMsgApi(chatId, bot_id, chatType, message) {
|
|
457
|
+
try {
|
|
458
|
+
if (chatType === 'group') {
|
|
459
|
+
await (Bot[bot_id] ?? Bot)?.pickGroup(String(chatId)).sendMsg(message); // 发送群聊
|
|
460
|
+
}
|
|
461
|
+
else if (chatType === 'private') {
|
|
462
|
+
await (Bot[bot_id] ?? Bot)?.pickFriend(String(chatId)).sendMsg(message); // 发送好友私聊
|
|
463
|
+
}
|
|
464
|
+
return true; // 发送成功
|
|
402
465
|
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
466
|
+
catch (error) {
|
|
467
|
+
global?.logger?.error(`${chatType === 'group' ? '群聊' : '私聊'} ${chatId} 消息发送失败:${JSON.stringify(error)}`);
|
|
468
|
+
return false; // 发送失败
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* 发送合并转发消息
|
|
473
|
+
* @param chatId 聊天 ID
|
|
474
|
+
* @param bot_id 机器人 ID
|
|
475
|
+
* @param chatType 聊天类型
|
|
476
|
+
* @param message 消息内容
|
|
477
|
+
* @returns 是否发送成功
|
|
478
|
+
*/
|
|
479
|
+
async sendForwardMsgApi(chatId, bot_id, chatType, forwardNodes) {
|
|
480
|
+
const forwardMsg = await Bot.makeForwardMsg(forwardNodes);
|
|
481
|
+
try {
|
|
482
|
+
if (chatType === 'group') {
|
|
483
|
+
await (Bot[bot_id] ?? Bot)?.pickGroup(String(chatId)).sendMsg(forwardMsg); // 发送群聊合并转发
|
|
484
|
+
}
|
|
485
|
+
else if (chatType === 'private') {
|
|
486
|
+
await (Bot[bot_id] ?? Bot)?.pickFriend(String(chatId)).sendMsg(forwardMsg); // 发送好友私聊合并转发
|
|
487
|
+
}
|
|
488
|
+
return true; // 发送成功
|
|
489
|
+
}
|
|
490
|
+
catch (error) {
|
|
491
|
+
global?.logger?.error(`${chatType === 'group' ? '群聊' : '私聊'} ${chatId} 合并转发消息发送失败:${JSON.stringify(error)}`);
|
|
492
|
+
return false; // 发送失败
|
|
410
493
|
}
|
|
411
494
|
}
|
|
412
495
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yz-yuki-plugin",
|
|
3
|
-
"version": "2.0.7-
|
|
3
|
+
"version": "2.0.7-20",
|
|
4
4
|
"description": "优纪插件,yunzaijs 关于 微博推送、B站推送 等功能的拓展插件",
|
|
5
5
|
"author": "snowtafir",
|
|
6
6
|
"type": "module",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"debug": "^4.3.6",
|
|
32
32
|
"jsdom": "^25.0.1",
|
|
33
33
|
"json5": "^2.2.3",
|
|
34
|
-
"jsxp": "^1.1
|
|
34
|
+
"jsxp": "^1.2.1",
|
|
35
35
|
"lodash": "^4.17.21",
|
|
36
36
|
"md5": "^2.3.0",
|
|
37
37
|
"moment": "^2.30.1",
|
|
38
38
|
"node-fetch": "^3.3.2",
|
|
39
|
-
"puppeteer": "^24.
|
|
39
|
+
"puppeteer": "^24.8.2",
|
|
40
40
|
"qrcode": "^1.5.4",
|
|
41
41
|
"react": "^18.3.1",
|
|
42
42
|
"react-dom": "^18.3.1",
|
|
@@ -63,14 +63,14 @@
|
|
|
63
63
|
"icqq": "^0.6.10",
|
|
64
64
|
"jsdom": "^24.1.1",
|
|
65
65
|
"json5": "^2.2.3",
|
|
66
|
-
"jsxp": "^1.1
|
|
66
|
+
"jsxp": "^1.2.1",
|
|
67
67
|
"lodash": "^4.17.21",
|
|
68
|
-
"lvyjs": "^0.2.
|
|
68
|
+
"lvyjs": "^0.2.19",
|
|
69
69
|
"md5": "^2.3.0",
|
|
70
70
|
"node-fetch": "^3.3.2",
|
|
71
71
|
"postcss": "^8.4.47",
|
|
72
72
|
"prettier": "^3.4.2",
|
|
73
|
-
"puppeteer": "^24.
|
|
73
|
+
"puppeteer": "^24.8.2",
|
|
74
74
|
"qrcode": "^1.5.4",
|
|
75
75
|
"react": "^18.3.1",
|
|
76
76
|
"react-dom": "^18.3.1",
|
|
@@ -78,3 +78,96 @@
|
|
|
78
78
|
background-image: url('./../../img/icon/dynamic/bili-rich-text-module-goods-taobao.svg');
|
|
79
79
|
/* 引入SVG图标 */
|
|
80
80
|
}
|
|
81
|
+
|
|
82
|
+
/* 定义B站投票标签样式 */
|
|
83
|
+
.bili-dyn-content__orig__additional {
|
|
84
|
+
margin-top: 12px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.bili-dyn-card-vote {
|
|
88
|
+
background-color: rgba(246, 247, 248, 0.8);
|
|
89
|
+
border-radius: 6px;
|
|
90
|
+
box-sizing: border-box;
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
display: flex;
|
|
93
|
+
height: 78px;
|
|
94
|
+
height: 100%;
|
|
95
|
+
overflow: hidden;
|
|
96
|
+
border: 1px solid #ff69b4;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.bili-dyn-card-vote__header {
|
|
100
|
+
flex-shrink: 0;
|
|
101
|
+
padding: 25px;
|
|
102
|
+
width: 78px;
|
|
103
|
+
background-color: rgb(255, 255, 255);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.bili-dyn-card-vote__cover {
|
|
107
|
+
align-items: center;
|
|
108
|
+
background-color: #ffffff;
|
|
109
|
+
border-radius: 4px;
|
|
110
|
+
color: #008ac5;
|
|
111
|
+
display: flex;
|
|
112
|
+
height: 100%;
|
|
113
|
+
justify-content: center;
|
|
114
|
+
width: 100%;
|
|
115
|
+
/* 引入SVG图标 */
|
|
116
|
+
background-image: url('./../../img/icon/dynamic/bili-dyn-card-vote__cover.svg');
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.bili-dyn-card-vote__body,
|
|
120
|
+
.bili-dyn-card-vote__detail {
|
|
121
|
+
display: flex;
|
|
122
|
+
flex: 1;
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.bili-dyn-card-vote__detail {
|
|
127
|
+
box-sizing: border-box;
|
|
128
|
+
flex-direction: column;
|
|
129
|
+
padding: 19px 16px 15px 20px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.bili-dyn-card-vote__detail__title {
|
|
133
|
+
color: #18191c;
|
|
134
|
+
font-size: 14px;
|
|
135
|
+
line-height: 20px;
|
|
136
|
+
overflow: hidden;
|
|
137
|
+
text-overflow: ellipsis;
|
|
138
|
+
transition: all 0.2s;
|
|
139
|
+
white-space: nowrap;
|
|
140
|
+
width: 100%;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.bili-dyn-card-vote__detail__desc {
|
|
144
|
+
color: #9499a0;
|
|
145
|
+
font-size: 12px;
|
|
146
|
+
line-height: 17px;
|
|
147
|
+
margin-top: 4px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.bili-dyn-card-vote__action {
|
|
151
|
+
align-items: center;
|
|
152
|
+
display: flex;
|
|
153
|
+
flex-shrink: 0;
|
|
154
|
+
justify-content: center;
|
|
155
|
+
margin-right: 16px;
|
|
156
|
+
padding-right: 15px;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.bili-dyn-card-vote__action__btn_normal {
|
|
160
|
+
background-color: #ff69b4;
|
|
161
|
+
color: #ffffff;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.bili-dyn-card-vote__action button {
|
|
165
|
+
border: none;
|
|
166
|
+
border-radius: 6px;
|
|
167
|
+
box-sizing: border-box;
|
|
168
|
+
cursor: pointer;
|
|
169
|
+
font-size: 12.8px;
|
|
170
|
+
height: 30px;
|
|
171
|
+
min-width: 72px;
|
|
172
|
+
outline: none;
|
|
173
|
+
}
|
|
@@ -25,8 +25,10 @@ body::-webkit-scrollbar {
|
|
|
25
25
|
font-style: normal;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
@import url('https://s1.hdslb.com/bfs/static/jinkela/long/font/regular.css');
|
|
29
|
+
|
|
28
30
|
body {
|
|
29
|
-
font-family: 'OPSans', Arial, sans-serif;
|
|
31
|
+
font-family: 'OPSans', 'HarmonyOS_Regular', 'PingFang SC', 'Microsoft YaHei', Arial, sans-serif;
|
|
30
32
|
background-color: #f9f9f9;
|
|
31
33
|
margin: 0;
|
|
32
34
|
padding: 0;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg style="width: 28px; height: 28px;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 28 28" width="28" height="28"><path d="M2.4583333333333335 16.626283333333333C2.4583333333333335 15.084516666666667 3.7082066666666664 13.834616666666667 5.25 13.834616666666667L6.416666666666667 13.834616666666667C7.95846 13.834616666666667 9.208333333333334 15.084516666666667 9.208333333333334 16.626283333333333L9.208333333333334 20.70961666666667C9.208333333333334 22.251383333333333 7.95846 23.501283333333337 6.416666666666667 23.501283333333337L5.25 23.501283333333337C3.7082066666666664 23.501283333333337 2.4583333333333335 22.251383333333333 2.4583333333333335 20.70961666666667L2.4583333333333335 16.626283333333333zM5.25 15.334616666666665C4.5366333333333335 15.334616666666665 3.9583333333333335 15.912883333333335 3.9583333333333335 16.626283333333333L3.9583333333333335 20.70961666666667C3.9583333333333335 21.42301666666667 4.5366333333333335 22.001283333333337 5.25 22.001283333333337L6.416666666666667 22.001283333333337C7.130040000000001 22.001283333333337 7.708333333333335 21.42301666666667 7.708333333333335 20.70961666666667L7.708333333333335 16.626283333333333C7.708333333333335 15.912883333333335 7.130040000000001 15.334616666666665 6.416666666666667 15.334616666666665L5.25 15.334616666666665z" fill="currentColor" style="--darkreader-inline-fill: currentColor;" data-darkreader-inline-fill=""></path><path d="M10.625000000000002 6.709476666666667C10.625000000000002 5.167683333333334 11.874906666666668 3.9178100000000007 13.416666666666668 3.9178100000000007L14.583333333333334 3.9178100000000007C16.1251 3.9178100000000007 17.375 5.167683333333334 17.375 6.709476666666667L17.375 20.709500000000002C17.375 22.251266666666666 16.1251 23.50116666666667 14.583333333333334 23.50116666666667L13.416666666666668 23.50116666666667C11.874906666666668 23.50116666666667 10.625000000000002 22.251266666666666 10.625000000000002 20.709500000000002L10.625000000000002 6.709476666666667zM13.416666666666668 5.41781C12.703266666666666 5.41781 12.125 5.996103333333333 12.125 6.709476666666667L12.125 20.709500000000002C12.125 21.422816666666666 12.703266666666666 22.00116666666667 13.416666666666668 22.00116666666667L14.583333333333334 22.00116666666667C15.296733333333336 22.00116666666667 15.875000000000002 21.422816666666666 15.875000000000002 20.709500000000002L15.875000000000002 6.709476666666667C15.875000000000002 5.996103333333333 15.296733333333336 5.41781 14.583333333333334 5.41781L13.416666666666668 5.41781z" fill="currentColor" style="--darkreader-inline-fill: currentColor;" data-darkreader-inline-fill=""></path><path d="M18.791666666666668 12.8345C18.791666666666668 11.292683333333335 20.041566666666668 10.042810000000001 21.583333333333336 10.042810000000001L22.75 10.042810000000001C24.291766666666668 10.042810000000001 25.541666666666668 11.292683333333335 25.541666666666668 12.8345L25.541666666666668 20.709500000000002C25.541666666666668 22.251266666666666 24.291766666666668 23.50116666666667 22.75 23.50116666666667L21.583333333333336 23.50116666666667C20.041566666666668 23.50116666666667 18.791666666666668 22.251266666666666 18.791666666666668 20.709500000000002L18.791666666666668 12.8345zM21.583333333333336 11.542816666666667C20.869933333333336 11.542816666666667 20.291666666666668 12.121100000000002 20.291666666666668 12.8345L20.291666666666668 20.709500000000002C20.291666666666668 21.422816666666666 20.869933333333336 22.00116666666667 21.583333333333336 22.00116666666667L22.75 22.00116666666667C23.4634 22.00116666666667 24.041666666666668 21.422816666666666 24.041666666666668 20.709500000000002L24.041666666666668 12.8345C24.041666666666668 12.121100000000002 23.4634 11.542816666666667 22.75 11.542816666666667L21.583333333333336 11.542816666666667z" fill="currentColor" style="--darkreader-inline-fill: currentColor;" data-darkreader-inline-fill=""></path></svg>
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import lodash from 'lodash';
|
|
3
|
-
import { Redis } from 'yunzaijs';
|
|
4
|
-
import BiliApi from './bilibili.main.api.js';
|
|
5
|
-
import { readSyncCookie, cookieWithBiliTicket } from './bilibili.main.models.js';
|
|
6
|
-
|
|
7
|
-
async function getWebId(uid) {
|
|
8
|
-
const w_webid_key = 'Yz:yuki:bili:w_webid';
|
|
9
|
-
const w_webid = await Redis.get(w_webid_key);
|
|
10
|
-
const keyTTL = await Redis.ttl(w_webid_key);
|
|
11
|
-
if (w_webid && keyTTL < 259200) {
|
|
12
|
-
return String(w_webid);
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
const url = `https://space.bilibili.com/${uid ? uid : 401742377}/dynamic`;
|
|
16
|
-
let { cookie } = await readSyncCookie();
|
|
17
|
-
cookie = await cookieWithBiliTicket(cookie);
|
|
18
|
-
const res = await axios.get(url, {
|
|
19
|
-
timeout: 8000,
|
|
20
|
-
headers: lodash.merge(BiliApi.BILIBILI_DYNAMIC_SPACE_HEADERS, {
|
|
21
|
-
Cookie: `${cookie}`,
|
|
22
|
-
Host: `space.bilibili.com`
|
|
23
|
-
})
|
|
24
|
-
});
|
|
25
|
-
const htmlContent = await res.data;
|
|
26
|
-
const htmlContentRegex = /="__RENDER_DATA__"\s*type="application\/json">(.*?)<\/script>/;
|
|
27
|
-
const __RENDER_DATA__ = htmlContent.match(htmlContentRegex);
|
|
28
|
-
if (__RENDER_DATA__ && __RENDER_DATA__[1]) {
|
|
29
|
-
const decoded__RENDER_DATA__JsonString = decodeURIComponent(__RENDER_DATA__[1]);
|
|
30
|
-
const accessIdRegex = /"access_id":"(.*?)"/;
|
|
31
|
-
const access_id = decoded__RENDER_DATA__JsonString.match(accessIdRegex);
|
|
32
|
-
const ExpirationTimeRegex = /document.getElementById\("__RENDER_DATA__"\).*?setTimeout\(function\(\)\s*{window.location.reload\(true\);},\s*(\d+)\s*\*\s*(\d+)\);<\/script>/;
|
|
33
|
-
const ExpirationTime = htmlContent.match(ExpirationTimeRegex);
|
|
34
|
-
if (access_id && access_id[1] && ExpirationTime && ExpirationTime[1]) {
|
|
35
|
-
await Redis.set(w_webid_key, access_id[1], { EX: Number(ExpirationTime[1]) });
|
|
36
|
-
return String(access_id[1]);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
console.error('Failed to get access_id from __RENDER_DATA__');
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export { getWebId };
|