mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 08:09:19 +00:00
✨ feat: 增加issue要求的哔哩哔哩解析视频时长限制(#I6O2OE)
This commit is contained in:
parent
bb5caffb73
commit
a032e7d9cf
@ -90,6 +90,8 @@ export class tools extends plugin {
|
||||
this.myProxy = `http://${this.proxyAddr}:${this.proxyPort}`;
|
||||
// 加载哔哩哔哩配置
|
||||
this.biliSessData = this.toolsConfig.biliSessData;
|
||||
// 加载哔哩哔哩的限制时长
|
||||
this.biliDuration = this.toolsConfig.biliDuration;
|
||||
// 加载gpt配置
|
||||
this.openaiAccessToken = this.toolsConfig.openaiAccessToken;
|
||||
// 加载gpt客户端
|
||||
@ -326,6 +328,11 @@ export class tools extends plugin {
|
||||
// 请求视频信息
|
||||
const videoInfo = await getVideoInfo(url);
|
||||
const { title, desc, duration, dynamic, stat, aid, cid } = videoInfo;
|
||||
// 限制时长
|
||||
if (duration > this.biliDuration) {
|
||||
e.reply(`当前视频时长约:${(duration / 60).toFixed(0)}分钟,\n大于管理员设置的最大时长 ${this.biliDuration / 60} 分钟!`);
|
||||
return true;
|
||||
}
|
||||
// 视频信息
|
||||
let { view, danmaku, reply, favorite, coin, share, like } = stat;
|
||||
// 数据处理
|
||||
|
@ -6,4 +6,6 @@ translateAppId: '' # 百度翻译APP ID
|
||||
translateSecret: '' # 百度翻译密匙
|
||||
|
||||
biliSessData: '' # 哔哩哔哩的SESSDATA
|
||||
openaiAccessToken: '' # 通过获取:https://chat.openai.com/api/auth/session
|
||||
biliDuration: 900 # 哔哩哔哩限制的最大视频时长(默认15分钟),单位:秒
|
||||
|
||||
openaiAccessToken: '' # 通过获取:https://chat.openai.com/api/auth/session
|
@ -86,6 +86,17 @@ export function supportGuoba() {
|
||||
placeholder: "请输入哔哩哔哩SESSDATA",
|
||||
},
|
||||
},
|
||||
{
|
||||
field: "tools.biliDuration",
|
||||
label: "哔哩哔哩的视频最大限制时长",
|
||||
bottomHelpMessage:
|
||||
"超过时长无法解析,保护服务器性能",
|
||||
component: "Input",
|
||||
required: false,
|
||||
componentProps: {
|
||||
placeholder: "请输入哔哩哔哩的视频最大限制时长(默认15分钟)",
|
||||
},
|
||||
},
|
||||
{
|
||||
field: "tools.openaiAccessToken",
|
||||
label: "OpenAI的AccessToken",
|
||||
|
Loading…
x
Reference in New Issue
Block a user