Updated the ytmusic cookies situation
Some checks failed
CI / check (push) Failing after 1m17s
CI / docker (push) Has been skipped

This commit is contained in:
Connor Johnstone
2026-03-20 13:38:49 -04:00
parent 80747a44a0
commit d3f4dc33d5
6 changed files with 42 additions and 5 deletions

View File

@@ -66,13 +66,25 @@ pub struct DownloadConfig {
#[serde(default)]
pub cookies_path: Option<PathBuf>,
/// Requests per hour (unauthenticated). Actual YouTube limit is ~500.
/// Requests per hour (unauthenticated). Actual YouTube limit is ~300.
#[serde(default = "default_rate_limit")]
pub rate_limit: u32,
/// Requests per hour (with cookies). Actual YouTube limit is ~2000.
#[serde(default = "default_rate_limit_auth")]
pub rate_limit_auth: u32,
/// Enable automatic cookie refresh via headless Firefox.
#[serde(default)]
pub cookie_refresh_enabled: bool,
/// How often to refresh cookies (hours).
#[serde(default = "default_cookie_refresh_hours")]
pub cookie_refresh_hours: u32,
/// Port for noVNC during interactive YouTube login.
#[serde(default = "default_vnc_port")]
pub vnc_port: u16,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -127,6 +139,9 @@ impl Default for DownloadConfig {
cookies_path: None,
rate_limit: default_rate_limit(),
rate_limit_auth: default_rate_limit_auth(),
cookie_refresh_enabled: false,
cookie_refresh_hours: default_cookie_refresh_hours(),
vnc_port: default_vnc_port(),
}
}
}
@@ -183,7 +198,7 @@ fn default_true() -> bool {
true
}
fn default_rate_limit() -> u32 {
450
250
}
fn default_rate_limit_auth() -> u32 {
1800
@@ -191,6 +206,19 @@ fn default_rate_limit_auth() -> u32 {
fn default_concurrency() -> usize {
4
}
fn default_cookie_refresh_hours() -> u32 {
6
}
fn default_vnc_port() -> u16 {
6080
}
/// Return the application data directory (e.g. ~/.local/share/shanty).
pub fn data_dir() -> PathBuf {
dirs::data_dir()
.unwrap_or_else(|| PathBuf::from("."))
.join("shanty")
}
// --- Loading and Saving ---