yz-yuki-plugin 2.0.4-9 → 2.0.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/.puppeteerrc.cjs +1 -1
- package/CHANGELOG.md +4 -0
- package/README.md +19 -3
- package/defaultConfig/bilibili/config.yaml +7 -3
- package/defaultConfig/help/help.yaml +51 -51
- package/defaultConfig/weibo/config.yaml +2 -2
- package/lib/apps/bilibili.js +88 -84
- package/lib/apps/help.js +3 -3
- package/lib/apps/version.js +4 -4
- package/lib/apps/weibo.js +47 -47
- package/lib/components/dynamic/Account.js +3 -3
- package/lib/components/dynamic/Content.js +2 -2
- package/lib/components/dynamic/Footer.js +3 -3
- package/lib/components/dynamic/LogoText.js +2 -2
- package/lib/components/dynamic/MainPage.js +2 -2
- package/lib/components/loginQrcode/Page.js +1 -1
- package/lib/index.js +7 -9
- package/lib/models/bilibili/bilibili.api.d.ts +4 -4
- package/lib/models/bilibili/bilibili.api.js +13 -13
- package/lib/models/bilibili/bilibili.get.web.data.js +32 -18
- package/lib/models/bilibili/bilibili.models.d.ts +9 -9
- package/lib/models/bilibili/bilibili.models.js +248 -192
- package/lib/models/bilibili/bilibili.query.d.ts +5 -5
- package/lib/models/bilibili/bilibili.query.js +135 -114
- package/lib/models/bilibili/bilibili.task.d.ts +2 -2
- package/lib/models/bilibili/bilibili.task.js +46 -44
- package/lib/models/bilibili/bilibili.ticket.js +3 -3
- package/lib/models/bilibili/bilibili.wbi.js +10 -12
- package/lib/models/help/help.js +2 -2
- package/lib/models/weibo/weibo.api.js +2 -2
- package/lib/models/weibo/weibo.get.web.data.js +6 -7
- package/lib/models/weibo/weibo.query.d.ts +4 -4
- package/lib/models/weibo/weibo.query.js +66 -69
- package/lib/models/weibo/weibo.task.d.ts +1 -1
- package/lib/models/weibo/weibo.task.js +43 -38
- package/lib/utils/config.d.ts +2 -2
- package/lib/utils/config.js +8 -8
- package/lib/utils/paths.js +1 -1
- package/lib/utils/puppeteer.render.js +20 -22
- package/package.json +8 -4
- package/resources/css/dynamic/Account.css +1 -1
- package/resources/css/dynamic/Content.box.grid.4.css +2 -2
- package/resources/css/dynamic/Content.box.grid.9.css +2 -2
- package/resources/css/dynamic/Content.css +1 -1
- package/resources/css/dynamic/Footer.css +1 -1
- package/resources/css/dynamic/ForwardContent.css +1 -1
- package/resources/css/dynamic/LogoText.css +2 -2
- package/resources/css/dynamic/MainPage.css +4 -5
- package/resources/css/help/help.css +18 -11
- package/resources/css/loginQrcode/Page.css +7 -11
- package/resources/css/version/version.css +8 -6
package/lib/apps/weibo.js
CHANGED
|
@@ -5,7 +5,7 @@ import Config from '../utils/config.js';
|
|
|
5
5
|
import { WeiboGetWebData } from '../models/weibo/weibo.get.web.data.js';
|
|
6
6
|
|
|
7
7
|
const message = new Messages('message');
|
|
8
|
-
let weiboPushData = Config.getConfigData(
|
|
8
|
+
let weiboPushData = Config.getConfigData('config', 'weibo', 'push');
|
|
9
9
|
/** 定义 动态任务 函数 */
|
|
10
10
|
async function weiboNewPushTask(e) {
|
|
11
11
|
await new WeiboTask(e).runTask();
|
|
@@ -17,11 +17,11 @@ message.use(async (e) => {
|
|
|
17
17
|
/** 添加微博动态订阅 */
|
|
18
18
|
message.use(async (e) => {
|
|
19
19
|
if (!e.isMaster) {
|
|
20
|
-
e.reply(
|
|
20
|
+
e.reply('未取得bot主人身份,无权限添加微博动态订阅');
|
|
21
21
|
}
|
|
22
22
|
else {
|
|
23
23
|
// 从消息中提取UID
|
|
24
|
-
const uid = e.msg.replace(/^(#|\/)(yuki|优纪)?(订阅|添加|add|ADD)(微博|weibo|WEIBO)推送\s*(视频\s*|图文\s*|文章\s*|转发\s*)*/g,
|
|
24
|
+
const uid = e.msg.replace(/^(#|\/)(yuki|优纪)?(订阅|添加|add|ADD)(微博|weibo|WEIBO)推送\s*(视频\s*|图文\s*|文章\s*|转发\s*)*/g, '').trim();
|
|
25
25
|
if (!uid) {
|
|
26
26
|
e.reply(`请在指令末尾指定订阅的微博博主的UID!`);
|
|
27
27
|
return true;
|
|
@@ -29,26 +29,26 @@ message.use(async (e) => {
|
|
|
29
29
|
// 获取或初始化推送数据
|
|
30
30
|
let subData = weiboPushData || { group: {}, private: {} };
|
|
31
31
|
// 根据聊天类型初始化数据
|
|
32
|
-
let chatType = e.isGroup ?
|
|
32
|
+
let chatType = e.isGroup ? 'group' : 'private';
|
|
33
33
|
let chatId = e.isGroup ? e.group_id : e.user_id;
|
|
34
34
|
// 初始化群组或私聊数据
|
|
35
35
|
if (!subData[chatType][chatId]) {
|
|
36
36
|
subData[chatType][chatId] = [];
|
|
37
37
|
}
|
|
38
38
|
// 检查该 uid 是否已存在
|
|
39
|
-
const upData = subData[chatType][chatId].find(
|
|
39
|
+
const upData = subData[chatType][chatId].find(item => item.uid === uid);
|
|
40
40
|
if (upData) {
|
|
41
41
|
// 更新推送类型
|
|
42
|
-
upData.type = WeiboQuery.typeHandle(upData, e.msg,
|
|
42
|
+
upData.type = WeiboQuery.typeHandle(upData, e.msg, 'add');
|
|
43
43
|
weiboPushData = subData;
|
|
44
|
-
Config.saveConfig(
|
|
44
|
+
Config.saveConfig('config', 'weibo', 'push', subData);
|
|
45
45
|
e.reply(`修改微博推送动态类型成功~\n${upData.name}:${uid}`);
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
// 获取 微博 博主信息
|
|
49
49
|
const res = await new WeiboGetWebData(e).getBloggerInfo(uid);
|
|
50
|
-
if (res.statusText !==
|
|
51
|
-
e.reply(
|
|
50
|
+
if (res.statusText !== 'OK') {
|
|
51
|
+
e.reply('出了点网络问题,等会再试试吧~');
|
|
52
52
|
return false;
|
|
53
53
|
}
|
|
54
54
|
const { ok, data } = res.data || {};
|
|
@@ -58,7 +58,7 @@ message.use(async (e) => {
|
|
|
58
58
|
}
|
|
59
59
|
const userInfo = data.userInfo || {};
|
|
60
60
|
let name = uid;
|
|
61
|
-
if (userInfo &&
|
|
61
|
+
if (userInfo && userInfo.length !== 0) {
|
|
62
62
|
name = userInfo.screen_name || uid;
|
|
63
63
|
}
|
|
64
64
|
// 添加新的推送数据
|
|
@@ -66,21 +66,21 @@ message.use(async (e) => {
|
|
|
66
66
|
bot_id: e?.self_id, // 使用 bot_id 对应 e_self_id
|
|
67
67
|
uid,
|
|
68
68
|
name: name,
|
|
69
|
-
type: WeiboQuery.typeHandle({ uid, name }, e.msg,
|
|
69
|
+
type: WeiboQuery.typeHandle({ uid, name }, e.msg, 'add')
|
|
70
70
|
});
|
|
71
71
|
weiboPushData = subData;
|
|
72
|
-
Config.saveConfig(
|
|
72
|
+
Config.saveConfig('config', 'weibo', 'push', subData);
|
|
73
73
|
e.reply(`添加微博推送成功~\n${name}:${uid}`);
|
|
74
74
|
}
|
|
75
75
|
}, [/^(#|\/)(yuki|优纪)?(订阅|添加|add|ADD)(微博|weibo|WEIBO)推送\s*(视频\s*|图文\s*|文章\s*|转发\s*)*.*$/]);
|
|
76
76
|
/** 删除微博动态订阅 */
|
|
77
77
|
message.use(async (e) => {
|
|
78
78
|
if (!e.isMaster) {
|
|
79
|
-
e.reply(
|
|
79
|
+
e.reply('未取得bot主人身份,无权限删除微博动态订阅');
|
|
80
80
|
}
|
|
81
81
|
else {
|
|
82
82
|
// 提取用户输入的UID
|
|
83
|
-
const uid = e.msg.replace(/^(#|\/)(yuki|优纪)?(取消|删除|del|DEL)(微博|weibo|WEIBO)推送\s*(视频\s*|图文\s*|文章\s*|转发\s*)*/g,
|
|
83
|
+
const uid = e.msg.replace(/^(#|\/)(yuki|优纪)?(取消|删除|del|DEL)(微博|weibo|WEIBO)推送\s*(视频\s*|图文\s*|文章\s*|转发\s*)*/g, '').trim();
|
|
84
84
|
if (!uid) {
|
|
85
85
|
e.reply(`请在指令末尾指定订阅的微博博主的UID!`);
|
|
86
86
|
return;
|
|
@@ -88,7 +88,7 @@ message.use(async (e) => {
|
|
|
88
88
|
// 获取或初始化微博推送数据
|
|
89
89
|
let data = weiboPushData || { group: {}, private: {} };
|
|
90
90
|
// 根据聊天类型初始化数据
|
|
91
|
-
let chatType = e.isGroup ?
|
|
91
|
+
let chatType = e.isGroup ? 'group' : 'private';
|
|
92
92
|
let chatId = e.isGroup ? e.group_id : e.user_id;
|
|
93
93
|
// 初始化群组或私聊数据
|
|
94
94
|
if (!data[chatType][chatId]) {
|
|
@@ -101,11 +101,11 @@ message.use(async (e) => {
|
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
// 处理订阅类型
|
|
104
|
-
const newType = WeiboQuery.typeHandle(upData, e.msg,
|
|
104
|
+
const newType = WeiboQuery.typeHandle(upData, e.msg, 'del');
|
|
105
105
|
let isDel = false;
|
|
106
106
|
if (newType.length) {
|
|
107
107
|
// 更新订阅类型
|
|
108
|
-
data[chatType][chatId] = data[chatType][chatId].map(
|
|
108
|
+
data[chatType][chatId] = data[chatType][chatId].map(item => {
|
|
109
109
|
if (item.uid == uid) {
|
|
110
110
|
item.type = newType;
|
|
111
111
|
}
|
|
@@ -119,30 +119,30 @@ message.use(async (e) => {
|
|
|
119
119
|
}
|
|
120
120
|
// 保存更新后的数据
|
|
121
121
|
//weiboPushData = data;
|
|
122
|
-
Config.saveConfig(
|
|
122
|
+
Config.saveConfig('config', 'weibo', 'push', data);
|
|
123
123
|
// 回复用户操作结果
|
|
124
|
-
e.reply(`${isDel ?
|
|
124
|
+
e.reply(`${isDel ? '删除' : '修改'}微博推送成功~\n${uid}`);
|
|
125
125
|
}
|
|
126
126
|
}, [/^(#|\/)(yuki|优纪)?(取消|删除|del|DEL)(微博|weibo|WEIBO)推送\s*(视频\s*|图文\s*|文章\s*|转发\s*)*.*$/]);
|
|
127
127
|
/** 订阅的全部微博推送列表 */
|
|
128
128
|
message.use(async (e) => {
|
|
129
129
|
if (!e.isMaster) {
|
|
130
|
-
e.reply(
|
|
130
|
+
e.reply('未取得bot主人身份,无权限查看Bot的全部微博推送列表');
|
|
131
131
|
}
|
|
132
132
|
else {
|
|
133
133
|
let subData = weiboPushData || { group: {}, private: {} };
|
|
134
134
|
const messages = [];
|
|
135
135
|
const typeMap = {
|
|
136
|
-
DYNAMIC_TYPE_AV:
|
|
137
|
-
DYNAMIC_TYPE_WORD:
|
|
138
|
-
DYNAMIC_TYPE_DRAW:
|
|
139
|
-
DYNAMIC_TYPE_ARTICLE:
|
|
140
|
-
DYNAMIC_TYPE_FORWARD:
|
|
136
|
+
DYNAMIC_TYPE_AV: '视频',
|
|
137
|
+
DYNAMIC_TYPE_WORD: '图文',
|
|
138
|
+
DYNAMIC_TYPE_DRAW: '图文',
|
|
139
|
+
DYNAMIC_TYPE_ARTICLE: '文章',
|
|
140
|
+
DYNAMIC_TYPE_FORWARD: '转发'
|
|
141
141
|
};
|
|
142
142
|
// 处理群组订阅
|
|
143
143
|
if (subData.group && Object.keys(subData.group).length > 0) {
|
|
144
|
-
messages.push(
|
|
145
|
-
Object.keys(subData.group).forEach(
|
|
144
|
+
messages.push('------群组微博订阅------');
|
|
145
|
+
Object.keys(subData.group).forEach(groupId => {
|
|
146
146
|
messages.push(`群组ID:${groupId}:`);
|
|
147
147
|
subData.group[groupId].forEach((item) => {
|
|
148
148
|
const types = new Set();
|
|
@@ -153,14 +153,14 @@ message.use(async (e) => {
|
|
|
153
153
|
}
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
|
-
messages.push(`${item.name}:${item.uid} ${types.size ? `[${Array.from(types).join(
|
|
156
|
+
messages.push(`${item.name}:${item.uid} ${types.size ? `[${Array.from(types).join('、')}]` : ' [全部动态]'}`);
|
|
157
157
|
});
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
160
|
// 处理私聊订阅
|
|
161
161
|
if (subData.private && Object.keys(subData.private).length > 0) {
|
|
162
|
-
messages.push(
|
|
163
|
-
Object.keys(subData.private).forEach(
|
|
162
|
+
messages.push('------私聊微博订阅------');
|
|
163
|
+
Object.keys(subData.private).forEach(userId => {
|
|
164
164
|
messages.push(`用户ID:${userId}:`);
|
|
165
165
|
subData.private[userId].forEach((item) => {
|
|
166
166
|
const types = new Set();
|
|
@@ -171,11 +171,11 @@ message.use(async (e) => {
|
|
|
171
171
|
}
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
|
-
messages.push(`${item.name}:${item.uid} ${types.size ? `[${Array.from(types).join(
|
|
174
|
+
messages.push(`${item.name}:${item.uid} ${types.size ? `[${Array.from(types).join('、')}]` : ' [全部动态]'}`);
|
|
175
175
|
});
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
|
-
e.reply(`推送列表如下:\n${messages.join(
|
|
178
|
+
e.reply(`推送列表如下:\n${messages.join('\n')}`);
|
|
179
179
|
}
|
|
180
180
|
}, [/^(#|\/)(yuki|优纪)?(微博|weibo|WEIBO)全部(推送|动态|订阅)列表$/]);
|
|
181
181
|
/** 单独群聊或私聊的订阅的b站推送列表 */
|
|
@@ -183,14 +183,14 @@ message.use(async (e) => {
|
|
|
183
183
|
let subData = weiboPushData || { group: {}, private: {} };
|
|
184
184
|
const messages = [];
|
|
185
185
|
const typeMap = {
|
|
186
|
-
DYNAMIC_TYPE_AV:
|
|
187
|
-
DYNAMIC_TYPE_WORD:
|
|
188
|
-
DYNAMIC_TYPE_DRAW:
|
|
189
|
-
DYNAMIC_TYPE_ARTICLE:
|
|
190
|
-
DYNAMIC_TYPE_FORWARD:
|
|
186
|
+
DYNAMIC_TYPE_AV: '视频',
|
|
187
|
+
DYNAMIC_TYPE_WORD: '图文',
|
|
188
|
+
DYNAMIC_TYPE_DRAW: '图文',
|
|
189
|
+
DYNAMIC_TYPE_ARTICLE: '文章',
|
|
190
|
+
DYNAMIC_TYPE_FORWARD: '转发'
|
|
191
191
|
};
|
|
192
192
|
// 根据聊天类型初始化数据
|
|
193
|
-
let chatType = e.isGroup ?
|
|
193
|
+
let chatType = e.isGroup ? 'group' : 'private';
|
|
194
194
|
let chatId = e.isGroup ? e.group_id : e.user_id;
|
|
195
195
|
if (!subData[chatType][chatId]) {
|
|
196
196
|
subData[chatType][chatId] = [];
|
|
@@ -204,16 +204,16 @@ message.use(async (e) => {
|
|
|
204
204
|
}
|
|
205
205
|
});
|
|
206
206
|
}
|
|
207
|
-
messages.push(`${item.name}:${item.uid} ${types.size ? `[${Array.from(types).join(
|
|
207
|
+
messages.push(`${item.name}:${item.uid} ${types.size ? `[${Array.from(types).join('、')}]` : ' [全部动态]'}`);
|
|
208
208
|
});
|
|
209
|
-
e.reply(`推送列表如下:\n${messages.join(
|
|
209
|
+
e.reply(`推送列表如下:\n${messages.join('\n')}`);
|
|
210
210
|
}, [/^(#|\/)(yuki|优纪)?(微博|weibo|WEIBO)(推送|动态|订阅)列表$/]);
|
|
211
211
|
/**通过uid获取up主信息 */
|
|
212
212
|
message.use(async (e) => {
|
|
213
|
-
let uid = e.msg.replace(/^(#|\/)(yuki|优纪)?(微博|weibo|WEIBO)(博|bo|BO)主/g,
|
|
213
|
+
let uid = e.msg.replace(/^(#|\/)(yuki|优纪)?(微博|weibo|WEIBO)(博|bo|BO)主/g, '').trim();
|
|
214
214
|
const res = await new WeiboGetWebData(e).getBloggerInfo(uid);
|
|
215
215
|
if (res.statusText !== 'OK') {
|
|
216
|
-
e.reply(
|
|
216
|
+
e.reply('诶嘿,出了点网络问题,等会再试试吧~');
|
|
217
217
|
return;
|
|
218
218
|
}
|
|
219
219
|
const { ok, data } = res.data || {};
|
|
@@ -233,16 +233,16 @@ message.use(async (e) => {
|
|
|
233
233
|
`\nsvip等级:${userInfo.svip || ''}`,
|
|
234
234
|
`\nvip等级:${userInfo.mbrank || ''}`,
|
|
235
235
|
`\n关注:${userInfo.follow_count || ''}`,
|
|
236
|
-
`\n粉丝人数:${userInfo.followers_count_str || ''}
|
|
236
|
+
`\n粉丝人数:${userInfo.followers_count_str || ''}`
|
|
237
237
|
];
|
|
238
238
|
e.reply(message);
|
|
239
239
|
}, [/^(#|\/)(yuki|优纪)?(微博|weibo|WEIBO)(博|bo|BO)主.*$/]);
|
|
240
240
|
/** 根据昵称搜索博主信息*/
|
|
241
241
|
message.use(async (e) => {
|
|
242
|
-
let keyword = e.msg.replace(/^(#|\/)(yuki|优纪)?搜索(微博|weibo|WEIBO)(博|bo|BO)主/g,
|
|
242
|
+
let keyword = e.msg.replace(/^(#|\/)(yuki|优纪)?搜索(微博|weibo|WEIBO)(博|bo|BO)主/g, '').trim();
|
|
243
243
|
const res = await new WeiboGetWebData(e).searchBloggerInfo(keyword);
|
|
244
244
|
if (res.statusText !== 'OK') {
|
|
245
|
-
e.reply(
|
|
245
|
+
e.reply('诶嘿,出了点网络问题,等会再试试吧~');
|
|
246
246
|
return;
|
|
247
247
|
}
|
|
248
248
|
const { ok, data } = res.data || {};
|
|
@@ -255,7 +255,7 @@ message.use(async (e) => {
|
|
|
255
255
|
let screen_name = infos?.screen_name;
|
|
256
256
|
let followers_count_str = infos?.followers_count_str;
|
|
257
257
|
if (ok !== 1 && !info && !infos) {
|
|
258
|
-
e.reply(
|
|
258
|
+
e.reply('惹~没有搜索到该用户捏,\n请换个关键词试试吧~ \nPS:该方法只能搜索到大V');
|
|
259
259
|
return;
|
|
260
260
|
}
|
|
261
261
|
const messages = [];
|
|
@@ -263,7 +263,7 @@ message.use(async (e) => {
|
|
|
263
263
|
\n博主昵称:${nick || screen_name}
|
|
264
264
|
\nUID:${uid || id}
|
|
265
265
|
\n粉丝人数:${followers_count_str || ''}`);
|
|
266
|
-
e.reply(messages.join(
|
|
266
|
+
e.reply(messages.join('\n'));
|
|
267
267
|
}, [/^(#|\/)(yuki|优纪)?搜索(微博|weibo|WEIBO)(博|bo|BO)主.*$/]);
|
|
268
268
|
const YukiWeibo = message.ok;
|
|
269
269
|
|
|
@@ -9,7 +9,7 @@ const Bilibililogo = require('./../../../resources/img/icon/dynamic/bilibili.svg
|
|
|
9
9
|
const Weibilogo = require('./../../../resources/img/icon/dynamic/weibo.svg');
|
|
10
10
|
const AccountCss = require('./../../../resources/css/dynamic/Account.css');
|
|
11
11
|
const Account = ({ data }) => {
|
|
12
|
-
const renderLogo = (logoSrc, className) =>
|
|
12
|
+
const renderLogo = (logoSrc, className) => React.createElement("img", { src: logoSrc, className: className, alt: "logo" });
|
|
13
13
|
return (React.createElement(React.Fragment, null,
|
|
14
14
|
React.createElement("link", { rel: "stylesheet", href: AccountCss }),
|
|
15
15
|
React.createElement("div", { className: "account" },
|
|
@@ -17,8 +17,8 @@ const Account = ({ data }) => {
|
|
|
17
17
|
React.createElement("img", { src: data.face, alt: "\u5934\u50CF", className: "avatar" }),
|
|
18
18
|
data.pendant && React.createElement("img", { className: "pendant", src: data.pendant, alt: "pendant" }),
|
|
19
19
|
React.createElement("div", { className: "account-info" },
|
|
20
|
-
React.createElement("div", { className: "nickname" }, data.name ||
|
|
21
|
-
React.createElement("div", { className: "timestamp" }, data.pubTs ||
|
|
20
|
+
React.createElement("div", { className: "nickname" }, data.name || ''),
|
|
21
|
+
React.createElement("div", { className: "timestamp" }, data.pubTs || ''))),
|
|
22
22
|
React.createElement("div", { className: "logo-container" },
|
|
23
23
|
data.appName === 'bilibili' && renderLogo(Bilibililogo, 'bilibili-logo'),
|
|
24
24
|
data.appName === 'weibo' && renderLogo(Weibilogo, 'weibo-logo'),
|
|
@@ -7,7 +7,7 @@ const ContentBoxGrid4Css = require('./../../../resources/css/dynamic/Content.box
|
|
|
7
7
|
const ContentBoxGrid9Css = require('./../../../resources/css/dynamic/Content.box.grid.9.css');
|
|
8
8
|
const ContentCss = require('./../../../resources/css/dynamic/Content.css');
|
|
9
9
|
const Content = ({ data }) => {
|
|
10
|
-
const picItems = data.pics && (React.createElement("div", { className:
|
|
10
|
+
const picItems = data.pics && (React.createElement("div", { className: "pic-content" }, data.pics.map((item, index) => {
|
|
11
11
|
if (item) {
|
|
12
12
|
return (React.createElement("div", { className: "pic-item", key: `${index}_0` },
|
|
13
13
|
React.createElement("img", { key: `${index}_1`, src: item?.url, alt: " " })));
|
|
@@ -68,7 +68,7 @@ const Content = ({ data }) => {
|
|
|
68
68
|
}
|
|
69
69
|
return null;
|
|
70
70
|
}
|
|
71
|
-
const boxGrid = data.boxGrid &&
|
|
71
|
+
const boxGrid = data.boxGrid && data.pics && getBoxGridStyle(data.pics);
|
|
72
72
|
const contentCss = React.createElement("link", { rel: "stylesheet", href: ContentCss });
|
|
73
73
|
switch (data.type) {
|
|
74
74
|
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
|
@@ -16,16 +16,16 @@ const Footer = ({ data }) => {
|
|
|
16
16
|
React.createElement("link", { rel: "stylesheet", href: FooterCss }),
|
|
17
17
|
React.createElement("div", { className: "footer" },
|
|
18
18
|
React.createElement("div", { className: "footer-text-container" },
|
|
19
|
-
data.appName === 'bilibili' && (React.createElement("svg", { className:
|
|
19
|
+
data.appName === 'bilibili' && (React.createElement("svg", { className: "w-32 h-10 bili-logo-0", style: { width: '8rem', height: '2.5rem' } },
|
|
20
20
|
React.createElement("image", { href: bilibililogo }))),
|
|
21
|
-
data.appName === 'weibo' && (React.createElement("svg", { className:
|
|
21
|
+
data.appName === 'weibo' && (React.createElement("svg", { className: "h-12 weibo-logo-0", style: { height: '3rem' } },
|
|
22
22
|
React.createElement("image", { href: weibilogo, width: "55", height: "55" }))),
|
|
23
23
|
React.createElement("div", { className: "qr-code-massage", style: { marginTop: '-4px' } },
|
|
24
24
|
"\u8BC6\u522B\u4E8C\u7EF4\u7801\uFF0C\u67E5\u770B\u5B8C\u6574",
|
|
25
25
|
data.category),
|
|
26
26
|
React.createElement("div", { className: "creatde-time", style: { marginTop: '6px', color: '#a46e8a' } },
|
|
27
27
|
"\u56FE\u7247\u751F\u6210\u4E8E\uFF1A",
|
|
28
|
-
data.created ||
|
|
28
|
+
data.created || ''),
|
|
29
29
|
React.createElement("div", { className: "bot-plugin-info", style: { marginTop: '6px' } },
|
|
30
30
|
"Created By ",
|
|
31
31
|
`${BOT_NAME}-v` + `${botVersion}`,
|
|
@@ -7,7 +7,7 @@ const require = createRequire(import.meta.url);
|
|
|
7
7
|
const LogoTextCss = require('./../../../resources/css/dynamic/LogoText.css');
|
|
8
8
|
const LogoText = ({ data }) => (React.createElement(React.Fragment, null,
|
|
9
9
|
React.createElement("link", { rel: "stylesheet", href: LogoTextCss }),
|
|
10
|
-
data.appName === 'bilibili' &&
|
|
11
|
-
data.appName === 'weibo' &&
|
|
10
|
+
data.appName === 'bilibili' && React.createElement("div", { className: "bilibili-logo-text" }, data.category),
|
|
11
|
+
data.appName === 'weibo' && React.createElement("div", { className: "weibo-logo-text" }, data.category)));
|
|
12
12
|
|
|
13
13
|
export { LogoText as default };
|
|
@@ -16,8 +16,8 @@ function App({ data }) {
|
|
|
16
16
|
React.createElement(Account, { data: data }),
|
|
17
17
|
React.createElement("div", { className: "dynamic-article-page-main unfold" },
|
|
18
18
|
React.createElement(Content, { data: data }),
|
|
19
|
-
data.orig && React.createElement(React.Fragment, null,
|
|
20
|
-
React.createElement(ForwardContent, { data: data.orig.data }))),
|
|
19
|
+
data.orig && (React.createElement(React.Fragment, null,
|
|
20
|
+
React.createElement(ForwardContent, { data: data.orig.data })))),
|
|
21
21
|
React.createElement(Footer, { data: data })))));
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -7,7 +7,7 @@ const LoginQrcodeCss = require('./../../../resources/css/loginQrcode/Page.css');
|
|
|
7
7
|
function App({ data }) {
|
|
8
8
|
return (React.createElement(React.Fragment, null,
|
|
9
9
|
React.createElement("link", { rel: "stylesheet", href: LoginQrcodeCss }),
|
|
10
|
-
React.createElement("div", { className:
|
|
10
|
+
React.createElement("div", { className: "container w-96 max-h-96 m-auto text-lg p-5" },
|
|
11
11
|
React.createElement("div", { className: "txt-0 text-center mt-3 mb-3 p-1 text-blue-500" },
|
|
12
12
|
"Created By yuki-plugin",
|
|
13
13
|
React.createElement("br", null),
|
package/lib/index.js
CHANGED
|
@@ -8,8 +8,8 @@ import { BiliTask } from './models/bilibili/bilibili.task.js';
|
|
|
8
8
|
import { WeiboTask } from './models/weibo/weibo.task.js';
|
|
9
9
|
|
|
10
10
|
const yukiPluginVersion = Config.getPackageJsonKey('version', path.join(_paths.pluginPath, 'package.json'));
|
|
11
|
-
let biliConfigData = Config.getConfigData(
|
|
12
|
-
let weiboConfigData = Config.getConfigData(
|
|
11
|
+
let biliConfigData = Config.getConfigData('config', 'bilibili', 'config');
|
|
12
|
+
let weiboConfigData = Config.getConfigData('config', 'weibo', 'config');
|
|
13
13
|
/** B站动态任务 函数 */
|
|
14
14
|
async function biliNewPushTask(e) {
|
|
15
15
|
await new BiliTask(e).runTask();
|
|
@@ -49,25 +49,25 @@ var index = () => {
|
|
|
49
49
|
try {
|
|
50
50
|
biliNewPushTask();
|
|
51
51
|
if (biliConfigData.pushTaskLog) {
|
|
52
|
-
Bot.logger.mark(
|
|
52
|
+
Bot.logger.mark('yuki插件---B站动态推送定时任务');
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
catch (err) {
|
|
56
56
|
console.error('B站动态推送定时任务', err);
|
|
57
57
|
}
|
|
58
|
-
}, biliConfigData.pushStatus ? biliConfigData.pushTime :
|
|
58
|
+
}, biliConfigData.pushStatus ? biliConfigData.pushTime : '');
|
|
59
59
|
/** 微博动态推送定时任务 */
|
|
60
60
|
setBotTask(async (Bot) => {
|
|
61
61
|
try {
|
|
62
62
|
await weiboNewPushTask();
|
|
63
63
|
if (weiboConfigData.pushTaskLog) {
|
|
64
|
-
Bot.logger.mark(
|
|
64
|
+
Bot.logger.mark('yuki插件---微博动态推送定时任务');
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
catch (err) {
|
|
68
68
|
console.error('微博动态推送定时任务', err);
|
|
69
69
|
}
|
|
70
|
-
}, weiboConfigData.pushStatus ? weiboConfigData.pushTime :
|
|
70
|
+
}, weiboConfigData.pushStatus ? weiboConfigData.pushTime : '');
|
|
71
71
|
},
|
|
72
72
|
async mounted(e) {
|
|
73
73
|
// 存储
|
|
@@ -80,9 +80,7 @@ var index = () => {
|
|
|
80
80
|
// 匹配正则
|
|
81
81
|
// 存在key
|
|
82
82
|
// 第一次new
|
|
83
|
-
if (new RegExp(item.reg).test(e.msg) &&
|
|
84
|
-
index$1[item.key] &&
|
|
85
|
-
!cache[item.key]) {
|
|
83
|
+
if (new RegExp(item.reg).test(e.msg) && index$1[item.key] && !cache[item.key]) {
|
|
86
84
|
cache[item.key] = true;
|
|
87
85
|
data.push(new index$1[item.key]());
|
|
88
86
|
}
|
|
@@ -20,7 +20,7 @@ export declare class BiliApi {
|
|
|
20
20
|
'Content-type': string;
|
|
21
21
|
Cookie: string;
|
|
22
22
|
pragma: string;
|
|
23
|
-
|
|
23
|
+
'Cache-control': string;
|
|
24
24
|
DNT: string;
|
|
25
25
|
'Sec-GPC': string;
|
|
26
26
|
'sec-ch-ua-platform': string;
|
|
@@ -30,7 +30,7 @@ export declare class BiliApi {
|
|
|
30
30
|
'Sec-Fetch-Site': string;
|
|
31
31
|
'Sec-Fetch-User': string;
|
|
32
32
|
TE: string;
|
|
33
|
-
|
|
33
|
+
'Upgrade-Insecure-Requests': string;
|
|
34
34
|
'User-Agent': string;
|
|
35
35
|
};
|
|
36
36
|
/**Login header */
|
|
@@ -55,7 +55,7 @@ export declare class BiliApi {
|
|
|
55
55
|
'Content-type': string;
|
|
56
56
|
Cookie: string;
|
|
57
57
|
pragma: string;
|
|
58
|
-
|
|
58
|
+
'Cache-control': string;
|
|
59
59
|
DNT: string;
|
|
60
60
|
'Sec-GPC': string;
|
|
61
61
|
'sec-ch-ua-mobile': string;
|
|
@@ -64,7 +64,7 @@ export declare class BiliApi {
|
|
|
64
64
|
'Sec-Fetch-Site': string;
|
|
65
65
|
'Sec-Fetch-User': string;
|
|
66
66
|
TE: string;
|
|
67
|
-
|
|
67
|
+
'Upgrade-Insecure-Requests': string;
|
|
68
68
|
'User-Agent': string;
|
|
69
69
|
};
|
|
70
70
|
}
|
|
@@ -13,10 +13,10 @@ class BiliApi {
|
|
|
13
13
|
//通过关键词${upKeyword}搜索up主 parama = { keyword: 'upKeyword', page: 1, search_type: 'bili_user', order: 'totalrank' },需要wbi签名
|
|
14
14
|
biliSearchUpWbi: `https://api.bilibili.com/x/web-interface/wbi/search/type`,
|
|
15
15
|
biliLiveStatus: 'https://api.live.bilibili.com/room/v1/Room/get_status_info_by_uids',
|
|
16
|
-
biliCard:
|
|
17
|
-
biliStat:
|
|
18
|
-
biliLiveUserInfo:
|
|
19
|
-
biliOpusDetail:
|
|
16
|
+
biliCard: 'https://api.bilibili.com/x/web-interface/card',
|
|
17
|
+
biliStat: 'https://api.bilibili.com/x/relation/stat',
|
|
18
|
+
biliLiveUserInfo: 'https://api.live.bilibili.com/live_user/v1/Master/info',
|
|
19
|
+
biliOpusDetail: 'https://api.bilibili.com/x/polymer/web-dynamic/v1/opus/detail'
|
|
20
20
|
};
|
|
21
21
|
/**header */
|
|
22
22
|
static BILIBILI_HEADERS = {
|
|
@@ -24,9 +24,9 @@ class BiliApi {
|
|
|
24
24
|
'Accept-Language': 'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2',
|
|
25
25
|
'Accept-Encoding': 'gzip, deflate, br',
|
|
26
26
|
'Content-type': 'application/json;charset=UTF-8',
|
|
27
|
-
Cookie: '',
|
|
28
|
-
'pragma':
|
|
29
|
-
|
|
27
|
+
'Cookie': '',
|
|
28
|
+
'pragma': 'no-cache',
|
|
29
|
+
'Cache-control': 'max-age=0',
|
|
30
30
|
'DNT': '1',
|
|
31
31
|
'Sec-GPC': '1',
|
|
32
32
|
'sec-ch-ua-platform': '',
|
|
@@ -36,7 +36,7 @@ class BiliApi {
|
|
|
36
36
|
'Sec-Fetch-Site': 'same-site',
|
|
37
37
|
'Sec-Fetch-User': '?0',
|
|
38
38
|
'TE': 'trailers',
|
|
39
|
-
|
|
39
|
+
'Upgrade-Insecure-Requests': '1',
|
|
40
40
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0'
|
|
41
41
|
};
|
|
42
42
|
/**Login header */
|
|
@@ -51,7 +51,7 @@ class BiliApi {
|
|
|
51
51
|
'Sec-Fetch-Mode': 'navigate',
|
|
52
52
|
'Sec-Fetch-Site': 'none',
|
|
53
53
|
'Sec-Fetch-User': '?1',
|
|
54
|
-
'TE': 'trailers'
|
|
54
|
+
'TE': 'trailers'
|
|
55
55
|
};
|
|
56
56
|
/**FullArticle header */
|
|
57
57
|
static BILIBILI_ARTICLE_HEADERS = {
|
|
@@ -59,9 +59,9 @@ class BiliApi {
|
|
|
59
59
|
'Accept-Language': 'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2',
|
|
60
60
|
'Accept-Encoding': 'gzip, deflate, br',
|
|
61
61
|
'Content-type': 'text/html; charset=utf-8',
|
|
62
|
-
Cookie: '',
|
|
63
|
-
'pragma':
|
|
64
|
-
|
|
62
|
+
'Cookie': '',
|
|
63
|
+
'pragma': 'no-cache',
|
|
64
|
+
'Cache-control': 'no-cache',
|
|
65
65
|
'DNT': '1',
|
|
66
66
|
'Sec-GPC': '1',
|
|
67
67
|
'sec-ch-ua-mobile': '?0',
|
|
@@ -70,7 +70,7 @@ class BiliApi {
|
|
|
70
70
|
'Sec-Fetch-Site': 'same-site',
|
|
71
71
|
'Sec-Fetch-User': '?1',
|
|
72
72
|
'TE': 'trailers',
|
|
73
|
-
|
|
73
|
+
'Upgrade-Insecure-Requests': '1',
|
|
74
74
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0'
|
|
75
75
|
};
|
|
76
76
|
}
|
|
@@ -5,25 +5,24 @@ import { readSyncCookie, cookieWithBiliTicket, readSavedCookieItems, readSavedCo
|
|
|
5
5
|
import { getWbiSign } from './bilibili.wbi.js';
|
|
6
6
|
|
|
7
7
|
class BiliGetWebData {
|
|
8
|
-
constructor(e) {
|
|
9
|
-
}
|
|
8
|
+
constructor(e) { }
|
|
10
9
|
/**通过uid获取up动态数据表*/
|
|
11
10
|
async getBiliDynamicListDataByUid(uid) {
|
|
12
11
|
const url = BiliApi.BILIBIL_API.biliDynamicInfoList;
|
|
13
12
|
let { cookie } = await readSyncCookie();
|
|
14
13
|
cookie = await cookieWithBiliTicket(cookie);
|
|
15
14
|
const data = {
|
|
16
|
-
offset: '',
|
|
17
|
-
host_mid: uid,
|
|
18
|
-
timezone_offset: -480,
|
|
19
|
-
platform: 'web',
|
|
20
|
-
features:
|
|
21
|
-
web_location:
|
|
15
|
+
'offset': '',
|
|
16
|
+
'host_mid': uid,
|
|
17
|
+
'timezone_offset': -480,
|
|
18
|
+
'platform': 'web',
|
|
19
|
+
'features': 'itemOpusStyle,listOnlyfans,opusBigCover,onlyfansVote',
|
|
20
|
+
'web_location': '333.999',
|
|
22
21
|
//...getDmImg(),
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
'x-bili-device-req-json': { platform: 'web', device: 'pc' },
|
|
23
|
+
'x-bili-web-req-json': { spm_id: '333.999' }
|
|
25
24
|
};
|
|
26
|
-
let signCookie = await readSavedCookieItems(cookie, [
|
|
25
|
+
let signCookie = (await readSavedCookieItems(cookie, ['SESSDATA'], false)) || (await readSavedCookieOtherItems(cookie, ['SESSDATA']));
|
|
27
26
|
const { w_rid, time_stamp } = await getWbiSign(data, BiliApi.BILIBILI_HEADERS, signCookie);
|
|
28
27
|
const params = {
|
|
29
28
|
...data,
|
|
@@ -33,7 +32,12 @@ class BiliGetWebData {
|
|
|
33
32
|
const res = await axios.get(url, {
|
|
34
33
|
params,
|
|
35
34
|
timeout: 10000,
|
|
36
|
-
headers: lodash.merge(BiliApi.BILIBILI_HEADERS, {
|
|
35
|
+
headers: lodash.merge(BiliApi.BILIBILI_HEADERS, {
|
|
36
|
+
Cookie: `${cookie}`,
|
|
37
|
+
Host: `api.bilibili.com`,
|
|
38
|
+
Origin: 'https://www.bilibili.com',
|
|
39
|
+
Referer: `https://www.bilibili.com/`
|
|
40
|
+
})
|
|
37
41
|
});
|
|
38
42
|
return res;
|
|
39
43
|
}
|
|
@@ -44,9 +48,9 @@ class BiliGetWebData {
|
|
|
44
48
|
cookie = await cookieWithBiliTicket(cookie);
|
|
45
49
|
const data = {
|
|
46
50
|
mid: uid,
|
|
47
|
-
jsonp: 'jsonp'
|
|
51
|
+
jsonp: 'jsonp'
|
|
48
52
|
};
|
|
49
|
-
let signCookie = await readSavedCookieItems(cookie, [
|
|
53
|
+
let signCookie = (await readSavedCookieItems(cookie, ['SESSDATA'], false)) || (await readSavedCookieOtherItems(cookie, ['SESSDATA']));
|
|
50
54
|
const { w_rid, time_stamp } = await getWbiSign(data, BiliApi.BILIBILI_HEADERS, signCookie);
|
|
51
55
|
const params = {
|
|
52
56
|
...data,
|
|
@@ -56,7 +60,12 @@ class BiliGetWebData {
|
|
|
56
60
|
const res = await axios.get(url, {
|
|
57
61
|
params,
|
|
58
62
|
timeout: 5000,
|
|
59
|
-
headers: lodash.merge(BiliApi.BILIBILI_HEADERS, {
|
|
63
|
+
headers: lodash.merge(BiliApi.BILIBILI_HEADERS, {
|
|
64
|
+
Cookie: `${cookie}`,
|
|
65
|
+
Host: `api.bilibili.com`,
|
|
66
|
+
Origin: 'https://www.bilibili.com',
|
|
67
|
+
Referer: `https://www.bilibili.com/`
|
|
68
|
+
})
|
|
60
69
|
});
|
|
61
70
|
return res;
|
|
62
71
|
}
|
|
@@ -69,9 +78,9 @@ class BiliGetWebData {
|
|
|
69
78
|
keyword: keyword,
|
|
70
79
|
page: 1,
|
|
71
80
|
search_type: 'bili_user',
|
|
72
|
-
order: 'totalrank'
|
|
81
|
+
order: 'totalrank'
|
|
73
82
|
};
|
|
74
|
-
let signCookie = await readSavedCookieItems(cookie, [
|
|
83
|
+
let signCookie = (await readSavedCookieItems(cookie, ['SESSDATA'], false)) || (await readSavedCookieOtherItems(cookie, ['SESSDATA']));
|
|
75
84
|
const { w_rid, time_stamp } = await getWbiSign(data, BiliApi.BILIBILI_HEADERS, signCookie);
|
|
76
85
|
const params = {
|
|
77
86
|
...data,
|
|
@@ -81,7 +90,12 @@ class BiliGetWebData {
|
|
|
81
90
|
const res = await axios.get(url, {
|
|
82
91
|
params,
|
|
83
92
|
timeout: 5000,
|
|
84
|
-
headers: lodash.merge(BiliApi.BILIBILI_HEADERS, {
|
|
93
|
+
headers: lodash.merge(BiliApi.BILIBILI_HEADERS, {
|
|
94
|
+
Cookie: `${cookie}`,
|
|
95
|
+
Host: `api.bilibili.com`,
|
|
96
|
+
Origin: 'https://www.bilibili.com',
|
|
97
|
+
Referer: `https://www.bilibili.com/`
|
|
98
|
+
})
|
|
85
99
|
});
|
|
86
100
|
return res;
|
|
87
101
|
}
|