Module ytdlp

Source
Expand description

URL import: download media from a link with yt-dlp.exe, the same child-process pattern ffpipe.rs uses for ffmpeg. Entirely optional — exe() returns None when yt-dlp is not installed and the Library then hides its “Import URL…” button.

yt-dlp is driven with --print after_move:filepath (prints the final file, and because a later stage is named it does not imply --simulate) plus --progress --newline --progress-template so progress and the resulting path both arrive as lines on stdout.

Structs§

Download
A running download. progress drives the UI (and progress.cancel kills yt-dlp); path() is the downloaded file once progress.is_done() with no error.
DownloadOptions

Statics§

CACHE 🔒
DIR 🔒

Functions§

annotate_if_outdated 🔒
yt-dlp’s own stderr, tacking on an update hint when the message is one it (or YouTube’s bot-check) prints for a stale extractor — these are real yt-dlp errors, not ours, but “install a newer yt-dlp” is the actual fix often enough that it is worth saying plainly instead of leaving the user to guess.
default_dir
Where downloads go by default: the user’s Videos folder, else the temp dir.
exe
The best working yt-dlp.exe, or None when none is installed (the URL import is hidden then).
parse_percent 🔒
Percent from a dl: progress line (“dl: 45.2%” → 0.452). None for any other line.
run 🔒
set_dir
Set the user-configured yt-dlp directory (“” = app dir, then PATH).
start_download
version 🔒
This exe’s version string (“2026.08.19”), or None if it does not actually run (a broken shim exits non-zero and prints nothing).