try fix youtube download
This commit is contained in:
parent
479ef8a188
commit
79d672b918
2 changed files with 4 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
3
main.py
3
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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue