From 340727ae602139ad50cdac2b270b197c781d50be Mon Sep 17 00:00:00 2001 From: SileNce5k Date: Wed, 18 Jun 2025 00:14:10 +0200 Subject: [PATCH] dl: Add cookie file --- commands/misc/dl.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commands/misc/dl.js b/commands/misc/dl.js index 1de49e8..3752e59 100644 --- a/commands/misc/dl.js +++ b/commands/misc/dl.js @@ -10,6 +10,7 @@ module.exports = { ], async execute({message, args}) { const downloadsDir = path.resolve(process.cwd(), 'data', 'downloads', Math.floor(new Date).toString()); + const cookieFilepath = path.resolve(process.cwd(), 'data', 'cookies.txt') fs.mkdirSync(downloadsDir, {recursive: true}); let url; @@ -28,13 +29,13 @@ module.exports = { return message.channel.send("No url provided") } - if(this.executeCommand(`yt-dlp "${url}" -P ${downloadsDir}`).error){ + if(this.executeCommand(`yt-dlp "${url}" -P ${downloadsDir} --cookies ${cookieFilepath}`).error){ message.channel.send("An error occured when executing the command"); this.cleanUp(downloadsDir); return; } - + let files = fs.readdirSync(downloadsDir); if(files < 1) { this.cleanUp(downloadsDir);