koishi-plugin-bilibili-videolink-analysis 0.6.2 → 0.6.3
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 +8 -11
- package/package.json +1 -1
- package/readme.md +4 -0
package/lib/index.js
CHANGED
|
@@ -112,6 +112,13 @@ exports.Config = Schema.intersect([
|
|
|
112
112
|
function apply(ctx, config) {
|
|
113
113
|
const bilibiliVideo = ctx.BiliBiliVideo;
|
|
114
114
|
ctx.middleware(async (session, next) => {
|
|
115
|
+
// 如果允许解析 BV 号,则进行解析
|
|
116
|
+
if (config.BVnumberParsing) {
|
|
117
|
+
const bvUrls = convertBVToUrl(session.content);
|
|
118
|
+
if (bvUrls.length > 0) {
|
|
119
|
+
session.content += '\n' + bvUrls.join('\n');
|
|
120
|
+
}
|
|
121
|
+
}
|
|
115
122
|
const links = await isProcessLinks(session, config, ctx, lastProcessedUrls, logger); // 判断是否需要解析
|
|
116
123
|
if (links) {
|
|
117
124
|
const ret = await extractLinks(session, config, ctx, lastProcessedUrls, logger); // 提取链接
|
|
@@ -259,18 +266,8 @@ function apply(ctx, config) {
|
|
|
259
266
|
|
|
260
267
|
//判断是否需要解析
|
|
261
268
|
async function isProcessLinks(session, config, ctx, lastProcessedUrls, logger) {
|
|
262
|
-
let content = session.content;
|
|
263
|
-
|
|
264
|
-
// 如果允许解析 BV 号,则进行解析
|
|
265
|
-
if (config.BVnumberParsing) {
|
|
266
|
-
const bvUrls = convertBVToUrl(content);
|
|
267
|
-
if (bvUrls.length > 0) {
|
|
268
|
-
content += '\n' + bvUrls.join('\n');
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
269
|
// 解析内容中的链接
|
|
273
|
-
const links = link_type_parser(content);
|
|
270
|
+
const links = link_type_parser(session.content);
|
|
274
271
|
if (links.length === 0) {
|
|
275
272
|
return false; // 如果没有找到链接,返回 false
|
|
276
273
|
}
|
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站链接(支持小程序卡片)支持搜索点播功能!灵感来自强大的 [iirose-media-request](/market?keyword=iirose-media-request) 以及完美的 [bili-parser](/market?keyword=bili-parser) ,十分感谢这两个优秀的项目!",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "0.6.
|
|
5
|
+
"version": "0.6.3",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"typings": "lib/index.d.ts",
|
|
8
8
|
"files": [
|
package/readme.md
CHANGED