From 07db7b1166e912e1554f98f2ae20c2c356fed38f Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Mon, 24 Mar 2025 01:28:07 +0100 Subject: [PATCH] fix: handle player returning no adaptive stream URLs --- src/client/player.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/client/player.rs b/src/client/player.rs index baba805..909da1f 100644 --- a/src/client/player.rs +++ b/src/client/player.rs @@ -383,6 +383,20 @@ impl MapResponse for response::Player { video_details.video_id, ctx.id ))); } + // Sometimes YouTube Desktop does not output any URLs for adaptive streams. + // Since this is currently rare, it is best to retry the request in this case. + if !is_live + && !streaming_data.adaptive_formats.c.is_empty() + && streaming_data + .adaptive_formats + .c + .iter() + .all(|f| f.url.is_none() && f.signature_cipher.is_none()) + { + return Err(ExtractionError::InvalidData( + "no adaptive stream URLs".into(), + )); + } let video_info = VideoPlayerDetails { id: video_details.video_id,