diff --git a/Dockerfile b/Dockerfile index 330e6ba..2835ea6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ FROM python:3.11-slim WORKDIR /app -# Install FFmpeg and OpenCV dependencies +# Install FFmpeg, OpenCV dependencies, and Node.js (for yt-dlp JS challenges) RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg \ libgl1 \ @@ -29,6 +29,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libsm6 \ libxext6 \ libxrender1 \ + nodejs \ && rm -rf /var/lib/apt/lists/* # Copy virtual env from builder diff --git a/main.py b/main.py index 6035e8d..8a181e8 100644 --- a/main.py +++ b/main.py @@ -487,7 +487,8 @@ def download_youtube_video(url, output_dir="."): 'socket_timeout': 30, 'retries': 10, 'nocheckcertificate': True, - 'user_agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36' + 'extractor_args': {'youtube': {'player_client': ['android', 'web']}}, + 'user_agent': 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36' } with yt_dlp.YoutubeDL(ydl_opts_info) as ydl: