Expand description
ODL — Open-source Download Library and CLI
This crate provides a flexible, resumable, and configurable download manager with a small CLI and library API. Intended for use as both a library and a standalone binary. Public types and modules expose the high-level API used by applications:
Download— primary download instruction type (create viafrom_response_infoorfrom_metadata).download_manager— higher-level operations to evaluate and run downloads.config— persistent configuration for the manager.
Example (library usage):
use odl::{Download, download_manager::DownloadManager, config::Config};
// create a `DownloadManager` with default `Config` and call `evaluate`/`download`.§Feature flags and process spawning
The default feature set targets the odl binary: it pulls in the CLI and
the ytdlp engine, which delegates known media hosts to an externally
installed yt-dlp. That makes download_manager::DownloadManager::evaluate
able to fork and exec a helper process, which matters if you embed odl
somewhere that cannot or should not do that — a sandboxed desktop app
(macOS App Sandbox, Flatpak), a hardened server, or anywhere evaluate
is expected to cost one HTTP round-trip rather than a full extraction.
Library consumers should therefore opt in deliberately:
# Pure library: no CLI dependencies, no engine that spawns anything.
odl = { version = "3", default-features = false }
# Library plus media-site support.
odl = { version = "3", default-features = false, features = ["ytdlp"] }§Public dependencies
Types from other crates appear in odl’s API, which means a consumer has to
resolve a compatible version of those crates to pass them: url::Url,
http::HeaderMap, chrono::DateTime, prost’s generated types in
proto, and tokio’s AcquireError. Every one of them is a declared
dependency, so the version to match is visible in odl’s manifest.
Which HTTP client odl downloads with is deliberately not on that list.
Two runtime switches exist as well, for builds that do include the feature:
set enabled = false on config::YtdlpOptions, or pass
engine::EnginePreference::Engine with the HTTP engine on an individual
request. Read the security notes on config::YtdlpOptions before
accepting a Config from anywhere but your own code.
Re-exports§
pub use proto::download_metadata;
Modules§
- config
- conflict
- credentials
- download_
manager - engine
- Engine selection and the capability surface that distinguishes engines.
- error
- format
- Choosing which media format to download.
- hash
- progress
- Progress reporting and cancellation primitives.
- proto
- self_
update - Replacing odl’s own binary with the latest GitHub release.
- user_
agents - ytdlp
- Delegation of downloads to an externally installed
yt-dlp.
Structs§
- Download
- Represents a download instruction.
- Ytdlp
Spec - Inputs for
Download::from_ytdlp, gathered by the delegating engine during extraction.