From f811fed0d65bed62bb1c5a986f6f355d3b68612d Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 4 Nov 2026 01:31:21 +0100 Subject: music: reject live streams on the yt-dlp path --- src/music.rs | 7 +++++++ src/voice/mod.rs | 2 ++ 2 files changed, 9 insertions(+) (limited to 'src') diff --git a/src/music.rs b/src/music.rs index acec278..0b907d3 100644 --- a/src/music.rs +++ b/src/music.rs @@ -547,6 +547,13 @@ pub(crate) fn sanitize_yt_url(url: &str) -> String { } async fn build_input(request: &TrackRequest, http: &reqwest::Client) -> Result { + // yt-dlp would block forever collecting a live stream into memory (and + // `--match-filter !is_live` rejects the remaining cases). + if request.kind == SourceKind::YtDlp && is_live_stream_hint(&request.url) { + return Err(Error::Custom( + "live streams are not supported through yt-dlp".into(), + )); + } if request.compressed { let audio_bytes = match request.kind { SourceKind::YtDlp => { diff --git a/src/voice/mod.rs b/src/voice/mod.rs index 2866f54..8f73b7a 100644 --- a/src/voice/mod.rs +++ b/src/voice/mod.rs @@ -253,6 +253,8 @@ pub async fn ytdlp_download(url: &str) -> Result> { "--no-playlist", "--max-filesize", "128M", + "--match-filter", + "!is_live", "--", url, ]) -- cgit v1.2.3