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 => {}