From 2ca9be67d727f52c3264156d6408df7b8624f779 Mon Sep 17 00:00:00 2001 From: bobzel Date: Thu, 15 Sep 2022 13:17:42 -0400 Subject: again... --- src/server/DashUploadUtils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/DashUploadUtils.ts b/src/server/DashUploadUtils.ts index 85e197e25..c66e932dd 100644 --- a/src/server/DashUploadUtils.ts +++ b/src/server/DashUploadUtils.ts @@ -102,7 +102,7 @@ export namespace DashUploadUtils { export function uploadYoutube(videoId: string): Promise { return new Promise>((res, rej) => { console.log('Uploading YouTube video: ' + videoId); - exec('youtube-dl -o ' + (videoId.replace(/^-/, '__') + '.mp4') + " 'https://www.youtube.com/watch?v=" + videoId + "' -f 'mp4[filesize<5M]/bestvideo[filesize<5M]+bestaudio/bestvideo+bestaudio'", (error: any, stdout: any, stderr: any) => { + exec('youtube-dl -o ' + (videoId.replace(/^-/, '__') + '.mp4') + ' "https://www.youtube.com/watch?v=' + videoId + '" -f "mp4[filesize<5M]/bestvideo[filesize<5M]+bestaudio/bestvideo+bestaudio"', (error: any, stdout: any, stderr: any) => { if (error) { console.log(`error: Error: ${error.message}`); res({ @@ -116,7 +116,7 @@ export namespace DashUploadUtils { result: { name: 'failed youtube query', message: `Could not upload YouTube video (${videoId}). Error: ${error.message}` }, }); } else { - exec('youtube-dl -o ' + (videoId.replace(/^-/, '__') + '.mp4') + " 'https://www.youtube.com/watch?v=" + videoId + "' --get-duration", (error: any, stdout: any, stderr: any) => { + exec('youtube-dl -o ' + (videoId.replace(/^-/, '__') + '.mp4') + ' "https://www.youtube.com/watch?v=' + videoId + '" --get-duration', (error: any, stdout: any, stderr: any) => { const time = Array.from(stdout.trim().split(':')).reverse(); const duration = (time.length > 2 ? Number(time[2]) * 1000 * 60 : 0) + (time.length > 1 ? Number(time[1]) * 60 : 0) + (time.length > 0 ? Number(time[0]) : 0); const data = { size: 0, path: videoId.replace(/^-/, '__') + '.mp4', name: videoId, type: 'video/mp4' }; -- cgit v1.2.3-70-g09d2