feat: gate download options on real-time yt-dlp video analysis

Options (quality, subtitles) are now derived from a yt-dlp -J probe of
the submitted URL instead of a static list, so users can't pick
combinations the source video doesn't actually support. Submission is
blocked until the probe succeeds.

- New /api/probe endpoint + src/lib/ytdlp-probe.ts, with its own rate
  limiter (rate-limit.ts refactored into a createRateLimiter factory).
- New options: subtitle language selection, clip start/end trim, MP3
  audio quality.
- Fixed buildYtdlpArgs: format=mp3 never triggered audio extraction
  (-x/--audio-format), and quality=best never applied --merge-output-format,
  so the chosen container had no real effect.
- Cross-platform yt-dlp invocation: the bundled bin/yt-dlp is a Python
  zipapp relying on a shebang, which Windows' spawn() can't run
  directly. buildYtdlpCommand() runs it through `python` on Windows and
  execs it directly on Linux/o2switch, where the shebang works natively.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-11 14:13:38 +02:00
co-authored by Claude Sonnet 5
parent f949566f76
commit 27ba48d181
23 changed files with 897 additions and 111 deletions
+12 -2
View File
@@ -9,13 +9,23 @@
"urlLabel": "Video URL",
"format": "Format",
"quality": "Quality",
"subtitles": "Subtitles (fr, en)",
"subtitles": "Subtitles",
"subtitleLanguages": "Subtitle languages",
"advanced": "Advanced options",
"formats": "mp4 · mp3 · webm · mkv",
"submit": "Download",
"submitting": "Sending...",
"errorRateLimit": "Too many submissions. Try again in an hour.",
"errorGeneric": "Submission error."
"errorGeneric": "Submission error.",
"analyzing": "Analyzing video...",
"probeError": "Couldn't analyze this video. Check the link or try again.",
"retry": "Retry",
"audioOnlySource": "Audio-only source",
"clipRange": "Clip (optional)",
"clipStart": "Start (s)",
"clipEnd": "End (s)",
"audioQuality": "Audio quality",
"videoLength": "Length: {duration}"
},
"status": {
"heading": "Download status",