Skip to main content

Crate odl

Crate odl 

Source
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 via from_response_info or from_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 = "2", default-features = false }

# Library plus media-site support.
odl = { version = "2", default-features = false, features = ["ytdlp"] }

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.
YtdlpSpec
Inputs for Download::from_ytdlp, gathered by the delegating engine during extraction.