Merge pull request #34 from nikoyoke1/master

🎈pref:多线程下载支持tiktok
This commit is contained in:
Zhiyu 2024-10-17 22:42:50 +08:00 committed by GitHub
commit f03241f386
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 6 deletions

View File

@ -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);

View File

@ -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: {

View File

@ -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}`)