fix: handle player returning no adaptive stream URLs
This commit is contained in:
parent
bcbf5e87bb
commit
5c164a2d53
1 changed files with 14 additions and 0 deletions
|
|
@ -383,6 +383,20 @@ impl MapResponse<VideoPlayer> for response::Player {
|
||||||
video_details.video_id, ctx.id
|
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 {
|
let video_info = VideoPlayerDetails {
|
||||||
id: video_details.video_id,
|
id: video_details.video_id,
|
||||||
|
|
|
||||||
Reference in a new issue