Switch to android_vr player client — no Node.js required
android_vr provides pre-signed format URLs that bypass YouTube's n-challenge and signature JS requirements entirely. Tested: 23 video formats available without any JavaScript runtime installed. Reverts Node.js Dockerfile addition (which failed to build anyway). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,9 +2,7 @@ FROM python:3.12-slim
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y ffmpeg gosu nodejs && \
|
RUN apt-get update && apt-get install -y ffmpeg gosu && rm -rf /var/lib/apt/lists/*
|
||||||
ln -sf /usr/bin/nodejs /usr/bin/node && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
COPY backend/requirements.txt ./backend/requirements.txt
|
COPY backend/requirements.txt ./backend/requirements.txt
|
||||||
RUN pip install --no-cache-dir -r backend/requirements.txt && pip install --no-cache-dir -U yt-dlp
|
RUN pip install --no-cache-dir -r backend/requirements.txt && pip install --no-cache-dir -U yt-dlp
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ def ytdlp_test(
|
|||||||
"yt-dlp",
|
"yt-dlp",
|
||||||
"https://www.youtube.com/watch?v=dQw4w9WgXcQ",
|
"https://www.youtube.com/watch?v=dQw4w9WgXcQ",
|
||||||
"--dump-json", "--no-download", "--no-playlist",
|
"--dump-json", "--no-download", "--no-playlist",
|
||||||
"--extractor-args", "youtube:player_client=web",
|
"--extractor-args", "youtube:player_client=android_vr",
|
||||||
*cookie_args,
|
*cookie_args,
|
||||||
],
|
],
|
||||||
capture_output=True, text=True, timeout=30,
|
capture_output=True, text=True, timeout=30,
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ def fetch_video_metadata(video_id: str) -> dict | None:
|
|||||||
base_cmd = [
|
base_cmd = [
|
||||||
"yt-dlp", url,
|
"yt-dlp", url,
|
||||||
"--dump-json", "--no-download", "--no-playlist",
|
"--dump-json", "--no-download", "--no-playlist",
|
||||||
"--extractor-args", "youtube:player_client=web",
|
"--extractor-args", "youtube:player_client=android_vr",
|
||||||
]
|
]
|
||||||
stdout, stderr, code = _run([*base_cmd, *cookie_args], timeout=30)
|
stdout, stderr, code = _run([*base_cmd, *cookie_args], timeout=30)
|
||||||
if code != 0:
|
if code != 0:
|
||||||
@@ -567,7 +567,7 @@ def start_download(
|
|||||||
"--no-part", "--no-mtime",
|
"--no-part", "--no-mtime",
|
||||||
"-o", output_template,
|
"-o", output_template,
|
||||||
"--newline", "--progress", "--no-colors",
|
"--newline", "--progress", "--no-colors",
|
||||||
"--extractor-args", "youtube:player_client=web",
|
"--extractor-args", "youtube:player_client=android_vr",
|
||||||
*cookie_args,
|
*cookie_args,
|
||||||
],
|
],
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
|
|||||||
Reference in New Issue
Block a user