mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
🎈 pref: V1.5.8 哔哩哔哩简介加入限制优化
应群友反应哔哩哔哩的简介过长会导致刷屏,所以限制了长度可以在锅巴或者tools.yaml进行调整
This commit is contained in:
parent
625b1b7e2d
commit
4f7d31c124
@ -19,6 +19,7 @@ import {
|
||||
} from "../utils/bilibili.js";
|
||||
import { downloadM3u8Videos, mergeAcFileToMp4, parseM3u8, parseUrl } from "../utils/acfun.js";
|
||||
import {
|
||||
BILI_DEFAULT_INTRO_LEN_LIMIT,
|
||||
DIVIDING_LINE,
|
||||
douyinTypeMap,
|
||||
REDIS_YUNZAI_ISOVERSEA,
|
||||
@ -32,7 +33,7 @@ import {
|
||||
downloadMp3,
|
||||
formatBiliInfo,
|
||||
getIdVideo,
|
||||
secondsToTime
|
||||
secondsToTime, truncateString
|
||||
} from "../utils/common.js";
|
||||
import config from "../model/index.js";
|
||||
import Translate from "../utils/trans-strategy.js";
|
||||
@ -374,7 +375,7 @@ export class tools extends plugin {
|
||||
"评论": reply
|
||||
};
|
||||
// 格式化数据
|
||||
const combineContent = `\n${ formatBiliInfo(dataProcessMap) }\n简介:${ desc }`;
|
||||
const combineContent = `\n${ formatBiliInfo(dataProcessMap) }\n简介:${ truncateString(desc, this.toolsConfig.biliIntroLenLimit || BILI_DEFAULT_INTRO_LEN_LIMIT) }`;
|
||||
let biliInfo = [`识别:哔哩哔哩:${ title }`, combineContent]
|
||||
// 总结
|
||||
const summary = await this.getBiliSummary(bvid, cid, owner.mid);
|
||||
|
@ -6,6 +6,7 @@ translateAppId: '' # 百度翻译APP ID
|
||||
translateSecret: '' # 百度翻译密匙
|
||||
|
||||
biliSessData: '' # 哔哩哔哩的SESSDATA
|
||||
biliIntroLenLimit: 50 # 哔哩哔哩简介长度限制
|
||||
biliDuration: 480 # 哔哩哔哩限制的最大视频时长(默认8分钟),单位:秒
|
||||
|
||||
douyinCookie: '' # douyin's cookie, 格式:odin_tt=xxx;sessionid_ss=xxx;ttwid=xxx;passport_csrf_token=xxx;msToken=xxx;
|
@ -1,12 +1,11 @@
|
||||
- {
|
||||
version: 1.5.7,
|
||||
version: 1.5.8,
|
||||
data:
|
||||
[
|
||||
优化<span class="cmd">哔哩哔哩简介</span>功能,
|
||||
新增<span class="cmd">皮皮搞笑解析</span>功能,
|
||||
新增<span class="cmd">皮皮虾解析</span>功能,
|
||||
新增<span class="cmd">微博解析</span>功能,
|
||||
新增<span class="cmd">最右解析</span>功能,
|
||||
新增<span class="cmd">米游社解析</span>功能,
|
||||
支持<span class="cmd">锅巴</span>插件,方便查看和修改配置,
|
||||
添加<span class="cmd">#R帮助</span>获取插件帮助,
|
||||
添加<span class="cmd">#R版本</span>获取插件版本,
|
||||
|
@ -71,4 +71,10 @@ export const DIVIDING_LINE = "\n------------------{}------------------"
|
||||
*/
|
||||
export const REDIS_YUNZAI_ISOVERSEA = "Yz:rconsole:tools:oversea";
|
||||
|
||||
export const TWITTER_BEARER_TOKEN = ""
|
||||
export const TWITTER_BEARER_TOKEN = "";
|
||||
|
||||
/**
|
||||
* 哔哩哔哩简介默认长度限制
|
||||
* @type {number}
|
||||
*/
|
||||
export const BILI_DEFAULT_INTRO_LEN_LIMIT = 50;
|
@ -97,6 +97,17 @@ export function supportGuoba() {
|
||||
placeholder: "请输入哔哩哔哩的视频最大限制时长(默认15分钟)",
|
||||
},
|
||||
},
|
||||
{
|
||||
field: "tools.biliIntroLenLimit",
|
||||
label: "哔哩哔哩的简介长度限制",
|
||||
bottomHelpMessage:
|
||||
"防止简介过长刷屏",
|
||||
component: "Input",
|
||||
required: false,
|
||||
componentProps: {
|
||||
placeholder: "请输入哔哩哔哩的简介长度限制(默认50个字符)",
|
||||
},
|
||||
},
|
||||
{
|
||||
field: "tools.douyinCookie",
|
||||
label: "抖音的Cookie",
|
||||
|
@ -279,3 +279,21 @@ export function containsChinese(str) {
|
||||
export function containsChineseOrPunctuation(str) {
|
||||
return /[\u4e00-\u9fff\uff00-\uffef]/.test(str);
|
||||
}
|
||||
|
||||
/**
|
||||
* 超过某个长度的字符串换为...
|
||||
* @param inputString
|
||||
* @param maxLength
|
||||
* @returns {*|string}
|
||||
*/
|
||||
export function truncateString(inputString, maxLength = 50) {
|
||||
if (inputString.length <= maxLength) {
|
||||
return inputString;
|
||||
} else {
|
||||
// 截取字符串,保留前面 maxLength 个字符
|
||||
let truncatedString = inputString.substring(0, maxLength);
|
||||
// 添加省略号
|
||||
truncatedString += '...';
|
||||
return truncatedString;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user