🎈 pref: 修复dy2b迁移后导致的问题

This commit is contained in:
zhiyu1998 2024-08-15 12:49:46 +08:00
parent d54251e089
commit 84ca256183
2 changed files with 3 additions and 3 deletions

View File

@ -1369,7 +1369,7 @@ export class tools extends plugin {
await checkAndRemoveFile(path + "/temp.mp4") await checkAndRemoveFile(path + "/temp.mp4")
const title = execSync(`yt-dlp --get-title ${ url } ${ isOversea ? "" : `--proxy ${ this.myProxy }` }`) const title = execSync(`yt-dlp --get-title ${ url } ${ isOversea ? "" : `--proxy ${ this.myProxy }` }`)
e.reply(`识别:油管,视频下载中请耐心等待 \n${ title }`); e.reply(`识别:油管,视频下载中请耐心等待 \n${ title }`);
await dy2b(path, url, isOversea); await dy2b(path, url, isOversea, this.myProxy);
this.sendVideoToUpload(e, `${ path }/temp.mp4`); this.sendVideoToUpload(e, `${ path }/temp.mp4`);
} catch (error) { } catch (error) {
console.error(error); console.error(error);

View File

@ -5,9 +5,9 @@
* @param url 下载链接 * @param url 下载链接
* @param isOversea 是否是海外用户 * @param isOversea 是否是海外用户
*/ */
export async function dy2b(path, url, isOversea) { export async function dy2b(path, url, isOversea, proxy) {
return new Promise((resolve, reject) => { 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) => { exec(command, (error, stdout) => {
if (error) { if (error) {
console.error(`Error executing command: ${ error }`); console.error(`Error executing command: ${ error }`);