修复解析 YouTube 视频信息时阻塞主进程,提高机器人响应新消息的及时性。

This commit is contained in:
CSSZYF 2025-06-03 20:41:13 +08:00 committed by GitHub
parent 1523287649
commit 0d7fbe63be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -641,7 +641,7 @@ export class tools extends plugin {
// 下载逻辑
const path = this.getCurDownloadPath(e);
await checkAndRemoveFile(path + "/temp.mp4");
const title = ytDlpGetTilt(url, isOversea, this.myProxy);
const title = await ytDlpGetTilt(url, isOversea, this.myProxy);
e.reply(`${ this.identifyPrefix }识别TikTok视频下载中请耐心等待 \n${ title }`);
await ytDlpHelper(path, cleanedTiktokUrl, isOversea, this.myProxy, this.videoDownloadConcurrency);
await this.sendVideoToUpload(e, `${ path }/temp.mp4`);
@ -2150,7 +2150,7 @@ export class tools extends plugin {
await checkAndRemoveFile(path + "/temp.flac");
await checkAndRemoveFile(path + "/thumbnail.png");
await ytDlpGetThumbnail(path, url, isOversea, this.myProxy, this.youtubeCookiePath);
const title = ytDlpGetTilt(url, isOversea, this.myProxy, this.youtubeCookiePath).toString().replace(/\n/g, '');
const title = (await ytDlpGetTilt(url, isOversea, this.myProxy, this.youtubeCookiePath)).toString().replace(/\n/g, '');
// 音频逻辑
if (url.includes("music")) {
@ -2168,7 +2168,7 @@ export class tools extends plugin {
}
// 下面为视频逻辑
const Duration = convertToSeconds(ytDlpGetDuration(url, isOversea, this.myProxy, this.youtubeCookiePath).toString().replace(/\n/g, ''));
const Duration = convertToSeconds((await ytDlpGetDuration(url, isOversea, this.myProxy, this.youtubeCookiePath)).toString().replace(/\n/g, ''));
// logger.info('时长------',Duration)
if (Duration > this.youtubeDuration) {
e.reply([