From 3596861b7787bfa5ddf33119c178b634ffe8b6b7 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 20 Sep 2022 21:47:22 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20information=20panels=20(=C3=96RR,=20Covi?= =?UTF-8?q?d,=20...)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/response/video_details.rs | 6 ++++-- src/client/video_details.rs | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/client/response/video_details.rs b/src/client/response/video_details.rs index 2631beb..b7481db 100644 --- a/src/client/response/video_details.rs +++ b/src/client/response/video_details.rs @@ -99,7 +99,7 @@ pub enum VideoResultsItem { /// /// 1. sectionIdentifier: "comments-entry-point", contains number of comments /// 2. sectionIdentifier: "comment-item-section", contains continuation token - ItemSectionRenderer(ItemSection), + ItemSectionRenderer(#[serde_as(deserialize_as = "DefaultOnError")] ItemSection), #[serde(other, deserialize_with = "ignore_any")] None, } @@ -232,7 +232,7 @@ pub struct CurrentVideoWatchEndpoint { /// 1. CommentsEntryPointHeaderRenderer: contains number of comments /// 2. ContinuationItemRenderer: contains continuation token #[serde_as] -#[derive(Clone, Debug, Deserialize)] +#[derive(Default, Clone, Debug, Deserialize)] #[serde(rename_all = "kebab-case", tag = "sectionIdentifier")] pub enum ItemSection { CommentsEntryPoint { @@ -243,6 +243,8 @@ pub enum ItemSection { #[serde_as(as = "VecSkipError<_>")] contents: Vec, }, + #[default] + None, } /// Item section containing comment count diff --git a/src/client/video_details.rs b/src/client/video_details.rs index ce391ae..8610baf 100644 --- a/src/client/video_details.rs +++ b/src/client/video_details.rs @@ -133,6 +133,7 @@ impl MapResponse for response::VideoDetails { response::video_details::ItemSection::CommentItemSection { mut contents } => { comment_ctoken_section = contents.try_swap_remove(0); } + response::video_details::ItemSection::None => {}, } } response::video_details::VideoResultsItem::None => {}