Fix dynamic YouTube cookies detection

Allow cookies uploaded after server start to be detected by checking
process.env.YOUTUBE_COOKIES_PATH dynamically instead of relying only
on the cached COOKIES_PATH constant.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
debian.StillHammer 2025-12-09 09:24:57 +00:00
parent 14706e2589
commit 4bb8b85c0e

View File

@ -69,7 +69,8 @@ function addCookiesArg(args, cookiesPath = null) {
} }
// Option 2: Use static cookies file (may expire) // Option 2: Use static cookies file (may expire)
const cookies = cookiesPath || COOKIES_PATH; // Check dynamically in case cookies were uploaded after server started
const cookies = cookiesPath || process.env.YOUTUBE_COOKIES_PATH || COOKIES_PATH;
if (cookies && fs.existsSync(cookies)) { if (cookies && fs.existsSync(cookies)) {
console.log(`Using cookies file: ${cookies}`); console.log(`Using cookies file: ${cookies}`);
return ['--cookies', cookies, ...args]; return ['--cookies', cookies, ...args];