mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
✨ feat: 增加对哔哩哔哩简介的ytb检测过滤
This commit is contained in:
parent
55c4f953d5
commit
e2503023c6
@ -10,7 +10,7 @@ import HttpProxyAgent from "https-proxy-agent";
|
|||||||
import { exec, execSync } from "child_process";
|
import { exec, execSync } from "child_process";
|
||||||
import { checkAndRemoveFile, deleteFolderRecursive, mkdirIfNotExists } from "../utils/file.js";
|
import { checkAndRemoveFile, deleteFolderRecursive, mkdirIfNotExists } from "../utils/file.js";
|
||||||
import {
|
import {
|
||||||
downloadBFile,
|
downloadBFile, filterBiliDescLink,
|
||||||
getBiliAudio,
|
getBiliAudio,
|
||||||
getBiliVideoWithSession,
|
getBiliVideoWithSession,
|
||||||
getDownloadUrl,
|
getDownloadUrl,
|
||||||
@ -460,8 +460,10 @@ export class tools extends plugin {
|
|||||||
"弹幕数量": danmaku,
|
"弹幕数量": danmaku,
|
||||||
"评论": reply
|
"评论": reply
|
||||||
};
|
};
|
||||||
|
// 过滤简介中的一些链接
|
||||||
|
const filteredDesc = await filterBiliDescLink(desc);
|
||||||
// 格式化数据
|
// 格式化数据
|
||||||
const combineContent = `\n${ formatBiliInfo(dataProcessMap) }\n简介:${ truncateString(desc, this.toolsConfig.biliIntroLenLimit || BILI_DEFAULT_INTRO_LEN_LIMIT) }`;
|
const combineContent = `\n${ formatBiliInfo(dataProcessMap) }\n简介:${ truncateString(filteredDesc, this.toolsConfig.biliIntroLenLimit || BILI_DEFAULT_INTRO_LEN_LIMIT) }`;
|
||||||
let biliInfo = [`识别:哔哩哔哩:${ title }`, combineContent]
|
let biliInfo = [`识别:哔哩哔哩:${ title }`, combineContent]
|
||||||
// 总结
|
// 总结
|
||||||
const summary = await this.getBiliSummary(bvid, cid, owner.mid);
|
const summary = await this.getBiliSummary(bvid, cid, owner.mid);
|
||||||
|
@ -333,3 +333,18 @@ export async function getScanCodeData(qrcodeSavePath = 'qrcode.png', detectTime
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 过滤简介中的一些链接
|
||||||
|
* @param link
|
||||||
|
* @returns {Promise<string>}
|
||||||
|
*/
|
||||||
|
export async function filterBiliDescLink(link) {
|
||||||
|
// YouTube链接
|
||||||
|
const regex = /(?:https?:\/\/)?(?:www\.|music\.)?youtube\.com\/[A-Za-z\d._?%&+\-=\/#]*/g;
|
||||||
|
if (regex.test(link)) {
|
||||||
|
// 使用replace方法过滤掉匹配的链接
|
||||||
|
return link.replace(regex, '').replace(/\n/g, '').trim();
|
||||||
|
}
|
||||||
|
return link;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user