@anyul/koishi-plugin-rss 4.8.13 → 4.8.15
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 +79 -12
- package/lib/index.js +914 -70
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { Context, Schema } from 'koishi';
|
|
2
|
+
declare module 'koishi' {
|
|
3
|
+
interface Context {
|
|
4
|
+
assets?: {
|
|
5
|
+
upload(dataUrl: string, filename: string): Promise<string>;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
}
|
|
2
9
|
export declare const name = "@anyul/koishi-plugin-rss";
|
|
3
10
|
export declare const inject: {
|
|
4
11
|
required: string[];
|
|
@@ -22,6 +29,7 @@ interface Config {
|
|
|
22
29
|
template?: TemplateConfig;
|
|
23
30
|
net?: NetConfig;
|
|
24
31
|
msg?: MsgConfig;
|
|
32
|
+
ai?: AiConfig;
|
|
25
33
|
debug?: "disable" | "error" | "info" | "details";
|
|
26
34
|
}
|
|
27
35
|
interface BasicConfig {
|
|
@@ -35,8 +43,8 @@ interface BasicConfig {
|
|
|
35
43
|
firstLoad?: boolean;
|
|
36
44
|
urlDeduplication?: boolean;
|
|
37
45
|
resendUpdataContent: 'disable' | 'latest' | 'all';
|
|
38
|
-
imageMode?: 'base64' | 'File';
|
|
39
|
-
videoMode?: 'filter' | 'href' | 'base64' | 'File';
|
|
46
|
+
imageMode?: 'base64' | 'File' | 'assets';
|
|
47
|
+
videoMode?: 'filter' | 'href' | 'base64' | 'File' | 'assets';
|
|
40
48
|
autoSplitImage?: boolean;
|
|
41
49
|
cacheDir?: string;
|
|
42
50
|
replaceDir?: string;
|
|
@@ -63,6 +71,17 @@ interface MsgConfig {
|
|
|
63
71
|
blockString?: string;
|
|
64
72
|
rssHubUrl?: string;
|
|
65
73
|
}
|
|
74
|
+
interface AiConfig {
|
|
75
|
+
enabled?: boolean;
|
|
76
|
+
baseUrl?: string;
|
|
77
|
+
apiKey?: string;
|
|
78
|
+
model?: string;
|
|
79
|
+
placement?: 'top' | 'bottom';
|
|
80
|
+
separator?: string;
|
|
81
|
+
prompt?: string;
|
|
82
|
+
maxInputLength?: number;
|
|
83
|
+
timeout?: number;
|
|
84
|
+
}
|
|
66
85
|
interface proxyAgent {
|
|
67
86
|
enabled?: boolean;
|
|
68
87
|
autoUseProxy?: boolean;
|
|
@@ -86,7 +105,7 @@ export interface rss {
|
|
|
86
105
|
}
|
|
87
106
|
export interface rssArg {
|
|
88
107
|
template?: 'auto' | 'content' | 'only text' | 'only media' | 'only image' | 'only video' | 'proto' | 'default' | 'only description' | 'custom' | 'link';
|
|
89
|
-
content
|
|
108
|
+
content?: string;
|
|
90
109
|
forceLength?: number;
|
|
91
110
|
timeout?: number;
|
|
92
111
|
interval?: number;
|
|
@@ -101,8 +120,14 @@ export interface rssArg {
|
|
|
101
120
|
block?: Array<string>;
|
|
102
121
|
split?: number;
|
|
103
122
|
nextUpdataTime?: number;
|
|
123
|
+
type?: 'rss' | 'html';
|
|
124
|
+
selector?: string;
|
|
125
|
+
textOnly?: boolean;
|
|
126
|
+
mode?: 'static' | 'puppeteer';
|
|
127
|
+
waitFor?: number;
|
|
128
|
+
waitSelector?: string;
|
|
104
129
|
}
|
|
105
|
-
export declare const usage = "\
|
|
130
|
+
export declare const usage = "\n<details>\n<summary>RSS-OWL \u8BA2\u9605\u5668\u4F7F\u7528\u8BF4\u660E</summary>\n\n## \u57FA\u672C\u547D\u4EE4:\n rsso <url> - \u8BA2\u9605RSS\u94FE\u63A5\n rsso -l - \u67E5\u770B\u8BA2\u9605\u5217\u8868\n rsso -l [id] - \u67E5\u770B\u8BA2\u9605\u8BE6\u60C5\n rsso -r <content> - \u5220\u9664\u8BA2\u9605(\u9700\u8981\u6743\u9650)\n rsso -T <url> - \u6D4B\u8BD5\u8BA2\u9605\n rsso.ask <url> <\u9700\u6C42> - AI \u667A\u80FD\u8BA2\u9605\u7F51\u9875 (\u9700\u8981 AI \u914D\u7F6E)\n rsso.watch <url> [\u5173\u952E\u8BCD] - \u7B80\u5355\u7F51\u9875\u76D1\u63A7 (\u5173\u952E\u8BCD/\u6574\u9875)\n\n## \u5E38\u7528\u9009\u9879:\n -i <template> - \u8BBE\u7F6E\u6D88\u606F\u6A21\u677F\n \u53EF\u9009\u503C: content(\u6587\u5B57) | default(\u56FE\u7247) | custom(\u81EA\u5B9A\u4E49) | only text | only media \u7B49\n -t <title> - \u81EA\u5B9A\u4E49\u8BA2\u9605\u6807\u9898\n -a <arg> - \u81EA\u5B9A\u4E49\u914D\u7F6E (\u683C\u5F0F: key:value,key2:value2)\n \u4F8B\u5982: -a timeout:30,merge:true\n\n## \u9AD8\u7EA7\u9009\u9879:\n -f <content> - \u5173\u6CE8\u8BA2\u9605\uFF0C\u66F4\u65B0\u65F6\u63D0\u9192\n -fAll <content> - \u5168\u4F53\u5173\u6CE8(\u9700\u8981\u9AD8\u7EA7\u6743\u9650)\n -target <groupId> - \u8DE8\u7FA4\u8BA2\u9605(\u9700\u8981\u9AD8\u7EA7\u6743\u9650)\n -d <time> - \u5B9A\u65F6\u63A8\u9001 (\u683C\u5F0F: \"HH:mm/\u6570\u91CF\" \u6216 \"HH:mm\")\n \u4F8B\u5982: -d \"08:00/5\" \u8868\u793A\u6BCF\u59298\u70B9\u63A8\u90015\u6761\n -p <id> - \u624B\u52A8\u62C9\u53D6\u6700\u65B0\u5185\u5BB9\n\n## \u5FEB\u901F\u8BA2\u9605:\n rsso -q - \u67E5\u770B\u5FEB\u901F\u8BA2\u9605\u5217\u8868\n rsso -q [\u7F16\u53F7] - \u67E5\u770B\u5FEB\u901F\u8BA2\u9605\u8BE6\u60C5\n rsso -T tg:channel_name - \u5FEB\u901F\u8BA2\u9605Telegram\u9891\u9053\n\n## Assets \u56FE\u7247/\u89C6\u9891\u670D\u52A1\u914D\u7F6E (\u63A8\u8350):\n \u4F7F\u7528 assets \u670D\u52A1\u53EF\u4EE5\u907F\u514D Base64 \u8D85\u957F\u95EE\u9898\n 1. \u5728\u63D2\u4EF6\u5E02\u573A\u5B89\u88C5 assets-xxx \u63D2\u4EF6 (\u5982 assets-local, assets-s3, assets-smms \u7B49)\n 2. \u5728\u5BF9\u5E94\u63D2\u4EF6\u4E2D\u914D\u7F6E\u5B58\u50A8\u4FE1\u606F (AccessKey, Secret, Bucket \u7B49)\n 3. \u5728 RSS-Owl \u57FA\u7840\u8BBE\u7F6E\u4E2D\u5C06 imageMode/videoMode \u8BBE\u7F6E\u4E3A 'assets'\n 4. \u63D2\u4EF6\u4F1A\u81EA\u52A8\u4E0A\u4F20\u56FE\u7247/\u89C6\u9891\u5230\u4F60\u7684\u56FE\u5E8A\u670D\u52A1\n\n## \u914D\u7F6E\u793A\u4F8B:\n rsso -T -i content \"https://example.com/rss\"\n rsso \"https://example.com/rss\" -t \"\u6211\u7684\u8BA2\u9605\" -a \"timeout:60,merge:true\"\n rsso -d \"09:00/3\" \"https://example.com/rss\"\n\n</details>\n\n<details>\n<summary>\u7F51\u9875\u76D1\u63A7 (rsso.html) - \u76D1\u63A7\u4EFB\u610F\u7F51\u9875\u5143\u7D20\u53D8\u5316</summary>\n\n\u4F7F\u7528 CSS \u9009\u62E9\u5668\u76D1\u63A7\u7F51\u9875\u5143\u7D20\u53D8\u5316\uFF0C\u652F\u6301\u9759\u6001\u7F51\u9875\u548C SPA \u52A8\u6001\u9875\u9762\u3002\n\n## \u57FA\u672C\u7528\u6CD5:\n rsso.html <url> -s <selector> - \u76D1\u63A7\u7B26\u5408\u9009\u62E9\u5668\u7684\u5143\u7D20\n\n## \u5E38\u7528\u9009\u9879:\n -s, --selector <\u9009\u62E9\u5668> CSS \u9009\u62E9\u5668 (\u5FC5\u586B)\uFF0C\u4F8B\u5982: .news-item\u3001#price\u3001div.list > li\n -t, --title <\u6807\u9898> \u81EA\u5B9A\u4E49\u8BA2\u9605\u6807\u9898\n -i, --template <\u6A21\u677F> \u6D88\u606F\u6A21\u677F (\u63A8\u8350 content)\n --text \u53EA\u63D0\u53D6\u7EAF\u6587\u672C (\u9ED8\u8BA4\u63D0\u53D6 HTML)\n -T, --test \u6D4B\u8BD5\u6A21\u5F0F\uFF0C\u67E5\u770B\u6293\u53D6\u9884\u89C8\n\n## Puppeteer \u52A8\u6001\u6E32\u67D3 (\u89E3\u51B3 SPA/JS \u52A8\u6001\u5185\u5BB9):\n -P, --puppeteer \u4F7F\u7528 Puppeteer \u6E32\u67D3\u9875\u9762 (\u9700\u8981\u5B89\u88C5 koishi-plugin-puppeteer)\n -w, --wait <\u6BEB\u79D2> \u6E32\u67D3\u540E\u7B49\u5F85\u65F6\u95F4\n -W, --waitSelector <\u9009\u62E9\u5668> \u7B49\u5F85\u7279\u5B9A\u5143\u7D20\u51FA\u73B0\n\n</details>\n\n<details>\n<summary>AI \u6458\u8981 (ai) - \u667A\u80FD\u751F\u6210\u5185\u5BB9\u6458\u8981</summary>\n\n\u4F7F\u7528 OpenAI \u517C\u5BB9 API \u4E3A\u8BA2\u9605\u5185\u5BB9\u751F\u6210 AI \u6458\u8981\u3002\n\n## \u542F\u7528\u65B9\u6CD5:\n 1. \u5728\u63D2\u4EF6\u914D\u7F6E\u4E2D\u5F00\u542F AI \u529F\u80FD\n 2. \u586B\u5199 API Base URL\u3001API Key \u548C\u6A21\u578B\u540D\u79F0\n\n## \u914D\u7F6E\u9879:\n - placement \u6458\u8981\u4F4D\u7F6E: top (\u9876\u90E8) / bottom (\u5E95\u90E8)\n - separator \u5206\u5272\u7EBF\u6837\u5F0F\n - prompt \u63D0\u793A\u8BCD\u6A21\u677F ({{title}} \u6807\u9898, {{content}} \u5185\u5BB9)\n - maxInputLength \u6700\u5927\u8F93\u5165\u957F\u5EA6 (\u9ED8\u8BA4 2000 \u5B57)\n - timeout \u8BF7\u6C42\u8D85\u65F6 (\u9ED8\u8BA4 30000 \u6BEB\u79D2)\n\n## \u4F7F\u7528\u793A\u4F8B:\n # \u5728\u8BA2\u9605\u65F6\u4F7F\u7528 AI \u6458\u8981 (\u9700\u8981\u5168\u5C40\u5F00\u542F AI \u529F\u80FD)\n rsso \"https://example.com/rss\" -t \"AI\u65B0\u95FB\"\n\n## \u6A21\u677F\u53D8\u91CF:\n {{aiSummary}} AI \u751F\u6210\u7684\u6458\u8981\u5185\u5BB9\n - \u5982\u679C\u6A21\u677F\u4E2D\u5305\u542B {{aiSummary}}\uFF0C\u6458\u8981\u4F1A\u5728\u6307\u5B9A\u4F4D\u7F6E\u663E\u793A\n - \u5426\u5219\u6839\u636E placement \u8BBE\u7F6E\u81EA\u52A8\u62FC\u63A5\n\n## \u6CE8\u610F\u4E8B\u9879:\n - \u542F\u7528 AI \u4F1A\u589E\u52A0\u63A8\u9001\u5EF6\u8FDF (\u6BCF\u6761\u7EA6 3-10 \u79D2)\n - \u5EFA\u8BAE\u914D\u5408 forceLength \u9650\u5236\u63A8\u9001\u6570\u91CF\n - \u4EE3\u7406\u8BBE\u7F6E\u5728\u7F51\u7EDC\u914D\u7F6E\u4E2D\u751F\u6548\n\n</details>\n";
|
|
106
131
|
export declare const Config: Schema<Schemastery.ObjectS<{
|
|
107
132
|
basic: Schema<Schemastery.ObjectS<{
|
|
108
133
|
defaultTemplate: Schema<string, string>;
|
|
@@ -115,8 +140,8 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
115
140
|
firstLoad: Schema<boolean, boolean>;
|
|
116
141
|
urlDeduplication: Schema<boolean, boolean>;
|
|
117
142
|
resendUpdataContent: Schema<"disable" | "latest" | "all", "disable" | "latest" | "all">;
|
|
118
|
-
imageMode: Schema<"base64" | "File", "base64" | "File">;
|
|
119
|
-
videoMode: Schema<"base64" | "File" | "filter" | "href", "base64" | "File" | "filter" | "href">;
|
|
143
|
+
imageMode: Schema<"assets" | "base64" | "File", "assets" | "base64" | "File">;
|
|
144
|
+
videoMode: Schema<"assets" | "base64" | "File" | "filter" | "href", "assets" | "base64" | "File" | "filter" | "href">;
|
|
120
145
|
margeVideo: Schema<boolean, boolean>;
|
|
121
146
|
usePoster: Schema<boolean, boolean>;
|
|
122
147
|
autoSplitImage: Schema<boolean, boolean>;
|
|
@@ -133,8 +158,8 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
133
158
|
firstLoad: Schema<boolean, boolean>;
|
|
134
159
|
urlDeduplication: Schema<boolean, boolean>;
|
|
135
160
|
resendUpdataContent: Schema<"disable" | "latest" | "all", "disable" | "latest" | "all">;
|
|
136
|
-
imageMode: Schema<"base64" | "File", "base64" | "File">;
|
|
137
|
-
videoMode: Schema<"base64" | "File" | "filter" | "href", "base64" | "File" | "filter" | "href">;
|
|
161
|
+
imageMode: Schema<"assets" | "base64" | "File", "assets" | "base64" | "File">;
|
|
162
|
+
videoMode: Schema<"assets" | "base64" | "File" | "filter" | "href", "assets" | "base64" | "File" | "filter" | "href">;
|
|
138
163
|
margeVideo: Schema<boolean, boolean>;
|
|
139
164
|
usePoster: Schema<boolean, boolean>;
|
|
140
165
|
autoSplitImage: Schema<boolean, boolean>;
|
|
@@ -176,6 +201,27 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
176
201
|
blockString: Schema<string, string>;
|
|
177
202
|
censor: Schema<boolean, boolean>;
|
|
178
203
|
}>>;
|
|
204
|
+
ai: Schema<Schemastery.ObjectS<{
|
|
205
|
+
enabled: Schema<boolean, boolean>;
|
|
206
|
+
baseUrl: Schema<string, string>;
|
|
207
|
+
apiKey: Schema<string, string>;
|
|
208
|
+
model: Schema<string, string>;
|
|
209
|
+
placement: Schema<"top" | "bottom", "top" | "bottom">;
|
|
210
|
+
separator: Schema<string, string>;
|
|
211
|
+
prompt: Schema<string, string>;
|
|
212
|
+
maxInputLength: Schema<number, number>;
|
|
213
|
+
timeout: Schema<number, number>;
|
|
214
|
+
}>, Schemastery.ObjectT<{
|
|
215
|
+
enabled: Schema<boolean, boolean>;
|
|
216
|
+
baseUrl: Schema<string, string>;
|
|
217
|
+
apiKey: Schema<string, string>;
|
|
218
|
+
model: Schema<string, string>;
|
|
219
|
+
placement: Schema<"top" | "bottom", "top" | "bottom">;
|
|
220
|
+
separator: Schema<string, string>;
|
|
221
|
+
prompt: Schema<string, string>;
|
|
222
|
+
maxInputLength: Schema<number, number>;
|
|
223
|
+
timeout: Schema<number, number>;
|
|
224
|
+
}>>;
|
|
179
225
|
debug: Schema<string, string>;
|
|
180
226
|
}>, Schemastery.ObjectT<{
|
|
181
227
|
basic: Schema<Schemastery.ObjectS<{
|
|
@@ -189,8 +235,8 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
189
235
|
firstLoad: Schema<boolean, boolean>;
|
|
190
236
|
urlDeduplication: Schema<boolean, boolean>;
|
|
191
237
|
resendUpdataContent: Schema<"disable" | "latest" | "all", "disable" | "latest" | "all">;
|
|
192
|
-
imageMode: Schema<"base64" | "File", "base64" | "File">;
|
|
193
|
-
videoMode: Schema<"base64" | "File" | "filter" | "href", "base64" | "File" | "filter" | "href">;
|
|
238
|
+
imageMode: Schema<"assets" | "base64" | "File", "assets" | "base64" | "File">;
|
|
239
|
+
videoMode: Schema<"assets" | "base64" | "File" | "filter" | "href", "assets" | "base64" | "File" | "filter" | "href">;
|
|
194
240
|
margeVideo: Schema<boolean, boolean>;
|
|
195
241
|
usePoster: Schema<boolean, boolean>;
|
|
196
242
|
autoSplitImage: Schema<boolean, boolean>;
|
|
@@ -207,8 +253,8 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
207
253
|
firstLoad: Schema<boolean, boolean>;
|
|
208
254
|
urlDeduplication: Schema<boolean, boolean>;
|
|
209
255
|
resendUpdataContent: Schema<"disable" | "latest" | "all", "disable" | "latest" | "all">;
|
|
210
|
-
imageMode: Schema<"base64" | "File", "base64" | "File">;
|
|
211
|
-
videoMode: Schema<"base64" | "File" | "filter" | "href", "base64" | "File" | "filter" | "href">;
|
|
256
|
+
imageMode: Schema<"assets" | "base64" | "File", "assets" | "base64" | "File">;
|
|
257
|
+
videoMode: Schema<"assets" | "base64" | "File" | "filter" | "href", "assets" | "base64" | "File" | "filter" | "href">;
|
|
212
258
|
margeVideo: Schema<boolean, boolean>;
|
|
213
259
|
usePoster: Schema<boolean, boolean>;
|
|
214
260
|
autoSplitImage: Schema<boolean, boolean>;
|
|
@@ -250,6 +296,27 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
250
296
|
blockString: Schema<string, string>;
|
|
251
297
|
censor: Schema<boolean, boolean>;
|
|
252
298
|
}>>;
|
|
299
|
+
ai: Schema<Schemastery.ObjectS<{
|
|
300
|
+
enabled: Schema<boolean, boolean>;
|
|
301
|
+
baseUrl: Schema<string, string>;
|
|
302
|
+
apiKey: Schema<string, string>;
|
|
303
|
+
model: Schema<string, string>;
|
|
304
|
+
placement: Schema<"top" | "bottom", "top" | "bottom">;
|
|
305
|
+
separator: Schema<string, string>;
|
|
306
|
+
prompt: Schema<string, string>;
|
|
307
|
+
maxInputLength: Schema<number, number>;
|
|
308
|
+
timeout: Schema<number, number>;
|
|
309
|
+
}>, Schemastery.ObjectT<{
|
|
310
|
+
enabled: Schema<boolean, boolean>;
|
|
311
|
+
baseUrl: Schema<string, string>;
|
|
312
|
+
apiKey: Schema<string, string>;
|
|
313
|
+
model: Schema<string, string>;
|
|
314
|
+
placement: Schema<"top" | "bottom", "top" | "bottom">;
|
|
315
|
+
separator: Schema<string, string>;
|
|
316
|
+
prompt: Schema<string, string>;
|
|
317
|
+
maxInputLength: Schema<number, number>;
|
|
318
|
+
timeout: Schema<number, number>;
|
|
319
|
+
}>>;
|
|
253
320
|
debug: Schema<string, string>;
|
|
254
321
|
}>>;
|
|
255
322
|
export declare function apply(ctx: Context, config: Config): void;
|