Skip to main content

haki_dl/
lib.rs

1//! Library-first downloader API.
2
3#![deny(unsafe_code)]
4#![deny(clippy::expect_used)]
5#![deny(clippy::panic)]
6#![deny(clippy::todo)]
7#![deny(clippy::unimplemented)]
8#![deny(clippy::unwrap_used)]
9
10pub mod api;
11mod attribute;
12pub mod backend;
13mod base64;
14pub mod cancellation;
15pub mod cli;
16pub mod config;
17mod console;
18pub mod dash;
19mod datetime;
20pub mod decrypt;
21pub mod download;
22pub mod error;
23pub mod event;
24pub mod hardening;
25pub mod hls;
26pub mod http;
27#[cfg(feature = "cli")]
28mod interactive_prompt;
29pub mod live;
30pub mod manifest;
31mod media_info;
32pub mod mss;
33pub mod mux;
34mod numeric;
35pub mod observability;
36pub mod processor;
37pub mod progress;
38#[cfg(feature = "rpc")]
39pub mod rpc;
40pub mod selection;
41pub mod session;
42pub mod source;
43mod stream_label;
44pub mod subtitle;
45pub mod traits;
46
47pub use api::{DownloadClient, DownloadRequest, LiveRecorder, ProgressCallback};
48pub use backend::{BackendPolicy, BackendSelection, Mp4BackendPolicy};
49pub use cancellation::CancellationToken;
50pub use cli::{
51    CLI_SCHEMA, CliApiBinding, CliOptionSchema, CliParseResult, CliSchemaValueKind, parse_args,
52};
53pub use config::{
54    CompatibilityProfile, CustomKey, CustomRange, DecryptionEngine, DownloadOptions, HlsMethod,
55    LogLevel, MuxAfterDoneOptions, MuxerKind, StreamFilter, SubtitleFormat, TaskStartAt,
56    UiLanguage,
57};
58pub use dash::{DashManifest, DashParser};
59pub use decrypt::{
60    ExternalDecryptPlan, ExternalDecryptRequest, Mp4ProtectionInfo, PsshInfo, PsshSystem,
61    SelectedKey, aes_128_cbc_decrypt, aes_128_ecb_decrypt, chacha20_decrypt_per_1024_bytes,
62    custom_keys_to_pairs, decrypt_hls_segment_bytes, decrypt_hls_segment_file,
63    plan_external_decrypt, read_mp4_protection_info, redact_secrets, search_key_text_file,
64    select_key_pair,
65};
66pub use download::{
67    DownloadMergePolicy, DownloadScheduler, SegmentDownloadResult, SegmentDownloader, SpeedState,
68    StreamDownloadResult, cleanup_after_success, merge_policy_for_stream, planned_output_path,
69    split_large_single_file_by_size, stream_output_extension, stream_temp_dir,
70};
71pub use error::{Error, Result};
72pub use event::ProgressEvent;
73pub use hardening::{
74    BenchmarkMetric, BoundedEventQueue, ResourceLimits, contains_unredacted_secret,
75    estimate_segment_count, redact_and_verify, scan_unchecked_exit_paths, validate_cleanup_paths,
76    validate_manifest_size, validate_resource_limits,
77};
78pub use hls::{HlsManifest, HlsParser};
79pub use http::{DefaultHttpClient, HttpRequest, HttpResponse, ProxyMode};
80pub use live::{
81    HttpLiveTsState, LiveIdentityMode, LiveOptionEffects, LiveRefreshResult, LiveStreamState,
82    add_recorded_duration, compute_live_wait_seconds, filter_new_live_segments,
83    live_option_effects, live_segment_name, plan_live_pipe_mux, sync_live_startup_windows,
84    update_http_live_ts_state,
85};
86pub use manifest::{
87    ByteRange, Choice, EncryptionInfo, EncryptionMethod, ExtractorType, KeySource, Manifest,
88    MediaPart, MediaSegment, MediaType, MssData, Playlist, RoleType, Stream, StreamSelector,
89    audio_channel_order, compare_streams_compatible, sort_streams_compatible,
90};
91pub use mss::{MssGeneratedInit, MssInitGenerator, MssManifest, MssParser};
92pub use mux::{
93    FfmpegMergeMetadata, FfmpegMergeRequest, MediaInfo, MergeOutputFormat, Mp4forgeSupport,
94    Mp4forgeSupportMatrix, MuxCommandPlan, MuxFormat, MuxImport, MuxOptions, OutputArtifact,
95    OutputFile, combine_files, merge_extension, mp4forge_support_for_stream, mux_extension,
96    output_files_with_imports, partial_combine_files, plan_ffmpeg_merge, plan_ffmpeg_mux,
97    plan_mkvmerge_mux, validate_mp4forge_merge_request, validate_mp4forge_mux_after_done,
98};
99pub use observability::{
100    DEFAULT_UPDATE_CHECK_URL, LogFilePlan, LogPlanConfig, ProgressEventCollector, ProgressSummary,
101    UpdateCheckClient, UpdateCheckHttpClient, UpdateCheckResult, append_log_file,
102    check_update_with_client, format_duration, format_file_size, initialize_log_file,
103    latest_version_from_release_redirect, plan_log_file, redact_progress_event, should_log,
104    spawn_update_check_if_enabled, streams_metadata_json, summarize_events, write_metadata_jsons,
105};
106pub use processor::{
107    ContentProcessor, DEFAULT_USER_AGENT, DefaultDashContentProcessor, DefaultHlsContentProcessor,
108    DefaultHlsKeyProcessor, DefaultUrlProcessor, KeyProcessor, ParserConfig,
109    SignedDashUrlProcessor, UrlProcessor, compatibility_headers, resolve_media_url,
110    signed_dash_secure_value,
111};
112pub use progress::{AggregateProgress, SegmentProgress, StreamProgress};
113pub use selection::{
114    apply_custom_range, apply_stream_filters, auto_select_streams, clean_ad_segments, filter_drop,
115    filter_keep, format_save_pattern, handle_file_collision, handle_file_collision_with_reserved,
116    interactive_default_streams, order_streams, save_name_from_input,
117    save_name_from_input_with_suffix, subtitle_only_streams, valid_file_name,
118};
119pub use session::{DownloadSession, SessionState};
120pub use source::{LoadedSource, LoadedSourceKind, SourceLoader, write_raw_files};
121pub use subtitle::{
122    SubtitleCue, SubtitleImage, WebVttSubtitle, check_stpp_init, check_wvtt_init,
123    extract_stpp_from_files, extract_stpp_from_segments, extract_ttml_documents,
124    extract_ttml_from_files, extract_wvtt_from_files, extract_wvtt_from_segments, format_subtitle,
125    parse_webvtt, parse_webvtt_bytes, write_image_pngs,
126};