From 84ca25618392242239badae6860347e57f880478 Mon Sep 17 00:00:00 2001 From: zhiyu1998 <542716863@qq.com> Date: Thu, 15 Aug 2024 12:49:46 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=88=20pref:=20=E4=BF=AE=E5=A4=8D`dy2b`?= =?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=90=8E=E5=AF=BC=E8=87=B4=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/tools.js | 2 +- utils/yt-dlp-util.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/tools.js b/apps/tools.js index ffe2e26..3ee887d 100644 --- a/apps/tools.js +++ b/apps/tools.js @@ -1369,7 +1369,7 @@ export class tools extends plugin { await checkAndRemoveFile(path + "/temp.mp4") const title = execSync(`yt-dlp --get-title ${ url } ${ isOversea ? "" : `--proxy ${ this.myProxy }` }`) e.reply(`识别:油管,视频下载中请耐心等待 \n${ title }`); - await dy2b(path, url, isOversea); + await dy2b(path, url, isOversea, this.myProxy); this.sendVideoToUpload(e, `${ path }/temp.mp4`); } catch (error) { console.error(error); diff --git a/utils/yt-dlp-util.js b/utils/yt-dlp-util.js index cc2a748..585ff25 100644 --- a/utils/yt-dlp-util.js +++ b/utils/yt-dlp-util.js @@ -5,9 +5,9 @@ * @param url 下载链接 * @param isOversea 是否是海外用户 */ -export async function dy2b(path, url, isOversea) { +export async function dy2b(path, url, isOversea, proxy) { return new Promise((resolve, reject) => { - const command = `yt-dlp ${ isOversea ? "" : `--proxy ${ this.myProxy }` } -P ${ path } -o "temp.%(ext)s" --merge-output-format "mp4" ${ url }`; + const command = `yt-dlp ${ isOversea ? "" : `--proxy ${ proxy }` } -P ${ path } -o "temp.%(ext)s" --merge-output-format "mp4" ${ url }`; exec(command, (error, stdout) => { if (error) { console.error(`Error executing command: ${ error }`);