rc-plugin/utils/yt-dlp-util.js
zhiyu1998 ceb242dfa8 feat: 1.8.0-beta 更新
更新内容如下:
1. 添加小飞机解析
2. 添加信任用户
2024-08-13 16:20:09 +08:00

21 lines
731 B
JavaScript

/**
* yt-dlp工具类
* @returns {Promise<void>}
* @param path 下载路径
* @param url 下载链接
* @param isOversea 是否是海外用户
*/
export async function dy2b(path, url, isOversea) {
return new Promise((resolve, reject) => {
const command = `yt-dlp ${ isOversea ? "" : `--proxy ${ this.myProxy }` } -P ${ path } -o "temp.%(ext)s" --merge-output-format "mp4" ${ url }`;
exec(command, (error, stdout) => {
if (error) {
console.error(`Error executing command: ${ error }`);
reject(error);
} else {
console.log(`Command output: ${ stdout }`);
resolve(stdout);
}
});
});
}