refactor: make response models crate-private

This commit is contained in:
ThetaDev 2022-10-17 23:55:03 +02:00
parent 55861739dc
commit 4d80dffcd5
12 changed files with 222 additions and 222 deletions

View file

@ -12,7 +12,7 @@ use crate::serializer::{text::Text, MapResult, VecLogError};
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Channel { pub(crate) struct Channel {
#[serde(default)] #[serde(default)]
#[serde_as(as = "DefaultOnError")] #[serde_as(as = "DefaultOnError")]
pub header: Option<Header>, pub header: Option<Header>,
@ -25,7 +25,7 @@ pub struct Channel {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Contents { pub(crate) struct Contents {
pub two_column_browse_results_renderer: TabsRenderer, pub two_column_browse_results_renderer: TabsRenderer,
} }
@ -34,21 +34,21 @@ pub struct Contents {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct TabsRenderer { pub(crate) struct TabsRenderer {
#[serde_as(as = "VecSkipError<_>")] #[serde_as(as = "VecSkipError<_>")]
pub tabs: Vec<TabRendererWrap>, pub tabs: Vec<TabRendererWrap>,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct TabRendererWrap { pub(crate) struct TabRendererWrap {
pub tab_renderer: ContentRenderer<TabContent>, pub tab_renderer: ContentRenderer<TabContent>,
} }
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct TabContent { pub(crate) struct TabContent {
#[serde(default)] #[serde(default)]
#[serde_as(as = "DefaultOnError")] #[serde_as(as = "DefaultOnError")]
pub section_list_renderer: Option<SectionListRenderer>, pub section_list_renderer: Option<SectionListRenderer>,
@ -60,7 +60,7 @@ pub struct TabContent {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct SectionListRenderer { pub(crate) struct SectionListRenderer {
pub contents: Vec<ItemSectionRendererWrap>, pub contents: Vec<ItemSectionRendererWrap>,
/// - **Videos**: browse-feedUC2DjFE7Xf11URZqWBigcVOQvideos (...) /// - **Videos**: browse-feedUC2DjFE7Xf11URZqWBigcVOQvideos (...)
/// - **Playlists**: browse-feedUC2DjFE7Xf11URZqWBigcVOQplaylists104 (...) /// - **Playlists**: browse-feedUC2DjFE7Xf11URZqWBigcVOQplaylists104 (...)
@ -72,7 +72,7 @@ pub struct SectionListRenderer {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct RichGridRenderer { pub(crate) struct RichGridRenderer {
#[serde_as(as = "VecLogError<_>")] #[serde_as(as = "VecLogError<_>")]
pub contents: MapResult<Vec<YouTubeListItem>>, pub contents: MapResult<Vec<YouTubeListItem>>,
/// - **Videos**: browse-feedUC2DjFE7Xf11URZqWBigcVOQvideos (...) /// - **Videos**: browse-feedUC2DjFE7Xf11URZqWBigcVOQvideos (...)
@ -83,14 +83,14 @@ pub struct RichGridRenderer {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ItemSectionRendererWrap { pub(crate) struct ItemSectionRendererWrap {
pub item_section_renderer: ContentsRenderer<ChannelContent>, pub item_section_renderer: ContentsRenderer<ChannelContent>,
} }
#[serde_as] #[serde_as]
#[derive(Default, Debug, Deserialize)] #[derive(Default, Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub enum ChannelContent { pub(crate) enum ChannelContent {
GridRenderer { GridRenderer {
#[serde_as(as = "VecLogError<_>")] #[serde_as(as = "VecLogError<_>")]
items: MapResult<Vec<YouTubeListItem>>, items: MapResult<Vec<YouTubeListItem>>,
@ -103,7 +103,7 @@ pub enum ChannelContent {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub enum Header { pub(crate) enum Header {
C4TabbedHeaderRenderer(HeaderRenderer), C4TabbedHeaderRenderer(HeaderRenderer),
/// Used for special channels like YouTube Music /// Used for special channels like YouTube Music
CarouselHeaderRenderer(ContentsRenderer<CarouselHeaderRendererItem>), CarouselHeaderRenderer(ContentsRenderer<CarouselHeaderRendererItem>),
@ -112,7 +112,7 @@ pub enum Header {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct HeaderRenderer { pub(crate) struct HeaderRenderer {
/// Approximate subscriber count (e.g. `880K subscribers`), depends on language. /// Approximate subscriber count (e.g. `880K subscribers`), depends on language.
/// ///
/// `None` if the subscriber count is hidden. /// `None` if the subscriber count is hidden.
@ -134,7 +134,7 @@ pub struct HeaderRenderer {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub enum CarouselHeaderRendererItem { pub(crate) enum CarouselHeaderRendererItem {
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
TopicChannelDetailsRenderer { TopicChannelDetailsRenderer {
#[serde_as(as = "Option<Text>")] #[serde_as(as = "Option<Text>")]
@ -148,13 +148,13 @@ pub enum CarouselHeaderRendererItem {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Metadata { pub(crate) struct Metadata {
pub channel_metadata_renderer: ChannelMetadataRenderer, pub channel_metadata_renderer: ChannelMetadataRenderer,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ChannelMetadataRenderer { pub(crate) struct ChannelMetadataRenderer {
pub title: String, pub title: String,
/// Channel ID /// Channel ID
pub external_id: String, pub external_id: String,
@ -164,13 +164,13 @@ pub struct ChannelMetadataRenderer {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Microformat { pub(crate) struct Microformat {
pub microformat_data_renderer: MicroformatDataRenderer, pub microformat_data_renderer: MicroformatDataRenderer,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct MicroformatDataRenderer { pub(crate) struct MicroformatDataRenderer {
#[serde(default)] #[serde(default)]
pub tags: Vec<String>, pub tags: Vec<String>,
} }
@ -178,7 +178,7 @@ pub struct MicroformatDataRenderer {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ChannelFullMetadata { pub(crate) struct ChannelFullMetadata {
#[serde_as(as = "Text")] #[serde_as(as = "Text")]
pub joined_date_text: String, pub joined_date_text: String,
#[serde_as(as = "Option<Text>")] #[serde_as(as = "Option<Text>")]
@ -191,7 +191,7 @@ pub struct ChannelFullMetadata {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct PrimaryLink { pub(crate) struct PrimaryLink {
#[serde_as(as = "Text")] #[serde_as(as = "Text")]
pub title: String, pub title: String,
pub navigation_endpoint: NavigationEndpoint, pub navigation_endpoint: NavigationEndpoint,

View file

@ -4,7 +4,7 @@ use serde::Deserialize;
use super::Thumbnail; use super::Thumbnail;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
pub struct ChannelRss { pub(crate) struct ChannelRss {
#[serde(rename = "$unflatten=yt:channelId")] #[serde(rename = "$unflatten=yt:channelId")]
pub channel_id: String, pub channel_id: String,
#[serde(rename = "$unflatten=title")] #[serde(rename = "$unflatten=title")]
@ -15,7 +15,7 @@ pub struct ChannelRss {
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
pub struct Entry { pub(crate) struct Entry {
#[serde(rename = "$unflatten=yt:videoId")] #[serde(rename = "$unflatten=yt:videoId")]
pub video_id: String, pub video_id: String,
#[serde(rename = "$unflatten=title")] #[serde(rename = "$unflatten=title")]
@ -29,7 +29,7 @@ pub struct Entry {
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
pub struct MediaGroup { pub(crate) struct MediaGroup {
#[serde(rename = "$unflatten=media:thumbnail")] #[serde(rename = "$unflatten=media:thumbnail")]
pub thumbnail: Thumbnail, pub thumbnail: Thumbnail,
#[serde(rename = "$unflatten=media:description")] #[serde(rename = "$unflatten=media:description")]
@ -39,7 +39,7 @@ pub struct MediaGroup {
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
pub struct Community { pub(crate) struct Community {
#[serde(rename = "$unflatten=media:starRating")] #[serde(rename = "$unflatten=media:starRating")]
pub rating: Rating, pub rating: Rating,
#[serde(rename = "$unflatten=media:statistics")] #[serde(rename = "$unflatten=media:statistics")]
@ -47,12 +47,12 @@ pub struct Community {
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
pub struct Rating { pub(crate) struct Rating {
pub count: u64, pub count: u64,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
pub struct Statistics { pub(crate) struct Statistics {
pub views: u64, pub views: u64,
} }

View file

@ -1,31 +1,31 @@
pub mod channel; pub(crate) mod channel;
pub mod player; pub(crate) mod player;
pub mod playlist; pub(crate) mod playlist;
pub mod playlist_music; pub(crate) mod playlist_music;
pub mod search; pub(crate) mod search;
pub mod trends; pub(crate) mod trends;
pub mod url_endpoint; pub(crate) mod url_endpoint;
pub mod video_details; pub(crate) mod video_details;
pub mod video_item; pub(crate) mod video_item;
pub use channel::Channel; pub(crate) use channel::Channel;
pub use player::Player; pub(crate) use player::Player;
pub use playlist::Playlist; pub(crate) use playlist::Playlist;
pub use playlist::PlaylistCont; pub(crate) use playlist::PlaylistCont;
pub use playlist_music::PlaylistMusic; pub(crate) use playlist_music::PlaylistMusic;
pub use search::Search; pub(crate) use search::Search;
pub use trends::Startpage; pub(crate) use trends::Startpage;
pub use trends::Trending; pub(crate) use trends::Trending;
pub use url_endpoint::ResolvedUrl; pub(crate) use url_endpoint::ResolvedUrl;
pub use video_details::VideoComments; pub(crate) use video_details::VideoComments;
pub use video_details::VideoDetails; pub(crate) use video_details::VideoDetails;
pub use video_item::YouTubeListItem; pub(crate) use video_item::YouTubeListItem;
pub use video_item::YouTubeListMapper; pub(crate) use video_item::YouTubeListMapper;
#[cfg(feature = "rss")] #[cfg(feature = "rss")]
pub mod channel_rss; pub(crate) mod channel_rss;
#[cfg(feature = "rss")] #[cfg(feature = "rss")]
pub use channel_rss::ChannelRss; pub(crate) use channel_rss::ChannelRss;
use serde::Deserialize; use serde::Deserialize;
use serde_with::{json::JsonString, serde_as, DefaultOnError, VecSkipError}; use serde_with::{json::JsonString, serde_as, DefaultOnError, VecSkipError};
@ -39,20 +39,20 @@ use crate::serializer::{
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ContentRenderer<T> { pub(crate) struct ContentRenderer<T> {
pub content: T, pub content: T,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ContentsRenderer<T> { pub(crate) struct ContentsRenderer<T> {
#[serde(alias = "tabs")] #[serde(alias = "tabs")]
pub contents: Vec<T>, pub contents: Vec<T>,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ThumbnailsWrap { pub(crate) struct ThumbnailsWrap {
#[serde(default)] #[serde(default)]
pub thumbnail: Thumbnails, pub thumbnail: Thumbnails,
} }
@ -61,14 +61,14 @@ pub struct ThumbnailsWrap {
/// Not only used for thumbnails, but also for avatars and banners. /// Not only used for thumbnails, but also for avatars and banners.
#[derive(Default, Debug, Deserialize)] #[derive(Default, Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Thumbnails { pub(crate) struct Thumbnails {
#[serde(default)] #[serde(default)]
pub thumbnails: Vec<Thumbnail>, pub thumbnails: Vec<Thumbnail>,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Thumbnail { pub(crate) struct Thumbnail {
pub url: String, pub url: String,
pub width: u32, pub width: u32,
pub height: u32, pub height: u32,
@ -76,32 +76,32 @@ pub struct Thumbnail {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ContinuationItemRenderer { pub(crate) struct ContinuationItemRenderer {
pub continuation_endpoint: ContinuationEndpoint, pub continuation_endpoint: ContinuationEndpoint,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ContinuationEndpoint { pub(crate) struct ContinuationEndpoint {
pub continuation_command: ContinuationCommand, pub continuation_command: ContinuationCommand,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ContinuationCommand { pub(crate) struct ContinuationCommand {
pub token: String, pub token: String,
} }
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Icon { pub(crate) struct Icon {
pub icon_type: IconType, pub icon_type: IconType,
} }
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, Hash)] #[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, Hash)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum IconType { pub(crate) enum IconType {
/// Checkmark for verified channels /// Checkmark for verified channels
Check, Check,
/// Music note for verified artists /// Music note for verified artists
@ -112,14 +112,14 @@ pub enum IconType {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct VideoOwner { pub(crate) struct VideoOwner {
pub video_owner_renderer: VideoOwnerRenderer, pub video_owner_renderer: VideoOwnerRenderer,
} }
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct VideoOwnerRenderer { pub(crate) struct VideoOwnerRenderer {
pub title: TextComponent, pub title: TextComponent,
pub thumbnail: Thumbnails, pub thumbnail: Thumbnails,
#[serde_as(as = "Option<Text>")] #[serde_as(as = "Option<Text>")]
@ -131,33 +131,33 @@ pub struct VideoOwnerRenderer {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ChannelBadge { pub(crate) struct ChannelBadge {
pub metadata_badge_renderer: ChannelBadgeRenderer, pub metadata_badge_renderer: ChannelBadgeRenderer,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ChannelBadgeRenderer { pub(crate) struct ChannelBadgeRenderer {
pub style: ChannelBadgeStyle, pub style: ChannelBadgeStyle,
} }
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, Hash)] #[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, Hash)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum ChannelBadgeStyle { pub(crate) enum ChannelBadgeStyle {
BadgeStyleTypeVerified, BadgeStyleTypeVerified,
BadgeStyleTypeVerifiedArtist, BadgeStyleTypeVerifiedArtist,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Alert { pub(crate) struct Alert {
pub alert_renderer: AlertRenderer, pub alert_renderer: AlertRenderer,
} }
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct AlertRenderer { pub(crate) struct AlertRenderer {
#[serde_as(as = "Text")] #[serde_as(as = "Text")]
pub text: String, pub text: String,
} }
@ -167,7 +167,7 @@ pub struct AlertRenderer {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Continuation { pub(crate) struct Continuation {
/// Number of search results /// Number of search results
#[serde_as(as = "Option<JsonString>")] #[serde_as(as = "Option<JsonString>")]
pub estimated_results: Option<u64>, pub estimated_results: Option<u64>,
@ -181,21 +181,21 @@ pub struct Continuation {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ContinuationActionWrap { pub(crate) struct ContinuationActionWrap {
pub append_continuation_items_action: ContinuationAction, pub append_continuation_items_action: ContinuationAction,
} }
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ContinuationAction { pub(crate) struct ContinuationAction {
#[serde_as(as = "VecLogError<_>")] #[serde_as(as = "VecLogError<_>")]
pub continuation_items: MapResult<Vec<YouTubeListItem>>, pub continuation_items: MapResult<Vec<YouTubeListItem>>,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ResponseContext { pub(crate) struct ResponseContext {
pub visitor_data: Option<String>, pub visitor_data: Option<String>,
} }
@ -204,7 +204,7 @@ pub struct ResponseContext {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct MusicItem { pub(crate) struct MusicItem {
pub thumbnail: MusicThumbnailRenderer, pub thumbnail: MusicThumbnailRenderer,
#[serde(default)] #[serde(default)]
#[serde_as(deserialize_as = "DefaultOnError")] #[serde_as(deserialize_as = "DefaultOnError")]
@ -217,28 +217,28 @@ pub struct MusicItem {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct MusicThumbnailRenderer { pub(crate) struct MusicThumbnailRenderer {
#[serde(alias = "croppedSquareThumbnailRenderer")] #[serde(alias = "croppedSquareThumbnailRenderer")]
pub music_thumbnail_renderer: ThumbnailsWrap, pub music_thumbnail_renderer: ThumbnailsWrap,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct PlaylistItemData { pub(crate) struct PlaylistItemData {
pub video_id: String, pub video_id: String,
} }
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct MusicContentsRenderer<T> { pub(crate) struct MusicContentsRenderer<T> {
pub contents: Vec<T>, pub contents: Vec<T>,
#[serde_as(as = "Option<VecSkipError<_>>")] #[serde_as(as = "Option<VecSkipError<_>>")]
pub continuations: Option<Vec<MusicContinuation>>, pub continuations: Option<Vec<MusicContinuation>>,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
pub struct MusicColumn { pub(crate) struct MusicColumn {
#[serde( #[serde(
rename = "musicResponsiveListItemFlexColumnRenderer", rename = "musicResponsiveListItemFlexColumnRenderer",
alias = "musicResponsiveListItemFixedColumnRenderer" alias = "musicResponsiveListItemFixedColumnRenderer"
@ -248,19 +248,19 @@ pub struct MusicColumn {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
pub struct MusicColumnRenderer { pub(crate) struct MusicColumnRenderer {
pub text: TextComponent, pub text: TextComponent,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct MusicContinuation { pub(crate) struct MusicContinuation {
pub next_continuation_data: MusicContinuationData, pub next_continuation_data: MusicContinuationData,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct MusicContinuationData { pub(crate) struct MusicContinuationData {
pub continuation: String, pub continuation: String,
} }
@ -312,7 +312,7 @@ impl From<Icon> for crate::model::Verification {
} }
} }
pub fn alerts_to_err(alerts: Option<Vec<Alert>>) -> ExtractionError { pub(crate) fn alerts_to_err(alerts: Option<Vec<Alert>>) -> ExtractionError {
match alerts { match alerts {
Some(alerts) => ExtractionError::ContentUnavailable( Some(alerts) => ExtractionError::ContentUnavailable(
alerts alerts

View file

@ -9,7 +9,7 @@ use crate::serializer::{text::Text, MapResult, VecLogError};
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Player { pub(crate) struct Player {
pub playability_status: PlayabilityStatus, pub playability_status: PlayabilityStatus,
pub streaming_data: Option<StreamingData>, pub streaming_data: Option<StreamingData>,
pub captions: Option<Captions>, pub captions: Option<Captions>,
@ -18,7 +18,7 @@ pub struct Player {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(tag = "status", rename_all = "SCREAMING_SNAKE_CASE")] #[serde(tag = "status", rename_all = "SCREAMING_SNAKE_CASE")]
pub enum PlayabilityStatus { pub(crate) enum PlayabilityStatus {
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
Ok { live_streamability: Option<Empty> }, Ok { live_streamability: Option<Empty> },
/// Video cant be played because of DRM / Geoblock /// Video cant be played because of DRM / Geoblock
@ -35,12 +35,12 @@ pub enum PlayabilityStatus {
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
pub struct Empty {} pub(crate) struct Empty {}
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct StreamingData { pub(crate) struct StreamingData {
#[serde_as(as = "JsonString")] #[serde_as(as = "JsonString")]
pub expires_in_seconds: u32, pub expires_in_seconds: u32,
#[serde(default)] #[serde(default)]
@ -58,7 +58,7 @@ pub struct StreamingData {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Format { pub(crate) struct Format {
pub itag: u32, pub itag: u32,
pub url: Option<String>, pub url: Option<String>,
@ -119,7 +119,7 @@ impl Format {
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[serde(rename_all = "lowercase")] #[serde(rename_all = "lowercase")]
pub enum Quality { pub(crate) enum Quality {
Tiny, Tiny,
Small, Small,
Medium, Medium,
@ -132,7 +132,7 @@ pub enum Quality {
} }
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum AudioQuality { pub(crate) enum AudioQuality {
#[serde(rename = "AUDIO_QUALITY_LOW", alias = "low")] #[serde(rename = "AUDIO_QUALITY_LOW", alias = "low")]
Low, Low,
#[serde(rename = "AUDIO_QUALITY_MEDIUM", alias = "medium")] #[serde(rename = "AUDIO_QUALITY_MEDIUM", alias = "medium")]
@ -143,7 +143,7 @@ pub enum AudioQuality {
#[derive(Default, Clone, Copy, Debug, Deserialize, PartialEq, Eq, Hash)] #[derive(Default, Clone, Copy, Debug, Deserialize, PartialEq, Eq, Hash)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum FormatType { pub(crate) enum FormatType {
#[default] #[default]
Default, Default,
/// This stream only works via DASH and not via progressive HTTP. /// This stream only works via DASH and not via progressive HTTP.
@ -152,13 +152,13 @@ pub enum FormatType {
#[derive(Default, Debug, Deserialize)] #[derive(Default, Debug, Deserialize)]
#[serde(default, rename_all = "camelCase")] #[serde(default, rename_all = "camelCase")]
pub struct ColorInfo { pub(crate) struct ColorInfo {
pub primaries: Primaries, pub primaries: Primaries,
} }
#[derive(Default, Clone, Copy, Debug, Deserialize, PartialEq, Eq, Hash)] #[derive(Default, Clone, Copy, Debug, Deserialize, PartialEq, Eq, Hash)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum Primaries { pub(crate) enum Primaries {
#[default] #[default]
ColorPrimariesBt709, ColorPrimariesBt709,
ColorPrimariesBt2020, ColorPrimariesBt2020,
@ -166,7 +166,7 @@ pub enum Primaries {
#[derive(Default, Debug, Deserialize)] #[derive(Default, Debug, Deserialize)]
#[serde(default, rename_all = "camelCase")] #[serde(default, rename_all = "camelCase")]
pub struct AudioTrack { pub(crate) struct AudioTrack {
pub id: String, pub id: String,
pub display_name: String, pub display_name: String,
pub audio_is_default: bool, pub audio_is_default: bool,
@ -174,20 +174,20 @@ pub struct AudioTrack {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Captions { pub(crate) struct Captions {
pub player_captions_tracklist_renderer: PlayerCaptionsTracklistRenderer, pub player_captions_tracklist_renderer: PlayerCaptionsTracklistRenderer,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct PlayerCaptionsTracklistRenderer { pub(crate) struct PlayerCaptionsTracklistRenderer {
pub caption_tracks: Vec<CaptionTrack>, pub caption_tracks: Vec<CaptionTrack>,
} }
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct CaptionTrack { pub(crate) struct CaptionTrack {
pub base_url: String, pub base_url: String,
#[serde_as(as = "Text")] #[serde_as(as = "Text")]
pub name: String, pub name: String,
@ -197,7 +197,7 @@ pub struct CaptionTrack {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct VideoDetails { pub(crate) struct VideoDetails {
pub video_id: String, pub video_id: String,
pub title: String, pub title: String,
#[serde_as(as = "JsonString")] #[serde_as(as = "JsonString")]

View file

@ -12,7 +12,7 @@ use super::{
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Playlist { pub(crate) struct Playlist {
pub contents: Option<Contents>, pub contents: Option<Contents>,
pub header: Option<Header>, pub header: Option<Header>,
pub sidebar: Option<Sidebar>, pub sidebar: Option<Sidebar>,
@ -23,7 +23,7 @@ pub struct Playlist {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct PlaylistCont { pub(crate) struct PlaylistCont {
#[serde(default)] #[serde(default)]
#[serde_as(as = "VecSkipError<_>")] #[serde_as(as = "VecSkipError<_>")]
pub on_response_received_actions: Vec<OnResponseReceivedAction>, pub on_response_received_actions: Vec<OnResponseReceivedAction>,
@ -31,52 +31,52 @@ pub struct PlaylistCont {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Contents { pub(crate) struct Contents {
pub two_column_browse_results_renderer: ContentsRenderer<Tab>, pub two_column_browse_results_renderer: ContentsRenderer<Tab>,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Tab { pub(crate) struct Tab {
pub tab_renderer: ContentRenderer<SectionList>, pub tab_renderer: ContentRenderer<SectionList>,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct SectionList { pub(crate) struct SectionList {
pub section_list_renderer: ContentsRenderer<ItemSection>, pub section_list_renderer: ContentsRenderer<ItemSection>,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ItemSection { pub(crate) struct ItemSection {
pub item_section_renderer: ContentsRenderer<PlaylistVideoListRenderer>, pub item_section_renderer: ContentsRenderer<PlaylistVideoListRenderer>,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct PlaylistVideoListRenderer { pub(crate) struct PlaylistVideoListRenderer {
pub playlist_video_list_renderer: PlaylistVideoList, pub playlist_video_list_renderer: PlaylistVideoList,
} }
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct PlaylistVideoList { pub(crate) struct PlaylistVideoList {
#[serde_as(as = "VecLogError<_>")] #[serde_as(as = "VecLogError<_>")]
pub contents: MapResult<Vec<PlaylistItem>>, pub contents: MapResult<Vec<PlaylistItem>>,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Header { pub(crate) struct Header {
pub playlist_header_renderer: HeaderRenderer, pub playlist_header_renderer: HeaderRenderer,
} }
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct HeaderRenderer { pub(crate) struct HeaderRenderer {
pub playlist_id: String, pub playlist_id: String,
#[serde_as(as = "Text")] #[serde_as(as = "Text")]
pub title: String, pub title: String,
@ -95,48 +95,48 @@ pub struct HeaderRenderer {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct PlaylistHeaderBanner { pub(crate) struct PlaylistHeaderBanner {
pub hero_playlist_thumbnail_renderer: ThumbnailsWrap, pub hero_playlist_thumbnail_renderer: ThumbnailsWrap,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Byline { pub(crate) struct Byline {
pub playlist_byline_renderer: BylineRenderer, pub playlist_byline_renderer: BylineRenderer,
} }
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct BylineRenderer { pub(crate) struct BylineRenderer {
#[serde_as(as = "Text")] #[serde_as(as = "Text")]
pub text: String, pub text: String,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Sidebar { pub(crate) struct Sidebar {
pub playlist_sidebar_renderer: SidebarRenderer, pub playlist_sidebar_renderer: SidebarRenderer,
} }
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct SidebarRenderer { pub(crate) struct SidebarRenderer {
#[serde_as(as = "VecSkipError<_>")] #[serde_as(as = "VecSkipError<_>")]
pub items: Vec<SidebarItemPrimary>, pub items: Vec<SidebarItemPrimary>,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct SidebarItemPrimary { pub(crate) struct SidebarItemPrimary {
pub playlist_sidebar_primary_info_renderer: SidebarPrimaryInfoRenderer, pub playlist_sidebar_primary_info_renderer: SidebarPrimaryInfoRenderer,
} }
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct SidebarPrimaryInfoRenderer { pub(crate) struct SidebarPrimaryInfoRenderer {
pub thumbnail_renderer: PlaylistThumbnailRenderer, pub thumbnail_renderer: PlaylistThumbnailRenderer,
/// - `"495", " videos"` /// - `"495", " videos"`
/// - `"3,310,996 views"` /// - `"3,310,996 views"`
@ -147,7 +147,7 @@ pub struct SidebarPrimaryInfoRenderer {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct PlaylistThumbnailRenderer { pub(crate) struct PlaylistThumbnailRenderer {
// the alternative field name is used by YTM playlists // the alternative field name is used by YTM playlists
#[serde(alias = "playlistCustomThumbnailRenderer")] #[serde(alias = "playlistCustomThumbnailRenderer")]
pub playlist_video_thumbnail_renderer: ThumbnailsWrap, pub playlist_video_thumbnail_renderer: ThumbnailsWrap,
@ -156,7 +156,7 @@ pub struct PlaylistThumbnailRenderer {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub enum PlaylistItem { pub(crate) enum PlaylistItem {
/// Video in playlist /// Video in playlist
PlaylistVideoRenderer(PlaylistVideoRenderer), PlaylistVideoRenderer(PlaylistVideoRenderer),
/// Continauation items are located at the end of a list /// Continauation items are located at the end of a list
@ -174,7 +174,7 @@ pub enum PlaylistItem {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct PlaylistVideoRenderer { pub(crate) struct PlaylistVideoRenderer {
pub video_id: String, pub video_id: String,
pub thumbnail: Thumbnails, pub thumbnail: Thumbnails,
#[serde_as(as = "Text")] #[serde_as(as = "Text")]
@ -203,14 +203,14 @@ impl TryFrom<PlaylistVideoRenderer> for crate::model::PlaylistVideo {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct OnResponseReceivedAction { pub(crate) struct OnResponseReceivedAction {
pub append_continuation_items_action: AppendAction, pub append_continuation_items_action: AppendAction,
} }
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct AppendAction { pub(crate) struct AppendAction {
#[serde_as(as = "VecLogError<_>")] #[serde_as(as = "VecLogError<_>")]
pub continuation_items: MapResult<Vec<PlaylistItem>>, pub continuation_items: MapResult<Vec<PlaylistItem>>,
} }

View file

@ -11,33 +11,33 @@ use super::{
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct PlaylistMusic { pub(crate) struct PlaylistMusic {
pub contents: Contents, pub contents: Contents,
pub header: Header, pub header: Header,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Contents { pub(crate) struct Contents {
pub single_column_browse_results_renderer: ContentsRenderer<Tab>, pub single_column_browse_results_renderer: ContentsRenderer<Tab>,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Tab { pub(crate) struct Tab {
pub tab_renderer: ContentRenderer<SectionList>, pub tab_renderer: ContentRenderer<SectionList>,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct SectionList { pub(crate) struct SectionList {
/// Includes a continuation token for fetching recommendations /// Includes a continuation token for fetching recommendations
pub section_list_renderer: MusicContentsRenderer<ItemSection>, pub section_list_renderer: MusicContentsRenderer<ItemSection>,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ItemSection { pub(crate) struct ItemSection {
#[serde(alias = "musicPlaylistShelfRenderer")] #[serde(alias = "musicPlaylistShelfRenderer")]
pub music_shelf_renderer: MusicShelf, pub music_shelf_renderer: MusicShelf,
} }
@ -45,7 +45,7 @@ pub struct ItemSection {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct MusicShelf { pub(crate) struct MusicShelf {
/// Playlist ID (only for playlists) /// Playlist ID (only for playlists)
pub playlist_id: Option<String>, pub playlist_id: Option<String>,
#[serde_as(as = "VecSkipError<_>")] #[serde_as(as = "VecSkipError<_>")]
@ -57,20 +57,20 @@ pub struct MusicShelf {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct PlaylistMusicItem { pub(crate) struct PlaylistMusicItem {
pub music_responsive_list_item_renderer: MusicItem, pub music_responsive_list_item_renderer: MusicItem,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Header { pub(crate) struct Header {
pub music_detail_header_renderer: HeaderRenderer, pub music_detail_header_renderer: HeaderRenderer,
} }
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct HeaderRenderer { pub(crate) struct HeaderRenderer {
#[serde_as(as = "crate::serializer::text::Text")] #[serde_as(as = "crate::serializer::text::Text")]
pub title: String, pub title: String,
/// Content type + Channel/Artist + Year. /// Content type + Channel/Artist + Year.

View file

@ -6,7 +6,7 @@ use super::video_item::YouTubeListRendererWrap;
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Search { pub(crate) struct Search {
#[serde_as(as = "Option<JsonString>")] #[serde_as(as = "Option<JsonString>")]
pub estimated_results: Option<u64>, pub estimated_results: Option<u64>,
pub contents: Contents, pub contents: Contents,
@ -14,12 +14,12 @@ pub struct Search {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Contents { pub(crate) struct Contents {
pub two_column_search_results_renderer: TwoColumnSearchResultsRenderer, pub two_column_search_results_renderer: TwoColumnSearchResultsRenderer,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct TwoColumnSearchResultsRenderer { pub(crate) struct TwoColumnSearchResultsRenderer {
pub primary_contents: YouTubeListRendererWrap, pub primary_contents: YouTubeListRendererWrap,
} }

View file

@ -5,33 +5,33 @@ use super::{video_item::YouTubeListRendererWrap, ContentRenderer, ResponseContex
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Startpage { pub(crate) struct Startpage {
pub contents: Contents, pub contents: Contents,
pub response_context: ResponseContext, pub response_context: ResponseContext,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Trending { pub(crate) struct Trending {
pub contents: Contents, pub contents: Contents,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Contents { pub(crate) struct Contents {
pub two_column_browse_results_renderer: BrowseResults, pub two_column_browse_results_renderer: BrowseResults,
} }
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct BrowseResults { pub(crate) struct BrowseResults {
#[serde_as(as = "VecSkipError<_>")] #[serde_as(as = "VecSkipError<_>")]
pub tabs: Vec<Tab<YouTubeListRendererWrap>>, pub tabs: Vec<Tab<YouTubeListRendererWrap>>,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Tab<T> { pub(crate) struct Tab<T> {
pub tab_renderer: ContentRenderer<T>, pub tab_renderer: ContentRenderer<T>,
} }

View file

@ -6,14 +6,14 @@ use crate::model::UrlTarget;
/// navigation/resolve_url response model /// navigation/resolve_url response model
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ResolvedUrl { pub(crate) struct ResolvedUrl {
pub endpoint: NavigationEndpoint, pub endpoint: NavigationEndpoint,
} }
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize, Default)] #[derive(Debug, Deserialize, Default)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct NavigationEndpoint { pub(crate) struct NavigationEndpoint {
#[serde(default)] #[serde(default)]
#[serde_as(deserialize_as = "DefaultOnError")] #[serde_as(deserialize_as = "DefaultOnError")]
pub watch_endpoint: Option<WatchEndpoint>, pub watch_endpoint: Option<WatchEndpoint>,
@ -30,7 +30,7 @@ pub struct NavigationEndpoint {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct WatchEndpoint { pub(crate) struct WatchEndpoint {
pub video_id: String, pub video_id: String,
#[serde(default)] #[serde(default)]
pub start_time_seconds: u32, pub start_time_seconds: u32,
@ -38,43 +38,43 @@ pub struct WatchEndpoint {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct BrowseEndpoint { pub(crate) struct BrowseEndpoint {
pub browse_id: String, pub browse_id: String,
pub browse_endpoint_context_supported_configs: Option<BrowseEndpointConfig>, pub browse_endpoint_context_supported_configs: Option<BrowseEndpointConfig>,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct UrlEndpoint { pub(crate) struct UrlEndpoint {
pub url: String, pub url: String,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct BrowseEndpointConfig { pub(crate) struct BrowseEndpointConfig {
pub browse_endpoint_context_music_config: BrowseEndpointMusicConfig, pub browse_endpoint_context_music_config: BrowseEndpointMusicConfig,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct BrowseEndpointMusicConfig { pub(crate) struct BrowseEndpointMusicConfig {
pub page_type: PageType, pub page_type: PageType,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct CommandMetadata { pub(crate) struct CommandMetadata {
pub web_command_metadata: WebCommandMetadata, pub web_command_metadata: WebCommandMetadata,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct WebCommandMetadata { pub(crate) struct WebCommandMetadata {
pub web_page_type: PageType, pub web_page_type: PageType,
} }
#[derive(Debug, Clone, Copy, Deserialize, PartialEq, Eq)] #[derive(Debug, Clone, Copy, Deserialize, PartialEq, Eq)]
pub enum PageType { pub(crate) enum PageType {
#[serde(rename = "MUSIC_PAGE_TYPE_ARTIST")] #[serde(rename = "MUSIC_PAGE_TYPE_ARTIST")]
Artist, Artist,
#[serde(rename = "MUSIC_PAGE_TYPE_ALBUM")] #[serde(rename = "MUSIC_PAGE_TYPE_ALBUM")]
@ -89,7 +89,7 @@ pub enum PageType {
} }
impl PageType { impl PageType {
pub fn to_url_target(self, id: String) -> UrlTarget { pub(crate) fn to_url_target(self, id: String) -> UrlTarget {
match self { match self {
PageType::Artist => UrlTarget::Channel { id }, PageType::Artist => UrlTarget::Channel { id },
PageType::Album => UrlTarget::Playlist { id }, PageType::Album => UrlTarget::Playlist { id },

View file

@ -24,7 +24,7 @@ use super::{ResponseContext, YouTubeListItem};
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct VideoDetails { pub(crate) struct VideoDetails {
/// Video metadata + recommended videos /// Video metadata + recommended videos
pub contents: Option<Contents>, pub contents: Option<Contents>,
/// Video ID /// Video ID
@ -38,13 +38,13 @@ pub struct VideoDetails {
/// Video details main object, contains video metadata and recommended videos /// Video details main object, contains video metadata and recommended videos
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Contents { pub(crate) struct Contents {
pub two_column_watch_next_results: TwoColumnWatchNextResults, pub two_column_watch_next_results: TwoColumnWatchNextResults,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct TwoColumnWatchNextResults { pub(crate) struct TwoColumnWatchNextResults {
/// Metadata about the video /// Metadata about the video
pub results: VideoResultsWrap, pub results: VideoResultsWrap,
/// Video recommendations /// Video recommendations
@ -56,7 +56,7 @@ pub struct TwoColumnWatchNextResults {
/// Metadata about the video /// Metadata about the video
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct VideoResultsWrap { pub(crate) struct VideoResultsWrap {
pub results: VideoResults, pub results: VideoResults,
} }
@ -64,7 +64,7 @@ pub struct VideoResultsWrap {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct VideoResults { pub(crate) struct VideoResults {
#[serde_as(as = "VecLogError<_>")] #[serde_as(as = "VecLogError<_>")]
pub contents: MapResult<Vec<VideoResultsItem>>, pub contents: MapResult<Vec<VideoResultsItem>>,
} }
@ -73,7 +73,7 @@ pub struct VideoResults {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub enum VideoResultsItem { pub(crate) enum VideoResultsItem {
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
VideoPrimaryInfoRenderer { VideoPrimaryInfoRenderer {
#[serde_as(as = "Text")] #[serde_as(as = "Text")]
@ -107,14 +107,14 @@ pub enum VideoResultsItem {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ViewCount { pub(crate) struct ViewCount {
pub video_view_count_renderer: ViewCountRenderer, pub video_view_count_renderer: ViewCountRenderer,
} }
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ViewCountRenderer { pub(crate) struct ViewCountRenderer {
/// View count (`232,975,196 views`) /// View count (`232,975,196 views`)
#[serde_as(as = "Text")] #[serde_as(as = "Text")]
pub view_count: String, pub view_count: String,
@ -125,7 +125,7 @@ pub struct ViewCountRenderer {
/// Like/Dislike buttons /// Like/Dislike buttons
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct VideoActions { pub(crate) struct VideoActions {
pub menu_renderer: VideoActionsMenu, pub menu_renderer: VideoActionsMenu,
} }
@ -133,7 +133,7 @@ pub struct VideoActions {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct VideoActionsMenu { pub(crate) struct VideoActionsMenu {
#[serde_as(as = "VecSkipError<_>")] #[serde_as(as = "VecSkipError<_>")]
pub top_level_buttons: Vec<TopLevelButton>, pub top_level_buttons: Vec<TopLevelButton>,
} }
@ -146,7 +146,7 @@ pub struct VideoActionsMenu {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub enum TopLevelButton { pub(crate) enum TopLevelButton {
ToggleButtonRenderer(ToggleButton), ToggleButtonRenderer(ToggleButton),
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
SegmentedLikeDislikeButtonRenderer { SegmentedLikeDislikeButtonRenderer {
@ -157,7 +157,7 @@ pub enum TopLevelButton {
/// Like/Dislike button /// Like/Dislike button
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ToggleButtonWrap { pub(crate) struct ToggleButtonWrap {
pub toggle_button_renderer: ToggleButton, pub toggle_button_renderer: ToggleButton,
} }
@ -165,7 +165,7 @@ pub struct ToggleButtonWrap {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ToggleButton { pub(crate) struct ToggleButton {
/// Icon type: `LIKE` / `DISLIKE` /// Icon type: `LIKE` / `DISLIKE`
pub default_icon: Icon, pub default_icon: Icon,
/// Number of likes (`like this video along with 4,010,156 other people`) /// Number of likes (`like this video along with 4,010,156 other people`)
@ -179,7 +179,7 @@ pub struct ToggleButton {
/// the Creative Commonse License. /// the Creative Commonse License.
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct MetadataRowContainer { pub(crate) struct MetadataRowContainer {
pub metadata_row_container_renderer: MetadataRowContainerRenderer, pub metadata_row_container_renderer: MetadataRowContainerRenderer,
} }
@ -187,14 +187,14 @@ pub struct MetadataRowContainer {
/// the Creative Commonse License. /// the Creative Commonse License.
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct MetadataRowContainerRenderer { pub(crate) struct MetadataRowContainerRenderer {
pub rows: Vec<MetadataRow>, pub rows: Vec<MetadataRow>,
} }
/// Additional video metadata item (Creative Commons License) /// Additional video metadata item (Creative Commons License)
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct MetadataRow { pub(crate) struct MetadataRow {
pub metadata_row_renderer: MetadataRowRenderer, pub metadata_row_renderer: MetadataRowRenderer,
} }
@ -202,7 +202,7 @@ pub struct MetadataRow {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct MetadataRowRenderer { pub(crate) struct MetadataRowRenderer {
// `License` // `License`
// #[serde_as(as = "Text")] // #[serde_as(as = "Text")]
// pub title: String, // pub title: String,
@ -217,13 +217,13 @@ pub struct MetadataRowRenderer {
/// Contains current video ID /// Contains current video ID
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct CurrentVideoEndpoint { pub(crate) struct CurrentVideoEndpoint {
pub watch_endpoint: CurrentVideoWatchEndpoint, pub watch_endpoint: CurrentVideoWatchEndpoint,
} }
/// Contains current video ID /// Contains current video ID
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct CurrentVideoWatchEndpoint { pub(crate) struct CurrentVideoWatchEndpoint {
pub video_id: String, pub video_id: String,
} }
@ -234,7 +234,7 @@ pub struct CurrentVideoWatchEndpoint {
#[serde_as] #[serde_as]
#[derive(Default, Debug, Deserialize)] #[derive(Default, Debug, Deserialize)]
#[serde(rename_all = "kebab-case", tag = "sectionIdentifier")] #[serde(rename_all = "kebab-case", tag = "sectionIdentifier")]
pub enum ItemSection { pub(crate) enum ItemSection {
CommentsEntryPoint { CommentsEntryPoint {
#[serde_as(as = "VecSkipError<_>")] #[serde_as(as = "VecSkipError<_>")]
contents: Vec<ItemSectionCommentCount>, contents: Vec<ItemSectionCommentCount>,
@ -250,7 +250,7 @@ pub enum ItemSection {
/// Item section containing comment count /// Item section containing comment count
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ItemSectionCommentCount { pub(crate) struct ItemSectionCommentCount {
pub comments_entry_point_header_renderer: CommentsEntryPointHeaderRenderer, pub comments_entry_point_header_renderer: CommentsEntryPointHeaderRenderer,
} }
@ -258,7 +258,7 @@ pub struct ItemSectionCommentCount {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct CommentsEntryPointHeaderRenderer { pub(crate) struct CommentsEntryPointHeaderRenderer {
#[serde_as(as = "Text")] #[serde_as(as = "Text")]
pub comment_count: String, pub comment_count: String,
} }
@ -266,14 +266,14 @@ pub struct CommentsEntryPointHeaderRenderer {
/// Item section containing comments ctoken /// Item section containing comments ctoken
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ItemSectionComments { pub(crate) struct ItemSectionComments {
pub continuation_item_renderer: ContinuationItemRenderer, pub continuation_item_renderer: ContinuationItemRenderer,
} }
/// Video recommendations /// Video recommendations
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct RecommendationResultsWrap { pub(crate) struct RecommendationResultsWrap {
pub secondary_results: RecommendationResults, pub secondary_results: RecommendationResults,
} }
@ -281,7 +281,7 @@ pub struct RecommendationResultsWrap {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct RecommendationResults { pub(crate) struct RecommendationResults {
/// Can be `None` for age-restricted videos /// Can be `None` for age-restricted videos
#[serde_as(as = "Option<VecLogError<_>>")] #[serde_as(as = "Option<VecLogError<_>>")]
pub results: Option<MapResult<Vec<YouTubeListItem>>>, pub results: Option<MapResult<Vec<YouTubeListItem>>>,
@ -293,7 +293,7 @@ pub struct RecommendationResults {
/// and the comment section. /// and the comment section.
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct EngagementPanel { pub(crate) struct EngagementPanel {
pub engagement_panel_section_list_renderer: EngagementPanelRenderer, pub engagement_panel_section_list_renderer: EngagementPanelRenderer,
} }
@ -301,7 +301,7 @@ pub struct EngagementPanel {
/// and the comment section. /// and the comment section.
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "kebab-case", tag = "targetId")] #[serde(rename_all = "kebab-case", tag = "targetId")]
pub enum EngagementPanelRenderer { pub(crate) enum EngagementPanelRenderer {
/// Chapter markers /// Chapter markers
EngagementPanelMacroMarkersDescriptionChapters { content: ChapterMarkersContent }, EngagementPanelMacroMarkersDescriptionChapters { content: ChapterMarkersContent },
/// Comment section (contains no comments, but the /// Comment section (contains no comments, but the
@ -320,7 +320,7 @@ pub enum EngagementPanelRenderer {
/// Chapter markers /// Chapter markers
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ChapterMarkersContent { pub(crate) struct ChapterMarkersContent {
pub macro_markers_list_renderer: MacroMarkersListRenderer, pub macro_markers_list_renderer: MacroMarkersListRenderer,
} }
@ -328,7 +328,7 @@ pub struct ChapterMarkersContent {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct MacroMarkersListRenderer { pub(crate) struct MacroMarkersListRenderer {
#[serde_as(as = "VecLogError<_>")] #[serde_as(as = "VecLogError<_>")]
pub contents: MapResult<Vec<MacroMarkersListItem>>, pub contents: MapResult<Vec<MacroMarkersListItem>>,
} }
@ -336,7 +336,7 @@ pub struct MacroMarkersListRenderer {
/// Chapter marker /// Chapter marker
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct MacroMarkersListItem { pub(crate) struct MacroMarkersListItem {
pub macro_markers_list_item_renderer: MacroMarkersListItemRenderer, pub macro_markers_list_item_renderer: MacroMarkersListItemRenderer,
} }
@ -344,7 +344,7 @@ pub struct MacroMarkersListItem {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct MacroMarkersListItemRenderer { pub(crate) struct MacroMarkersListItemRenderer {
/// Contains chapter start time in seconds /// Contains chapter start time in seconds
pub on_tap: MacroMarkersListItemOnTap, pub on_tap: MacroMarkersListItemOnTap,
#[serde(default)] #[serde(default)]
@ -357,13 +357,13 @@ pub struct MacroMarkersListItemRenderer {
/// Contains chapter start time in seconds /// Contains chapter start time in seconds
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct MacroMarkersListItemOnTap { pub(crate) struct MacroMarkersListItemOnTap {
pub watch_endpoint: MacroMarkersListItemWatchEndpoint, pub watch_endpoint: MacroMarkersListItemWatchEndpoint,
} }
/// Contains chapter start time in seconds /// Contains chapter start time in seconds
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct MacroMarkersListItemWatchEndpoint { pub(crate) struct MacroMarkersListItemWatchEndpoint {
/// Chapter start time in seconds /// Chapter start time in seconds
pub start_time_seconds: u32, pub start_time_seconds: u32,
} }
@ -372,7 +372,7 @@ pub struct MacroMarkersListItemWatchEndpoint {
/// (contains continuation tokens for fetching top/latest comments) /// (contains continuation tokens for fetching top/latest comments)
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct CommentItemSectionHeader { pub(crate) struct CommentItemSectionHeader {
pub engagement_panel_title_header_renderer: CommentItemSectionHeaderRenderer, pub engagement_panel_title_header_renderer: CommentItemSectionHeaderRenderer,
} }
@ -381,7 +381,7 @@ pub struct CommentItemSectionHeader {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct CommentItemSectionHeaderRenderer { pub(crate) struct CommentItemSectionHeaderRenderer {
/// Approximate comment count (e.g. `81`, `2.2K`, `705K`) /// Approximate comment count (e.g. `81`, `2.2K`, `705K`)
/// ///
/// The accurate count is included in the first comment response. /// The accurate count is included in the first comment response.
@ -395,7 +395,7 @@ pub struct CommentItemSectionHeaderRenderer {
/// Comment section menu /// Comment section menu
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct CommentItemSectionHeaderMenu { pub(crate) struct CommentItemSectionHeaderMenu {
pub sort_filter_sub_menu_renderer: CommentItemSectionHeaderMenuRenderer, pub sort_filter_sub_menu_renderer: CommentItemSectionHeaderMenuRenderer,
} }
@ -406,14 +406,14 @@ pub struct CommentItemSectionHeaderMenu {
/// - Latest comments /// - Latest comments
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct CommentItemSectionHeaderMenuRenderer { pub(crate) struct CommentItemSectionHeaderMenuRenderer {
pub sub_menu_items: Vec<CommentItemSectionHeaderMenuItem>, pub sub_menu_items: Vec<CommentItemSectionHeaderMenuItem>,
} }
/// Comment section menu item /// Comment section menu item
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct CommentItemSectionHeaderMenuItem { pub(crate) struct CommentItemSectionHeaderMenuItem {
/// Continuation token for fetching comments /// Continuation token for fetching comments
pub service_endpoint: ContinuationEndpoint, pub service_endpoint: ContinuationEndpoint,
} }
@ -426,7 +426,7 @@ pub struct CommentItemSectionHeaderMenuItem {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct VideoComments { pub(crate) struct VideoComments {
/// - Initial response: 2*reloadContinuationItemsCommand /// - Initial response: 2*reloadContinuationItemsCommand
/// - 1*commentsHeaderRenderer: number of comments /// - 1*commentsHeaderRenderer: number of comments
/// - n*commentThreadRenderer, continuationItemRenderer: /// - n*commentThreadRenderer, continuationItemRenderer:
@ -444,7 +444,7 @@ pub struct VideoComments {
/// Video comments continuation /// Video comments continuation
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct CommentsContItem { pub(crate) struct CommentsContItem {
#[serde(alias = "reloadContinuationItemsCommand")] #[serde(alias = "reloadContinuationItemsCommand")]
pub append_continuation_items_action: AppendComments, pub append_continuation_items_action: AppendComments,
} }
@ -453,7 +453,7 @@ pub struct CommentsContItem {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct AppendComments { pub(crate) struct AppendComments {
#[serde_as(as = "VecLogError<_>")] #[serde_as(as = "VecLogError<_>")]
pub continuation_items: MapResult<Vec<CommentListItem>>, pub continuation_items: MapResult<Vec<CommentListItem>>,
} }
@ -461,7 +461,7 @@ pub struct AppendComments {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub enum CommentListItem { pub(crate) enum CommentListItem {
/// Top-level comment /// Top-level comment
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
CommentThreadRenderer { CommentThreadRenderer {
@ -491,14 +491,14 @@ pub enum CommentListItem {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Comment { pub(crate) struct Comment {
pub comment_renderer: CommentRenderer, pub comment_renderer: CommentRenderer,
} }
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct CommentRenderer { pub(crate) struct CommentRenderer {
/// Author name /// Author name
/// ///
/// There may be comments with missing authors (possibly deleted users?) /// There may be comments with missing authors (possibly deleted users?)
@ -529,13 +529,13 @@ pub struct CommentRenderer {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct AuthorEndpoint { pub(crate) struct AuthorEndpoint {
pub browse_endpoint: BrowseEndpoint, pub browse_endpoint: BrowseEndpoint,
} }
#[derive(Default, Clone, Copy, Debug, Deserialize, PartialEq, Eq)] #[derive(Default, Clone, Copy, Debug, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum CommentPriority { pub(crate) enum CommentPriority {
/// Default rendering priority /// Default rendering priority
#[default] #[default]
RenderingPriorityUnknown, RenderingPriorityUnknown,
@ -547,7 +547,7 @@ pub enum CommentPriority {
/// for fetching them. /// for fetching them.
#[derive(Default, Debug, Deserialize)] #[derive(Default, Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Replies { pub(crate) struct Replies {
pub comment_replies_renderer: RepliesRenderer, pub comment_replies_renderer: RepliesRenderer,
} }
@ -556,7 +556,7 @@ pub struct Replies {
#[serde_as] #[serde_as]
#[derive(Default, Debug, Deserialize)] #[derive(Default, Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct RepliesRenderer { pub(crate) struct RepliesRenderer {
#[serde_as(as = "VecSkipError<_>")] #[serde_as(as = "VecSkipError<_>")]
pub contents: Vec<CommentListItem>, pub contents: Vec<CommentListItem>,
} }
@ -565,7 +565,7 @@ pub struct RepliesRenderer {
/// Contains the CreatorHeart. /// Contains the CreatorHeart.
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct CommentActionButtons { pub(crate) struct CommentActionButtons {
pub comment_action_buttons_renderer: CommentActionButtonsRenderer, pub comment_action_buttons_renderer: CommentActionButtonsRenderer,
} }
@ -573,7 +573,7 @@ pub struct CommentActionButtons {
/// Contains the CreatorHeart. /// Contains the CreatorHeart.
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct CommentActionButtonsRenderer { pub(crate) struct CommentActionButtonsRenderer {
pub like_button: ToggleButtonWrap, pub like_button: ToggleButtonWrap,
pub creator_heart: Option<CreatorHeart>, pub creator_heart: Option<CreatorHeart>,
} }
@ -581,27 +581,27 @@ pub struct CommentActionButtonsRenderer {
/// Video creators can endorse comments by marking them with a ❤️. /// Video creators can endorse comments by marking them with a ❤️.
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct CreatorHeart { pub(crate) struct CreatorHeart {
pub creator_heart_renderer: CreatorHeartRenderer, pub creator_heart_renderer: CreatorHeartRenderer,
} }
/// Video creators can endorse comments by marking them with a ❤️. /// Video creators can endorse comments by marking them with a ❤️.
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct CreatorHeartRenderer { pub(crate) struct CreatorHeartRenderer {
pub is_hearted: bool, pub is_hearted: bool,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct AuthorCommentBadge { pub(crate) struct AuthorCommentBadge {
pub author_comment_badge_renderer: AuthorCommentBadgeRenderer, pub author_comment_badge_renderer: AuthorCommentBadgeRenderer,
} }
/// YouTube channel badge (verified) of the comment author /// YouTube channel badge (verified) of the comment author
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct AuthorCommentBadgeRenderer { pub(crate) struct AuthorCommentBadgeRenderer {
/// Verified: `CHECK` /// Verified: `CHECK`
/// ///
/// Artist: `OFFICIAL_ARTIST_BADGE` /// Artist: `OFFICIAL_ARTIST_BADGE`

View file

@ -18,7 +18,7 @@ use crate::{
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub enum YouTubeListItem { pub(crate) enum YouTubeListItem {
#[serde(alias = "gridVideoRenderer", alias = "compactVideoRenderer")] #[serde(alias = "gridVideoRenderer", alias = "compactVideoRenderer")]
VideoRenderer(VideoRenderer), VideoRenderer(VideoRenderer),
@ -73,7 +73,7 @@ pub enum YouTubeListItem {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct VideoRenderer { pub(crate) struct VideoRenderer {
pub video_id: String, pub video_id: String,
pub thumbnail: Thumbnails, pub thumbnail: Thumbnails,
#[serde_as(as = "Text")] #[serde_as(as = "Text")]
@ -114,7 +114,7 @@ pub struct VideoRenderer {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct PlaylistRenderer { pub(crate) struct PlaylistRenderer {
pub playlist_id: String, pub playlist_id: String,
#[serde_as(as = "Text")] #[serde_as(as = "Text")]
pub title: String, pub title: String,
@ -140,7 +140,7 @@ pub struct PlaylistRenderer {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ChannelRenderer { pub(crate) struct ChannelRenderer {
pub channel_id: String, pub channel_id: String,
#[serde_as(as = "Text")] #[serde_as(as = "Text")]
pub title: String, pub title: String,
@ -164,7 +164,7 @@ pub struct ChannelRenderer {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct YouTubeListRendererWrap { pub(crate) struct YouTubeListRendererWrap {
#[serde(alias = "richGridRenderer")] #[serde(alias = "richGridRenderer")]
pub section_list_renderer: YouTubeListRenderer, pub section_list_renderer: YouTubeListRenderer,
} }
@ -172,7 +172,7 @@ pub struct YouTubeListRendererWrap {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct YouTubeListRenderer { pub(crate) struct YouTubeListRenderer {
#[serde_as(as = "VecLogError<_>")] #[serde_as(as = "VecLogError<_>")]
pub contents: MapResult<Vec<YouTubeListItem>>, pub contents: MapResult<Vec<YouTubeListItem>>,
} }
@ -180,7 +180,7 @@ pub struct YouTubeListRenderer {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct UpcomingEventData { pub(crate) struct UpcomingEventData {
/// Unixtime in seconds /// Unixtime in seconds
#[serde_as(as = "JsonString")] #[serde_as(as = "JsonString")]
pub start_time: i64, pub start_time: i64,
@ -188,7 +188,7 @@ pub struct UpcomingEventData {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct TimeOverlay { pub(crate) struct TimeOverlay {
pub thumbnail_overlay_time_status_renderer: TimeOverlayRenderer, pub thumbnail_overlay_time_status_renderer: TimeOverlayRenderer,
} }
@ -196,7 +196,7 @@ pub struct TimeOverlay {
/// show certain video properties (e.g. active livestream) /// show certain video properties (e.g. active livestream)
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct VideoBadge { pub(crate) struct VideoBadge {
pub metadata_badge_renderer: VideoBadgeRenderer, pub metadata_badge_renderer: VideoBadgeRenderer,
} }
@ -204,13 +204,13 @@ pub struct VideoBadge {
/// show certain video properties (e.g. active livestream) /// show certain video properties (e.g. active livestream)
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct VideoBadgeRenderer { pub(crate) struct VideoBadgeRenderer {
pub style: VideoBadgeStyle, pub style: VideoBadgeStyle,
} }
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, Hash)] #[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, Hash)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum VideoBadgeStyle { pub(crate) enum VideoBadgeStyle {
/// Active livestream /// Active livestream
BadgeStyleTypeLiveNow, BadgeStyleTypeLiveNow,
} }
@ -218,7 +218,7 @@ pub enum VideoBadgeStyle {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct TimeOverlayRenderer { pub(crate) struct TimeOverlayRenderer {
/// `29:54` /// `29:54`
/// ///
/// Is `LIVE` in case of a livestream and `SHORTS` in case of a short video /// Is `LIVE` in case of a livestream and `SHORTS` in case of a short video
@ -231,7 +231,7 @@ pub struct TimeOverlayRenderer {
#[derive(Default, Clone, Copy, Debug, Deserialize, PartialEq, Eq)] #[derive(Default, Clone, Copy, Debug, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum TimeOverlayStyle { pub(crate) enum TimeOverlayStyle {
#[default] #[default]
Default, Default,
Live, Live,
@ -241,20 +241,20 @@ pub enum TimeOverlayStyle {
#[serde_as] #[serde_as]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct DetailedMetadataSnippet { pub(crate) struct DetailedMetadataSnippet {
#[serde_as(as = "Text")] #[serde_as(as = "Text")]
pub snippet_text: String, pub snippet_text: String,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ChannelThumbnailSupportedRenderers { pub(crate) struct ChannelThumbnailSupportedRenderers {
pub channel_thumbnail_with_link_renderer: ChannelThumbnailWithLinkRenderer, pub channel_thumbnail_with_link_renderer: ChannelThumbnailWithLinkRenderer,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ChannelThumbnailWithLinkRenderer { pub(crate) struct ChannelThumbnailWithLinkRenderer {
pub thumbnail: Thumbnails, pub thumbnail: Thumbnails,
} }
@ -293,7 +293,7 @@ impl IsShort for Vec<TimeOverlay> {
/// Result of mapping a list of different YouTube enities /// Result of mapping a list of different YouTube enities
/// (videos, channels, playlists) /// (videos, channels, playlists)
#[derive(Debug)] #[derive(Debug)]
pub struct YouTubeListMapper<T> { pub(crate) struct YouTubeListMapper<T> {
lang: Language, lang: Language,
pub items: Vec<T>, pub items: Vec<T>,
pub warnings: Vec<String>, pub warnings: Vec<String>,
@ -442,7 +442,7 @@ impl YouTubeListMapper<YouTubeItem> {
} }
} }
pub fn map_response(&mut self, mut res: MapResult<Vec<YouTubeListItem>>) { pub(crate) fn map_response(&mut self, mut res: MapResult<Vec<YouTubeListItem>>) {
self.warnings.append(&mut res.warnings); self.warnings.append(&mut res.warnings);
res.c.into_iter().for_each(|item| self.map_item(item)); res.c.into_iter().for_each(|item| self.map_item(item));
} }
@ -471,7 +471,7 @@ impl YouTubeListMapper<VideoItem> {
} }
} }
pub fn map_response(&mut self, mut res: MapResult<Vec<YouTubeListItem>>) { pub(crate) fn map_response(&mut self, mut res: MapResult<Vec<YouTubeListItem>>) {
self.warnings.append(&mut res.warnings); self.warnings.append(&mut res.warnings);
res.c.into_iter().for_each(|item| self.map_item(item)); res.c.into_iter().for_each(|item| self.map_item(item));
} }
@ -500,7 +500,7 @@ impl YouTubeListMapper<PlaylistItem> {
} }
} }
pub fn map_response(&mut self, mut res: MapResult<Vec<YouTubeListItem>>) { pub(crate) fn map_response(&mut self, mut res: MapResult<Vec<YouTubeListItem>>) {
self.warnings.append(&mut res.warnings); self.warnings.append(&mut res.warnings);
res.c.into_iter().for_each(|item| self.map_item(item)); res.c.into_iter().for_each(|item| self.map_item(item));
} }

View file

@ -42,7 +42,7 @@ use crate::{
#[serde_as] #[serde_as]
#[derive(Clone, Debug, Deserialize)] #[derive(Clone, Debug, Deserialize)]
#[serde(untagged)] #[serde(untagged)]
pub enum Text { pub(crate) enum Text {
Simple { Simple {
#[serde(alias = "simpleText")] #[serde(alias = "simpleText")]
text: String, text: String,
@ -86,10 +86,10 @@ impl<'de> DeserializeAs<'de, Vec<String>> for Text {
/// ///
/// Texts with links are mapped as a list of text components. /// Texts with links are mapped as a list of text components.
#[derive(Default, Debug, Clone)] #[derive(Default, Debug, Clone)]
pub struct TextComponents(pub Vec<TextComponent>); pub(crate) struct TextComponents(pub Vec<TextComponent>);
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum TextComponent { pub(crate) enum TextComponent {
Video { Video {
text: String, text: String,
video_id: String, video_id: String,
@ -130,7 +130,7 @@ struct RichTextRun {
/// the links. /// the links.
#[derive(Deserialize)] #[derive(Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct AttributedText { pub(crate) struct AttributedText {
content: String, content: String,
#[serde(default)] #[serde(default)]
command_runs: Vec<AttributedTextRun>, command_runs: Vec<AttributedTextRun>,
@ -345,7 +345,7 @@ impl From<TextComponents> for crate::model::richtext::RichText {
#[derive(Deserialize)] #[derive(Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct AccessibilityText { pub(crate) struct AccessibilityText {
accessibility_data: AccessibilityData, accessibility_data: AccessibilityData,
} }