From d7caba81d0a12918ff5141fb37d8a81c54312af3 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Mon, 8 May 2023 01:18:14 +0200 Subject: [PATCH] fix: update shorts duration regex --- src/client/response/video_item.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/client/response/video_item.rs b/src/client/response/video_item.rs index 52f6491..b812f2d 100644 --- a/src/client/response/video_item.rs +++ b/src/client/response/video_item.rs @@ -484,7 +484,7 @@ impl YouTubeListMapper { fn map_short_video(&mut self, video: ReelItemRenderer, lang: Language) -> VideoItem { static ACCESSIBILITY_SEP_REGEX: Lazy = - Lazy::new(|| Regex::new(" [-\u{2013}] (.+) [-\u{2013}] ").unwrap()); + Lazy::new(|| Regex::new(" [-\u{2013}] ").unwrap()); let pub_date_txt = video.navigation_endpoint.map(|n| { n.reel_watch_endpoint @@ -499,14 +499,8 @@ impl YouTubeListMapper { id: video.video_id, name: video.headline, length: video.accessibility.and_then(|acc| { - ACCESSIBILITY_SEP_REGEX.captures(&acc).and_then(|cap| { - cap.get(1).and_then(|c| { - timeago::parse_video_duration_or_warn( - self.lang, - c.as_str(), - &mut self.warnings, - ) - }) + ACCESSIBILITY_SEP_REGEX.split(&acc).nth(1).and_then(|s| { + timeago::parse_video_duration_or_warn(self.lang, s, &mut self.warnings) }) }), thumbnail: video.thumbnail.into(),