koishi-plugin-weibo-post-monitor 0.0.5 → 0.0.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.
- package/lib/index.js +10 -7
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -43,6 +43,7 @@ var Config = import_koishi.Schema.object({
|
|
|
43
43
|
account: import_koishi.Schema.string().description("账号(qq号)"),
|
|
44
44
|
plantform: import_koishi.Schema.string().default("onebot").description("账号平台"),
|
|
45
45
|
waitMinutes: import_koishi.Schema.number().default(3).min(1).description("隔多久拉取一次最新微博 (分钟)"),
|
|
46
|
+
cookie: import_koishi.Schema.string().description("cookie"),
|
|
46
47
|
sendINFO: import_koishi.Schema.array(import_koishi.Schema.object({
|
|
47
48
|
weiboUID: import_koishi.Schema.string().description("微博用户UID"),
|
|
48
49
|
forward: import_koishi.Schema.boolean().default(false).description("是否监听转发"),
|
|
@@ -93,6 +94,7 @@ var getWeiboAndSendMessageToGroup = /* @__PURE__ */ __name(async (ctx, params) =
|
|
|
93
94
|
message = import_koishi.h.at("all") + " " + message;
|
|
94
95
|
}
|
|
95
96
|
ctx.bots[`${params.plantform}:${params.account}`].sendMessage(params.groupID, message);
|
|
97
|
+
console.log(message);
|
|
96
98
|
}, "getWeiboAndSendMessageToGroup");
|
|
97
99
|
var getLastPost = /* @__PURE__ */ __name((params, weiboList) => {
|
|
98
100
|
for (const wb_element of weiboList) {
|
|
@@ -156,14 +158,14 @@ var getMessage = /* @__PURE__ */ __name((params, wbPost) => {
|
|
|
156
158
|
const mid = wbPost?.mid || "";
|
|
157
159
|
const url = `
|
|
158
160
|
链接:https://m.weibo.cn/status/${mid}`;
|
|
159
|
-
if (!checkWords(params,
|
|
161
|
+
if (!checkWords(params, wbPost?.text_raw)) {
|
|
160
162
|
return null;
|
|
161
163
|
}
|
|
162
164
|
const wbpost = message ? message + url : screenName + " 发布了微博:\n" + wbPost?.text_raw + url || "";
|
|
163
165
|
return { post: wbpost, islast: true };
|
|
164
166
|
}, "getMessage");
|
|
165
167
|
var getWeibo = /* @__PURE__ */ __name(async (config, callback) => {
|
|
166
|
-
const { weiboUID } = config;
|
|
168
|
+
const { weiboUID, cookie } = config;
|
|
167
169
|
if (!weiboUID) {
|
|
168
170
|
return;
|
|
169
171
|
}
|
|
@@ -171,13 +173,12 @@ var getWeibo = /* @__PURE__ */ __name(async (config, callback) => {
|
|
|
171
173
|
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
|
|
172
174
|
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
|
|
173
175
|
"cache-control": "no-cache",
|
|
174
|
-
"cookie":
|
|
175
|
-
"referer": "https://
|
|
176
|
-
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"
|
|
177
|
-
"x-xsrf-token": "mgVY3WMp8U-T6Wbu24ifdazm"
|
|
176
|
+
"cookie": cookie,
|
|
177
|
+
"referer": "https://www.weibo.com/u/7730797357",
|
|
178
|
+
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"
|
|
178
179
|
};
|
|
179
180
|
const options = {
|
|
180
|
-
hostname: "weibo.com",
|
|
181
|
+
hostname: "www.weibo.com",
|
|
181
182
|
path: "/ajax/statuses/mymblog?uid=" + weiboUID,
|
|
182
183
|
method: "GET",
|
|
183
184
|
headers
|
|
@@ -232,6 +233,8 @@ var parseDateString = /* @__PURE__ */ __name((dateString) => {
|
|
|
232
233
|
return date;
|
|
233
234
|
}, "parseDateString");
|
|
234
235
|
var checkWords = /* @__PURE__ */ __name((params, message) => {
|
|
236
|
+
if (message == null)
|
|
237
|
+
return false;
|
|
235
238
|
let keywordsList = params.keywords?.split(";") || [];
|
|
236
239
|
let blockwordsList = params.blockwords?.split(";") || [];
|
|
237
240
|
if (keywordsList.length > 0) {
|
package/package.json
CHANGED