koishi-plugin-weibo-post-monitor 0.0.6 → 0.0.8
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.d.ts +1 -0
- package/lib/index.js +9 -7
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export interface Config {
|
|
|
5
5
|
plantform: string;
|
|
6
6
|
waitMinutes: number;
|
|
7
7
|
sendINFO: any;
|
|
8
|
+
using_cookie: string;
|
|
8
9
|
}
|
|
9
10
|
export declare const Config: Schema<Config>;
|
|
10
11
|
export declare function to<T, U = Error>(promise: Promise<T>, errorExt?: object): Promise<[U, undefined] | [null, T]>;
|
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
|
+
using_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("是否监听转发"),
|
|
@@ -66,7 +67,8 @@ function apply(ctx, config) {
|
|
|
66
67
|
const commonConfig = {
|
|
67
68
|
account: config.account,
|
|
68
69
|
plantform: config.plantform,
|
|
69
|
-
waitMinutes: config.waitMinutes
|
|
70
|
+
waitMinutes: config.waitMinutes,
|
|
71
|
+
using_cookie: config.using_cookie
|
|
70
72
|
};
|
|
71
73
|
ctx.setInterval(async () => {
|
|
72
74
|
for (const singleConfig of config.sendINFO) {
|
|
@@ -92,6 +94,7 @@ var getWeiboAndSendMessageToGroup = /* @__PURE__ */ __name(async (ctx, params) =
|
|
|
92
94
|
if (params.sendAll) {
|
|
93
95
|
message = import_koishi.h.at("all") + " " + message;
|
|
94
96
|
}
|
|
97
|
+
ctx.bots[`${params.plantform}:${params.account}`].sendMessage(params.groupID, message);
|
|
95
98
|
console.log(message);
|
|
96
99
|
}, "getWeiboAndSendMessageToGroup");
|
|
97
100
|
var getLastPost = /* @__PURE__ */ __name((params, weiboList) => {
|
|
@@ -163,7 +166,7 @@ var getMessage = /* @__PURE__ */ __name((params, wbPost) => {
|
|
|
163
166
|
return { post: wbpost, islast: true };
|
|
164
167
|
}, "getMessage");
|
|
165
168
|
var getWeibo = /* @__PURE__ */ __name(async (config, callback) => {
|
|
166
|
-
const { weiboUID } = config;
|
|
169
|
+
const { weiboUID, using_cookie } = config;
|
|
167
170
|
if (!weiboUID) {
|
|
168
171
|
return;
|
|
169
172
|
}
|
|
@@ -171,13 +174,12 @@ var getWeibo = /* @__PURE__ */ __name(async (config, callback) => {
|
|
|
171
174
|
"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
175
|
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
|
|
173
176
|
"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"
|
|
177
|
+
"cookie": using_cookie,
|
|
178
|
+
"referer": "https://www.weibo.com/u/7730797357",
|
|
179
|
+
"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
180
|
};
|
|
179
181
|
const options = {
|
|
180
|
-
hostname: "weibo.com",
|
|
182
|
+
hostname: "www.weibo.com",
|
|
181
183
|
path: "/ajax/statuses/mymblog?uid=" + weiboUID,
|
|
182
184
|
method: "GET",
|
|
183
185
|
headers
|
package/package.json
CHANGED