Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.
Rust downloadmanagerguihacktoberfesthomebrewlightweightlinuxlinux-distributionlocal-firstmacosmacos-packagemedia-toolboxopen-sourcerustsveltetauritrendingtrending-repositorieswindowswindows-desktopytdlp
feat: add options for YouTube sponsorblock and splitting by chapters in download settings
Tonho96a274403889
diff --git a/src-tauri/src/platforms/bilibili/mod.rs b/src-tauri/src/platforms/bilibili/mod.rsindex b9ea6fda..54ba47cc 100644--- a/src-tauri/src/platforms/bilibili/mod.rs+++ b/src-tauri/src/platforms/bilibili/mod.rs@@ -231,8 +231,7 @@ impl PlatformDownloader for BilibiliDownloader {.as_ref().and_then(|q| q.trim_end_matches('p').parse::<u32>().ok());- let mut extra = Self::bilibili_extra_flags();- extra.push("--no-playlist".to_string());+ let extra = vec!["--no-playlist".to_string()];ytdlp::download_video(&ytdlp_path,@@ -243,7 +242,7 @@ impl PlatformDownloader for BilibiliDownloader {opts.download_mode.as_deref(),opts.format_id.as_deref(),opts.filename_template.as_deref(),- None,+ opts.referer.as_deref().or(Some("https://www.bilibili.com")),opts.cancel_token.clone(),None,opts.concurrent_fragments,@@ -287,8 +286,7 @@ impl BilibiliDownloader {}});- let mut extra = Self::bilibili_extra_flags();- extra.push("--no-playlist".to_string());+ let extra = vec!["--no-playlist".to_string()];match ytdlp::download_video(ytdlp_path,@@ -299,7 +297,7 @@ impl BilibiliDownloader {opts.download_mode.as_deref(),None,opts.filename_template.as_deref(),- None,+ opts.referer.as_deref().or(Some("https://www.bilibili.com")),opts.cancel_token.clone(),None,opts.concurrent_fragments,diff --git a/src-tauri/src/platforms/bluesky/mod.rs b/src-tauri/src/platforms/bluesky/mod.rsindex b1f1d94e..44d8c6a5 100644--- a/src-tauri/src/platforms/bluesky/mod.rs+++ b/src-tauri/src/platforms/bluesky/mod.rs@@ -259,7 +259,7 @@ impl PlatformDownloader for BlueskyDownloader {opts.download_mode.as_deref(),opts.format_id.as_deref(),opts.filename_template.as_deref(),- None,+ opts.referer.as_deref().or(Some("https://bsky.app")),opts.cancel_token.clone(),None,opts.concurrent_fragments,diff --git a/src-tauri/src/platforms/generic_ytdlp/mod.rs b/src-tauri/src/platforms/generic_ytdlp/mod.rsindex fcda4e3a..bb8e51f8 100644--- a/src-tauri/src/platforms/generic_ytdlp/mod.rs+++ b/src-tauri/src/platforms/generic_ytdlp/mod.rs@@ -415,18 +415,6 @@ impl PlatformDownloader for GenericYtdlpDownloader {.as_deref().or_else(|| platform_referer(video_url));- let mut extra_flags = Vec::new();- if let Some(ref hdrs) = opts.extra_headers {- for (name, value) in hdrs {- let lower = name.to_lowercase();- if lower == "referer" || lower == "cookie" {- continue;- }- extra_flags.push("--add-headers".to_string());- extra_flags.push(format!("{}:{}", name, value));- }- }-ytdlp::download_video(&ytdlp_path,video_url,@@ -441,7 +429,7 @@ impl PlatformDownloader for GenericYtdlpDownloader {None,opts.concurrent_fragments,opts.download_subtitles,- &extra_flags,+ &[],).await}diff --git a/src-tauri/src/platforms/instagram/mod.rs b/src-tauri/src/platforms/instagram/mod.rsindex 713c3b47..ec7e791d 100644--- a/src-tauri/src/platforms/instagram/mod.rs+++ b/src-tauri/src/platforms/instagram/mod.rs@@ -567,7 +567,7 @@ impl InstagramDownloader {opts.download_mode.as_deref(),opts.format_id.as_deref(),opts.filename_template.as_deref(),- Some("https://www.instagram.com/"),+ opts.referer.as_deref().or(Some("https://www.instagram.com/")),opts.cancel_token.clone(),None,opts.concurrent_fragments,diff --git a/src-tauri/src/platforms/pinterest/mod.rs b/src-tauri/src/platforms/pinterest/mod.rsindex e5f8df5d..5b9b193a 100644--- a/src-tauri/src/platforms/pinterest/mod.rs+++ b/src-tauri/src/platforms/pinterest/mod.rs@@ -214,7 +214,7 @@ impl PlatformDownloader for PinterestDownloader {opts.download_mode.as_deref(),opts.format_id.as_deref(),opts.filename_template.as_deref(),- None,+ opts.referer.as_deref().or(Some("https://www.pinterest.com/")),opts.cancel_token.clone(),None,opts.concurrent_fragments,diff --git a/src-tauri/src/platforms/reddit/mod.rs b/src-tauri/src/platforms/reddit/mod.rsindex 234baa09..db75a66f 100644--- a/src-tauri/src/platforms/reddit/mod.rs+++ b/src-tauri/src/platforms/reddit/mod.rs@@ -378,7 +378,7 @@ impl PlatformDownloader for RedditDownloader {opts.download_mode.as_deref(),opts.format_id.as_deref(),opts.filename_template.as_deref(),- None,+ opts.referer.as_deref().or(Some("https://www.reddit.com/")),opts.cancel_token.clone(),None,opts.concurrent_fragments,diff --git a/src-tauri/src/platforms/tiktok/mod.rs b/src-tauri/src/platforms/tiktok/mod.rsindex 9d75728c..7af791e0 100644--- a/src-tauri/src/platforms/tiktok/mod.rs+++ b/src-tauri/src/platforms/tiktok/mod.rs@@ -515,7 +515,7 @@ impl PlatformDownloader for TikTokDownloader {opts.download_mode.as_deref(),opts.format_id.as_deref(),opts.filename_template.as_deref(),- Some("https://www.tiktok.com/"),+ opts.referer.as_deref().or(Some("https://www.tiktok.com/")),opts.cancel_token.clone(),None,opts.concurrent_fragments,@@ -585,7 +585,7 @@ impl PlatformDownloader for TikTokDownloader {opts.download_mode.as_deref(),None,opts.filename_template.as_deref(),- Some("https://www.tiktok.com/"),+ opts.referer.as_deref().or(Some("https://www.tiktok.com/")),opts.cancel_token.clone(),None,opts.concurrent_fragments,diff --git a/src-tauri/src/platforms/twitch/mod.rs b/src-tauri/src/platforms/twitch/mod.rsindex 8a3af84b..077f4821 100644--- a/src-tauri/src/platforms/twitch/mod.rs+++ b/src-tauri/src/platforms/twitch/mod.rs@@ -308,7 +308,7 @@ impl PlatformDownloader for TwitchClipsDownloader {opts.download_mode.as_deref(),opts.format_id.as_deref(),opts.filename_template.as_deref(),- None,+ opts.referer.as_deref().or(Some("https://www.twitch.tv/")),opts.cancel_token.clone(),None,opts.concurrent_fragments,diff --git a/src-tauri/src/platforms/twitter/mod.rs b/src-tauri/src/platforms/twitter/mod.rsindex 0f7d8b33..df480b85 100644--- a/src-tauri/src/platforms/twitter/mod.rs+++ b/src-tauri/src/platforms/twitter/mod.rs@@ -474,7 +474,7 @@ impl PlatformDownloader for TwitterDownloader {opts.download_mode.as_deref(),opts.format_id.as_deref(),opts.filename_template.as_deref(),- None,+ opts.referer.as_deref().or(Some("https://x.com/")),opts.cancel_token.clone(),None,opts.concurrent_fragments,diff --git a/src-tauri/src/platforms/youtube/mod.rs b/src-tauri/src/platforms/youtube/mod.rsindex 80e567fd..9fa77087 100644--- a/src-tauri/src/platforms/youtube/mod.rs+++ b/src-tauri/src/platforms/youtube/mod.rs@@ -334,7 +334,7 @@ impl PlatformDownloader for YouTubeDownloader {opts.download_mode.as_deref(),opts.format_id.as_deref(),opts.filename_template.as_deref(),- None,+ opts.referer.as_deref().or(Some("https://www.youtube.com/")),opts.cancel_token.clone(),None,opts.concurrent_fragments,@@ -390,7 +390,7 @@ impl YouTubeDownloader {opts.download_mode.as_deref(),None,opts.filename_template.as_deref(),- None,+ opts.referer.as_deref().or(Some("https://www.youtube.com/")),opts.cancel_token.clone(),None,opts.concurrent_fragments,diff --git a/src/lib/stores/settings-store.svelte.ts b/src/lib/stores/settings-store.svelte.tsindex 103b7815..c00ce94a 100644--- a/src/lib/stores/settings-store.svelte.ts+++ b/src/lib/stores/settings-store.svelte.ts@@ -21,6 +21,8 @@ export type AppSettings = {download_subtitles: boolean;include_auto_subtitles: boolean;translate_metadata: boolean;+ youtube_sponsorblock: boolean;+ split_by_chapters: boolean;hotkey_enabled: boolean;hotkey_binding: string;copy_to_clipboard_on_hotkey: boolean;diff --git a/src/routes/settings/+page.svelte b/src/routes/settings/+page.svelteindex e79539be..80a3d259 100644--- a/src/routes/settings/+page.svelte+++ b/src/routes/settings/+page.svelte@@ -608,6 +608,22 @@<button class="toggle" class:on={settings.download.translate_metadata} onclick={() => toggleBool("download", "translate_metadata", settings!.download.translate_metadata)} role="switch" aria-checked={settings.download.translate_metadata} aria-label={$t('settings.download.translate_metadata')}><span class="toggle-knob"></span></button></div><div class="divider"></div>+ <div class="setting-row">+ <div class="setting-col">+ <span class="setting-label">{$t('settings.download.youtube_sponsorblock')}</span>+ <span class="setting-path">{$t('settings.download.youtube_sponsorblock_desc')}</span>+ </div>+ <button class="toggle" class:on={settings.download.youtube_sponsorblock} onclick={() => toggleBool("download", "youtube_sponsorblock", settings!.download.youtube_sponsorblock)} role="switch" aria-checked={settings.download.youtube_sponsorblock} aria-label={$t('settings.download.youtube_sponsorblock')}><span class="toggle-knob"></span></button>+ </div>+ <div class="divider"></div>+ <div class="setting-row">+ <div class="setting-col">+ <span class="setting-label">{$t('settings.download.split_by_chapters')}</span>+ <span class="setting-path">{$t('settings.download.split_by_chapters_desc')}</span>+ </div>+ <button class="toggle" class:on={settings.download.split_by_chapters} onclick={() => toggleBool("download", "split_by_chapters", settings!.download.split_by_chapters)} role="switch" aria-checked={settings.download.split_by_chapters} aria-label={$t('settings.download.split_by_chapters')}><span class="toggle-knob"></span></button>+ </div>+ <div class="divider"></div><div class="setting-row"><div class="setting-col"><span class="setting-label">{$t('settings.download.embed_metadata')}</span>