mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
🎈pref:优化YouTuBe支持多线程下载
This commit is contained in:
parent
240d042455
commit
233e0fdd5d
@ -283,6 +283,8 @@ export class tools extends plugin {
|
|||||||
this.biliResolution = this.toolsConfig.biliResolution;
|
this.biliResolution = this.toolsConfig.biliResolution;
|
||||||
// 加载youtube的限制时长
|
// 加载youtube的限制时长
|
||||||
this.youtubeDuration = this.toolsConfig.youtubeDuration
|
this.youtubeDuration = this.toolsConfig.youtubeDuration
|
||||||
|
// 加载youtube下载最大线程数
|
||||||
|
this.youtubemaxThreads = this.toolsConfig.youtubemaxThreads
|
||||||
// 加载油管下载画质选项
|
// 加载油管下载画质选项
|
||||||
this.YouTubeGraphicsOptions = this.toolsConfig.YouTubeGraphicsOptions
|
this.YouTubeGraphicsOptions = this.toolsConfig.YouTubeGraphicsOptions
|
||||||
// 加载抖音Cookie
|
// 加载抖音Cookie
|
||||||
@ -1973,7 +1975,7 @@ export class tools extends plugin {
|
|||||||
} else {
|
} else {
|
||||||
e.reply([segment.image(`${ path }/thumbnail.png`),`${ this.identifyPrefix }识别:油管,视频下载中请耐心等待 \n视频标题:${ title }\n视频时长:${(Duration / 60).toFixed(2).replace(/\.00$/, '')} 分钟`]);
|
e.reply([segment.image(`${ path }/thumbnail.png`),`${ this.identifyPrefix }识别:油管,视频下载中请耐心等待 \n视频标题:${ title }\n视频时长:${(Duration / 60).toFixed(2).replace(/\.00$/, '')} 分钟`]);
|
||||||
}
|
}
|
||||||
await ytDlpHelper(path, url, isOversea, this.myProxy, true, graphics, timeRange);
|
await ytDlpHelper(path, url, isOversea, this.myProxy, true, graphics, timeRange, this.youtubemaxThreads);
|
||||||
this.sendVideoToUpload(e, `${ path }/temp.mp4`);
|
this.sendVideoToUpload(e, `${ path }/temp.mp4`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(error);
|
logger.error(error);
|
||||||
|
@ -29,6 +29,7 @@ neteaseCloudAudioQuality: exhigh # 网易云解析最高音质 默认exhigh(极
|
|||||||
|
|
||||||
YouTubeGraphicsOptions: 720 # YouTobe的下载画质,0为原画,1080,720,480,自定义画面高度(默认为720)
|
YouTubeGraphicsOptions: 720 # YouTobe的下载画质,0为原画,1080,720,480,自定义画面高度(默认为720)
|
||||||
youtubeDuration: 300 # YouTobe限制的最大视频时长(默认5分钟),单位:秒
|
youtubeDuration: 300 # YouTobe限制的最大视频时长(默认5分钟),单位:秒
|
||||||
|
youtubemaxThreads: 1 # YouTobe下载最大线程数 默认1
|
||||||
|
|
||||||
douyinCookie: '' # douyin's cookie, 格式:odin_tt=xxx;passport_fe_beating_status=xxx;sid_guard=xxx;uid_tt=xxx;uid_tt_ss=xxx;sid_tt=xxx;sessionid=xxx;sessionid_ss=xxx;sid_ucp_v1=xxx;ssid_ucp_v1=xxx;passport_assist_user=xxx;ttwid=xxx;
|
douyinCookie: '' # douyin's cookie, 格式:odin_tt=xxx;passport_fe_beating_status=xxx;sid_guard=xxx;uid_tt=xxx;uid_tt_ss=xxx;sid_tt=xxx;sessionid=xxx;sessionid_ss=xxx;sid_ucp_v1=xxx;ssid_ucp_v1=xxx;passport_assist_user=xxx;ttwid=xxx;
|
||||||
douyinCompression: true # true-压缩,false-不压缩;是否使用压缩视频格式的抖音(默认使用),使用后加速视频发送
|
douyinCompression: true # true-压缩,false-不压缩;是否使用压缩视频格式的抖音(默认使用),使用后加速视频发送
|
||||||
|
@ -231,6 +231,17 @@ export function supportGuoba() {
|
|||||||
placeholder: "请输入YouTuBe视频最大时长限制(默认5分钟)",
|
placeholder: "请输入YouTuBe视频最大时长限制(默认5分钟)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: "tools.youtubemaxThreads",
|
||||||
|
label: "YouTuBe最大下载线程",
|
||||||
|
bottomHelpMessage:
|
||||||
|
"默认为 1,请根据自己的服务器调节,一定程度上缓解切片下载慢的问题",
|
||||||
|
component: "InputNumber",
|
||||||
|
required: false,
|
||||||
|
componentProps: {
|
||||||
|
placeholder: "请输入YouTuBe最大下载线程",
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: "tools.YouTubeGraphicsOptions",
|
field: "tools.YouTubeGraphicsOptions",
|
||||||
label: "YouTube最高分辨率",
|
label: "YouTube最高分辨率",
|
||||||
|
@ -54,12 +54,13 @@ export function ytDlpGetThumbnail(path, url, isOversea, proxy) {
|
|||||||
* @param merge 是否合并输出为 mp4 格式 (仅适用于视频合并需求)
|
* @param merge 是否合并输出为 mp4 格式 (仅适用于视频合并需求)
|
||||||
* @param graphics YouTube画质参数
|
* @param graphics YouTube画质参数
|
||||||
* @param timeRange 截取时间段
|
* @param timeRange 截取时间段
|
||||||
|
* @param maxThreads 最大线程数
|
||||||
*/
|
*/
|
||||||
export async function ytDlpHelper(path, url, isOversea, proxy, merge = false, graphics, timeRange) {
|
export async function ytDlpHelper(path, url, isOversea, proxy, merge = false, graphics, timeRange, maxThreads) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const mergeOption = merge ? '--merge-output-format "mp4"' : '';
|
const mergeOption = merge ? '--merge-output-format "mp4"' : '';
|
||||||
|
|
||||||
const fParam = url.includes("youtu") ? `--download-sections "*${timeRange}" -f "bv${graphics}[ext=mp4]+ba[ext=m4a]"` : "";
|
const fParam = url.includes("youtu") ? `--download-sections "*${timeRange}" -f "bv${graphics}[ext=mp4]+ba[ext=m4a]" --concurrent-fragments ${maxThreads} ` : "";
|
||||||
|
|
||||||
const command = `yt-dlp ${fParam} ${constructProxyParam(isOversea, proxy)} -P ${path} -o "temp.%(ext)s" ${url}`;
|
const command = `yt-dlp ${fParam} ${constructProxyParam(isOversea, proxy)} -P ${path} -o "temp.%(ext)s" ${url}`;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user