koishi-plugin-bilibili-videolink-analysis 1.2.0 → 1.3.0

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/utils.d.ts ADDED
@@ -0,0 +1,63 @@
1
+ import { Logger, Context, Session } from "koishi";
2
+ import type { Config } from './index';
3
+ export declare class BilibiliParser {
4
+ private ctx;
5
+ private config;
6
+ private logger;
7
+ private lastProcessedUrls;
8
+ constructor(ctx: Context, config: Config, logger: Logger);
9
+ logInfo(...args: any[]): void;
10
+ isProcessLinks(sessioncontent: string): Promise<false | {
11
+ type: string;
12
+ id: string;
13
+ }[]>;
14
+ extractLinks(session: Session, links: {
15
+ type: string;
16
+ id: string;
17
+ }[]): Promise<string>;
18
+ isLinkProcessedRecently(ret: string, channelId: string): boolean;
19
+ processVideoFromLink(session: Session, ret: string, options?: {
20
+ video?: boolean;
21
+ audio?: boolean;
22
+ link?: boolean;
23
+ }): Promise<void>;
24
+ private extractLastUrl;
25
+ convertBVToUrl(text: string): string[];
26
+ private numeral;
27
+ /**
28
+ * 解析 ID 类型
29
+ * @param id 视频 ID
30
+ * @returns type: ID 类型, id: 视频 ID
31
+ */
32
+ private vid_type_parse;
33
+ /**
34
+ * 根据视频 ID 查找视频信息
35
+ * @param id 视频 ID
36
+ * @returns 视频信息 Json
37
+ */
38
+ private fetch_video_info;
39
+ /**
40
+ * 生成视频信息
41
+ * @param id 视频 ID
42
+ * @returns 文字视频信息
43
+ */
44
+ private gen_context;
45
+ /**
46
+ * 链接类型解析
47
+ * @param content 传入消息
48
+ * @returns type: "链接类型", id :"内容ID"
49
+ */
50
+ private link_type_parser;
51
+ /**
52
+ * 类型执行器
53
+ * @param element 链接列表
54
+ * @returns 解析来的文本
55
+ */
56
+ private type_processer;
57
+ /**
58
+ * 根据短链接重定向获取正常链接
59
+ * @param id 短链接 ID
60
+ * @returns 正常链接
61
+ */
62
+ private get_redir_url;
63
+ }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "koishi-plugin-bilibili-videolink-analysis",
3
3
  "description": "[<ruby>Bilibili视频解析<rp>(</rp><rt>点我查看食用方法</rt><rp>)</rp></ruby>](https://www.npmjs.com/package/koishi-plugin-bilibili-videolink-analysis)解析B站链接(支持小程序卡片)支持搜索点播功能!灵感来自完美的 [bili-parser](/market?keyword=bili-parser) !",
4
4
  "license": "MIT",
5
- "version": "1.2.0",
5
+ "version": "1.3.0",
6
6
  "main": "lib/index.js",
7
7
  "typings": "lib/index.d.ts",
8
8
  "files": [