Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

feat: add referer option to download_video for enhanced header management

Tonhoaa0fdddae4e3
diff --git a/src-tauri/src/core/ytdlp.rs b/src-tauri/src/core/ytdlp.rs
index 19097081..67832683 100644
--- a/src-tauri/src/core/ytdlp.rs
+++ b/src-tauri/src/core/ytdlp.rs
@@ -201,6 +201,7 @@ pub async fn download_video(
download_mode: Option<&str>,
format_id: Option<&str>,
filename_template: Option<&str>,
+ referer: Option<&str>,
) -> anyhow::Result<DownloadResult> {
let mode = download_mode.unwrap_or("auto");
@@ -241,6 +242,11 @@ pub async fn download_video(
args.push("mp4".to_string());
}
+ if let Some(ref_url) = referer {
+ args.push("--add-headers".to_string());
+ args.push(format!("Referer:{}", ref_url));
+ }
+
args.extend([
"--no-playlist".to_string(),
"--newline".to_string(),