koishi-plugin-bilibili-videolink-analysis 1.1.10 → 1.1.11

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 CHANGED
@@ -72,7 +72,7 @@ exports.Config = Schema.intersect([
72
72
  Schema.const('4').description('返回视频和视频直链'),
73
73
  Schema.const('5').description('返回视频,仅在日志记录视频直链'),
74
74
  ]).role('radio').default('2').description("是否返回` 视频/视频直链 `"),
75
- BVnumberParsing: Schema.boolean().default(true).description("是否允许根据`独立的BV号`解析视频 `开启后,可以通过视频的BV号解析视频。` <br> [触发说明见README](https://www.npmjs.com/package/koishi-plugin-bilibili-videolink-analysis)"),
75
+ BVnumberParsing: Schema.boolean().default(true).description("是否允许根据`独立的BV、AV号`解析视频 `开启后,可以通过视频的BV、AV号解析视频。` <br> [触发说明见README](https://www.npmjs.com/package/koishi-plugin-bilibili-videolink-analysis)"),
76
76
  Maximumduration: Schema.number().default(25).description("允许解析的视频最大时长(分钟)`超过这个时长 就不会发视频`").min(1),
77
77
  Maximumduration_tip: Schema.union([
78
78
  Schema.const('不返回文字提示').description('不返回文字提示'),
@@ -630,15 +630,24 @@ display: none !important;
630
630
  return urls ? urls.pop() : null;
631
631
  }
632
632
 
633
- // 检测BV号并转换为URL
633
+ // 检测BV / AV 号并转换为URL
634
634
  function convertBVToUrl(text) {
635
635
  const bvPattern = /(?:^|\s)(BV\w{10})(?:\s|$)/g;
636
- const bvMatches = [];
636
+ const avPattern = /(?:^|\s)(av\d+)(?:\s|$)/g; // 新增 AV 号的正则表达式
637
+ const matches = [];
637
638
  let match;
639
+
640
+ // 查找 BV 号
638
641
  while ((match = bvPattern.exec(text)) !== null) {
639
- bvMatches.push(match[1]);
642
+ matches.push(`https://www.bilibili.com/video/${match[1]}`);
643
+ }
644
+
645
+ // 查找 AV 号
646
+ while ((match = avPattern.exec(text)) !== null) {
647
+ matches.push(`https://www.bilibili.com/video/${match[1]}`);
640
648
  }
641
- return bvMatches.length ? bvMatches.map(bv => `https://www.bilibili.com/video/${bv}`) : [];
649
+
650
+ return matches;
642
651
  }
643
652
 
644
653
  // 记录上次处理链接的时间
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.1.10",
5
+ "version": "1.1.11",
6
6
  "main": "lib/index.js",
7
7
  "typings": "lib/index.d.ts",
8
8
  "files": [
package/readme.md CHANGED
@@ -178,10 +178,11 @@ https://www.bilibili.com/video/BV1ii421Q7oj
178
178
  <details>
179
179
  <summary>点击此处 可查看更新日志</summary>
180
180
 
181
- - **1.1.10**
181
+ - **1.1.11**
182
182
  - 又想写了(指readme)
183
183
  - 新增解析格式的的变量分割线
184
184
  - 期间还写了什么,忘了
185
+ - 支持独立的AV号
185
186
 
186
187
  - **1.0.0**
187
188
  - 不想写了