Take closed_captions api field for subtitles into account (#297)

This commit is contained in:
bytedream 2024-01-28 02:04:42 +01:00
parent 3b9fc52890
commit 7cf7a8e71c
2 changed files with 15 additions and 4 deletions

View file

@ -317,7 +317,12 @@ async fn get_format(
let subtitle = if contains_hardsub {
None
} else if let Some(subtitle_locale) = &download.subtitle {
stream.subtitles.get(subtitle_locale).cloned()
stream
.subtitles
.get(subtitle_locale)
.cloned()
// use closed captions as fallback if no actual subtitles are found
.or_else(|| stream.closed_captions.get(subtitle_locale).cloned())
} else {
None
};