feat!: add channel_videos_tab, channel_videos_order,

remove channel_shorts, channel_livestreams
fix: parsing video types and short durations
This commit is contained in:
ThetaDev 2023-05-11 14:13:54 +02:00
parent 7e5cff719a
commit 3a75ed8610
20 changed files with 444 additions and 152 deletions

View file

@ -492,8 +492,6 @@ fn map_audio_stream(
deobf: &Deobfuscator,
last_nsig: &mut [String; 2],
) -> MapResult<Option<AudioStream>> {
static LANG_PATTERN: Lazy<Regex> = Lazy::new(|| Regex::new(r#"^([a-z]{2,3})\."#).unwrap());
let (mtype, codecs) = match parse_mime(&f.mime_type) {
Some(x) => x,
None => {
@ -535,18 +533,12 @@ fn map_audio_stream(
loudness_db: f.loudness_db,
throttled,
track: match f.audio_track {
Some(t) => {
let lang = LANG_PATTERN
.captures(&t.id)
.map(|m| m.get(1).unwrap().as_str().to_owned());
Some(AudioTrack {
id: t.id,
lang,
lang_name: t.display_name,
is_default: t.audio_is_default,
})
}
Some(t) => Some(AudioTrack {
lang: t.id.split('.').next().map(str::to_owned),
id: t.id,
lang_name: t.display_name,
is_default: t.audio_is_default,
}),
None => None,
},
}),