From d5ab223f138a90db82ee50662431b1ddca488b36 Mon Sep 17 00:00:00 2001 From: Lucas Gabriel Date: Sun, 29 Sep 2024 23:14:52 -0300 Subject: [PATCH] Download yt-dlp executable for Linux since using the native one isn't helping too much... --- plugins/ytdlp-wrapper.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/plugins/ytdlp-wrapper.js b/plugins/ytdlp-wrapper.js index e11c3eb..8d2298e 100644 --- a/plugins/ytdlp-wrapper.js +++ b/plugins/ytdlp-wrapper.js @@ -6,27 +6,18 @@ const os = require('os'); const downloadDir = path.resolve(__dirname, 'yt-dlp'); const urls = { + linux: 'https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp', win32: 'https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.exe', darwin: 'https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_macos', }; function getDownloadUrl() { const platform = os.platform(); - return urls[platform]; + return urls[platform] || urls.linux; }; async function downloadYtDlp() { - if (os.platform() === 'linux') { - console.log('Skipping yt-dlp download on Linux. It should be installed via pip.'); - return; - } - const url = getDownloadUrl(); - if (!url) { - console.error('Unsupported platform for yt-dlp download.'); - return; - } - const fileName = url.split('/').pop(); const filePath = path.join(downloadDir, fileName);