From 69652781d777908f97372e97a87ceeaea3a42273 Mon Sep 17 00:00:00 2001 From: luqmanishere Date: Wed, 15 Dec 2021 21:41:33 +0800 Subject: [PATCH] Add feature `yt-dlp` to support yt-dlp This commit adds support for json emitted from `yt-dlp`, which is only slightly different from `youtube-dl`. The changes are gated behind the `yt-dlp` feature --- Cargo.toml | 5 +++++ src/model.rs | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 876e19d..4b82497 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,11 @@ homepage = "https://github.com/GyrosOfWar/youtube-dl-rs" categories = ["multimedia::video"] keywords = ["youtube-dl", "youtube"] +[features] +default = ["youtube-dl"] +youtube-dl = [] +yt-dlp = [] + [dependencies] serde = { version = "1.0.124", features = ["derive"] } serde_json = "1.0.64" diff --git a/src/model.rs b/src/model.rs index d52da76..ef780ee 100644 --- a/src/model.rs +++ b/src/model.rs @@ -35,7 +35,10 @@ pub struct Format { pub downloader_options: Option>, pub ext: Option, pub filesize: Option, + #[cfg(feature = "youtube-dl")] pub filesize_approx: Option, + #[cfg(feature = "yt-dlp")] + pub filesize_approx: Option, pub format: Option, pub format_id: Option, pub format_note: Option, @@ -209,7 +212,10 @@ pub struct SingleVideo { pub extractor: Option, pub extractor_key: Option, pub filesize: Option, + #[cfg(feature = "youtube-dl")] pub filesize_approx: Option, + #[cfg(feature = "yt-dlp")] + pub filesize_approx: Option, pub format: Option, pub format_id: Option, pub format_note: Option, @@ -314,4 +320,10 @@ pub enum Protocol { M3U8Native, #[serde(rename = "http_dash_segments")] HttpDashSegments, + #[cfg(feature = "yt-dlp")] + #[serde(rename = "mhtml")] + Mhtml, + #[cfg(feature = "yt-dlp")] + #[serde(rename = "https+https")] + HttpsHttps, }