Add support for yt-dlp with NodeJS

This commit is contained in:
2025-12-04 00:16:04 +03:00
parent 0cb7045e7a
commit 907d6b521f
2 changed files with 27 additions and 1 deletions

View File

@@ -158,6 +158,19 @@ async def download_media(
'ignoreerrors': False,
}
# Check if Node.js is available for JS extraction (required for Instagram, TikTok, etc.)
import shutil
nodejs_path = shutil.which('node')
if nodejs_path:
logger.debug(f"Node.js found at: {nodejs_path}. JS extraction will be available.")
# yt-dlp will automatically use Node.js if available
# Optionally, we can explicitly set it via extractor_args if needed
else:
logger.warning(
"Node.js not found. Some sites (Instagram, TikTok, etc.) may require JS extraction. "
"Install Node.js for full functionality."
)
# Add cookies if specified (for Instagram and other sites)
if cookies_file:
# Resolve cookies file path (support relative and absolute paths)