mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 08:09:19 +00:00
🎈pref:多线程下载支持tiktok
This commit is contained in:
parent
c035c25c16
commit
fbce4bf46e
@ -620,7 +620,7 @@ export class tools extends plugin {
|
||||
await checkAndRemoveFile(path + "/temp.mp4");
|
||||
const title = ytDlpGetTilt(url, isOversea, this.myProxy);
|
||||
e.reply(`${ this.identifyPrefix }识别:TikTok,视频下载中请耐心等待 \n${ title }`);
|
||||
await ytDlpHelper(path, cleanedTiktokUrl, isOversea, this.myProxy);
|
||||
await ytDlpHelper(path, cleanedTiktokUrl, isOversea, this.myProxy, this.videoDownloadConcurrency);
|
||||
await this.sendVideoToUpload(e, `${ path }/temp.mp4`);
|
||||
return true;
|
||||
}
|
||||
@ -1973,7 +1973,7 @@ export class tools extends plugin {
|
||||
} else {
|
||||
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, this.videoDownloadConcurrency);
|
||||
await ytDlpHelper(path, url, isOversea, this.myProxy, this.videoDownloadConcurrency, true, graphics, timeRange);
|
||||
this.sendVideoToUpload(e, `${ path }/temp.mp4`);
|
||||
} catch (error) {
|
||||
logger.error(error);
|
||||
|
@ -330,7 +330,7 @@ export function supportGuoba() {
|
||||
field: "tools.videoDownloadConcurrency",
|
||||
label: "(高级)下载并发个数",
|
||||
bottomHelpMessage:
|
||||
"【涉及哔哩哔哩、抖音、YouTuBe】下载并发个数:与【允许多用户下载个数】不同,这个功能影响下载速度。默认是1表示不使用,使用根据服务器性能进行选择,如果不确定是否可以用1即可,高性能服务器随意4~12都可以,看CPU的实力",
|
||||
"【涉及哔哩哔哩、抖音、YouTuBe、tiktok】下载并发个数:与【允许多用户下载个数】不同,这个功能影响下载速度。默认是1表示不使用,使用根据服务器性能进行选择,如果不确定是否可以用1即可,高性能服务器随意4~12都可以,看CPU的实力",
|
||||
component: "InputNumber",
|
||||
required: false,
|
||||
componentProps: {
|
||||
|
@ -56,13 +56,13 @@ export function ytDlpGetThumbnail(path, url, isOversea, proxy) {
|
||||
* @param timeRange 截取时间段
|
||||
* @param maxThreads 最大线程数
|
||||
*/
|
||||
export async function ytDlpHelper(path, url, isOversea, proxy, merge = false, graphics, timeRange, maxThreads) {
|
||||
export async function ytDlpHelper(path, url, isOversea, proxy, maxThreads, merge = false, graphics, timeRange) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const mergeOption = merge ? '--merge-output-format "mp4"' : '';
|
||||
|
||||
const fParam = url.includes("youtu") ? `--download-sections "*${timeRange}" -f "bv${graphics}[ext=mp4]+ba[ext=m4a]" --concurrent-fragments ${maxThreads} ` : "";
|
||||
const fParam = url.includes("youtu") ? `--download-sections "*${timeRange}" -f "bv${graphics}[ext=mp4]+ba[ext=m4a]" ` : "";
|
||||
|
||||
const command = `yt-dlp ${fParam} ${constructProxyParam(isOversea, proxy)} -P ${path} -o "temp.%(ext)s" ${url}`;
|
||||
const command = `yt-dlp ${fParam} --concurrent-fragments ${maxThreads} ${constructProxyParam(isOversea, proxy)} -P ${path} -o "temp.%(ext)s" ${url}`;
|
||||
|
||||
logger.info(`[R插件][yt-dlp审计] ${command}`)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user