How to ask yt-dlp for a file, and how to read what it answers. Pure — no process, no filesystem. command - opts -> argv vector interpret - a finished invocation -> Result<{:local-path .. :title ..}>
How to ask yt-dlp for a file, and how to read what it answers. Pure — no
process, no filesystem.
command - opts -> argv vector
interpret - a finished invocation -> Result<{:local-path .. :title ..}>(command uri
{:keys [binary dir format output-template max-bytes socket-timeout-s
retries cookies-from-browser extra-args]
:or {output-template default-output-template}})The argv that fetches uri into dir. --print implies quiet, so stdout
carries the template and nothing else.
opts: :binary :dir :format :output-template :max-bytes :socket-timeout-s :retries :cookies-from-browser :extra-args
The argv that fetches `uri` into `dir`. `--print` implies quiet, so stdout
carries the template and nothing else.
opts: :binary :dir :format :output-template :max-bytes :socket-timeout-s
:retries :cookies-from-browser :extra-argsBest video+audio muxed, falling back to the best single stream.
Best video+audio muxed, falling back to the best single stream.
(interpret uri {:keys [exit out err timed-out?]})A finished yt-dlp invocation becomes a Result. A printed after_move path wins over a non-zero exit: yt-dlp keeps the exit code of a stream-level error even when a fallback format landed the file. The adapter re-checks the path on disk. => (r/ok {:local-path .. :title .. :extension .. :duration-seconds ..}) | (r/err :error/fetch-timeout|:error/fetch-failed|:error/fetch-no-output {...})
A finished yt-dlp invocation becomes a Result. A printed after_move path
wins over a non-zero exit: yt-dlp keeps the exit code of a stream-level
error even when a fallback format landed the file. The adapter re-checks
the path on disk. => (r/ok {:local-path .. :title .. :extension ..
:duration-seconds ..})
| (r/err :error/fetch-timeout|:error/fetch-failed|:error/fetch-no-output {...})(interpret-probe {:keys [exit out timed-out?]})A finished probe becomes what the source measures, or an error the caller may ignore. Frame dimensions ride along only when the extractor knew them; a source that reports none still answers with its duration, so :width and :height are absent rather than nil. => (r/ok {:duration-seconds n :width px :height px}) | (r/err :error/probe-timeout|:error/probe-failed|:error/probe-no-duration)
A finished probe becomes what the source measures, or an error the caller
may ignore. Frame dimensions ride along only when the extractor knew them;
a source that reports none still answers with its duration, so :width and
:height are absent rather than nil.
=> (r/ok {:duration-seconds n :width px :height px})
| (r/err :error/probe-timeout|:error/probe-failed|:error/probe-no-duration)(parse-line out)The last tab-separated record yt-dlp printed. => map | nil. yt-dlp may emit several lines for one URL; the LAST one that parses wins. => {:local-path .. :title .. :extension .. :duration-seconds ..}
The last tab-separated record yt-dlp printed. => map | nil.
yt-dlp may emit several lines for one URL; the LAST one that parses wins.
=> {:local-path .. :title .. :extension .. :duration-seconds ..}(probe-command uri {:keys [binary socket-timeout-s]})The argv that asks how long uri is and how big its frames are, without
downloading it. --print implies quiet, so stdout carries the template and
nothing else.
opts: :binary :socket-timeout-s
The argv that asks how long `uri` is and how big its frames are, without downloading it. `--print` implies quiet, so stdout carries the template and nothing else. opts: :binary :socket-timeout-s
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |