fix: video with no view count

This commit is contained in:
ThetaDev 2022-12-29 14:10:32 +01:00
parent f526470b6a
commit 0cbeb0524d
2 changed files with 9 additions and 3 deletions

View file

@ -166,14 +166,20 @@ impl MapResponse<VideoDetails> for response::VideoDetails {
(
title,
// view count field contains `No views` if the view count is zero
util::parse_numeric(&view_count.video_view_count_renderer.view_count)
view_count
.as_ref()
.and_then(|vc| {
util::parse_numeric(&vc.video_view_count_renderer.view_count).ok()
})
.unwrap_or_default(),
// accessibility_data contains no digits if the like count is hidden,
// so we ignore parse errors here for now
like_btn.and_then(|btn| util::parse_numeric(&btn.accessibility_data).ok()),
timeago::parse_textual_date_or_warn(lang, &date_text, &mut warnings),
date_text,
view_count.video_view_count_renderer.is_live,
view_count
.map(|vc| vc.video_view_count_renderer.is_live)
.unwrap_or_default(),
)
}
_ => {