diff --git a/src/client/response/channel.rs b/src/client/response/channel.rs index b6872bd..2aaa72f 100644 --- a/src/client/response/channel.rs +++ b/src/client/response/channel.rs @@ -12,7 +12,7 @@ use crate::serializer::{text::Text, MapResult, VecLogError}; #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Channel { +pub(crate) struct Channel { #[serde(default)] #[serde_as(as = "DefaultOnError")] pub header: Option
, @@ -25,7 +25,7 @@ pub struct Channel { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Contents { +pub(crate) struct Contents { pub two_column_browse_results_renderer: TabsRenderer, } @@ -34,21 +34,21 @@ pub struct Contents { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TabsRenderer { +pub(crate) struct TabsRenderer { #[serde_as(as = "VecSkipError<_>")] pub tabs: Vec, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TabRendererWrap { +pub(crate) struct TabRendererWrap { pub tab_renderer: ContentRenderer, } #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TabContent { +pub(crate) struct TabContent { #[serde(default)] #[serde_as(as = "DefaultOnError")] pub section_list_renderer: Option, @@ -60,7 +60,7 @@ pub struct TabContent { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SectionListRenderer { +pub(crate) struct SectionListRenderer { pub contents: Vec, /// - **Videos**: browse-feedUC2DjFE7Xf11URZqWBigcVOQvideos (...) /// - **Playlists**: browse-feedUC2DjFE7Xf11URZqWBigcVOQplaylists104 (...) @@ -72,7 +72,7 @@ pub struct SectionListRenderer { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RichGridRenderer { +pub(crate) struct RichGridRenderer { #[serde_as(as = "VecLogError<_>")] pub contents: MapResult>, /// - **Videos**: browse-feedUC2DjFE7Xf11URZqWBigcVOQvideos (...) @@ -83,14 +83,14 @@ pub struct RichGridRenderer { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ItemSectionRendererWrap { +pub(crate) struct ItemSectionRendererWrap { pub item_section_renderer: ContentsRenderer, } #[serde_as] #[derive(Default, Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub enum ChannelContent { +pub(crate) enum ChannelContent { GridRenderer { #[serde_as(as = "VecLogError<_>")] items: MapResult>, @@ -103,7 +103,7 @@ pub enum ChannelContent { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub enum Header { +pub(crate) enum Header { C4TabbedHeaderRenderer(HeaderRenderer), /// Used for special channels like YouTube Music CarouselHeaderRenderer(ContentsRenderer), @@ -112,7 +112,7 @@ pub enum Header { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct HeaderRenderer { +pub(crate) struct HeaderRenderer { /// Approximate subscriber count (e.g. `880K subscribers`), depends on language. /// /// `None` if the subscriber count is hidden. @@ -134,7 +134,7 @@ pub struct HeaderRenderer { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub enum CarouselHeaderRendererItem { +pub(crate) enum CarouselHeaderRendererItem { #[serde(rename_all = "camelCase")] TopicChannelDetailsRenderer { #[serde_as(as = "Option")] @@ -148,13 +148,13 @@ pub enum CarouselHeaderRendererItem { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Metadata { +pub(crate) struct Metadata { pub channel_metadata_renderer: ChannelMetadataRenderer, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ChannelMetadataRenderer { +pub(crate) struct ChannelMetadataRenderer { pub title: String, /// Channel ID pub external_id: String, @@ -164,13 +164,13 @@ pub struct ChannelMetadataRenderer { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Microformat { +pub(crate) struct Microformat { pub microformat_data_renderer: MicroformatDataRenderer, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MicroformatDataRenderer { +pub(crate) struct MicroformatDataRenderer { #[serde(default)] pub tags: Vec, } @@ -178,7 +178,7 @@ pub struct MicroformatDataRenderer { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ChannelFullMetadata { +pub(crate) struct ChannelFullMetadata { #[serde_as(as = "Text")] pub joined_date_text: String, #[serde_as(as = "Option")] @@ -191,7 +191,7 @@ pub struct ChannelFullMetadata { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PrimaryLink { +pub(crate) struct PrimaryLink { #[serde_as(as = "Text")] pub title: String, pub navigation_endpoint: NavigationEndpoint, diff --git a/src/client/response/channel_rss.rs b/src/client/response/channel_rss.rs index 205f103..456aec4 100644 --- a/src/client/response/channel_rss.rs +++ b/src/client/response/channel_rss.rs @@ -4,7 +4,7 @@ use serde::Deserialize; use super::Thumbnail; #[derive(Debug, Deserialize)] -pub struct ChannelRss { +pub(crate) struct ChannelRss { #[serde(rename = "$unflatten=yt:channelId")] pub channel_id: String, #[serde(rename = "$unflatten=title")] @@ -15,7 +15,7 @@ pub struct ChannelRss { } #[derive(Debug, Deserialize)] -pub struct Entry { +pub(crate) struct Entry { #[serde(rename = "$unflatten=yt:videoId")] pub video_id: String, #[serde(rename = "$unflatten=title")] @@ -29,7 +29,7 @@ pub struct Entry { } #[derive(Debug, Deserialize)] -pub struct MediaGroup { +pub(crate) struct MediaGroup { #[serde(rename = "$unflatten=media:thumbnail")] pub thumbnail: Thumbnail, #[serde(rename = "$unflatten=media:description")] @@ -39,7 +39,7 @@ pub struct MediaGroup { } #[derive(Debug, Deserialize)] -pub struct Community { +pub(crate) struct Community { #[serde(rename = "$unflatten=media:starRating")] pub rating: Rating, #[serde(rename = "$unflatten=media:statistics")] @@ -47,12 +47,12 @@ pub struct Community { } #[derive(Debug, Deserialize)] -pub struct Rating { +pub(crate) struct Rating { pub count: u64, } #[derive(Debug, Deserialize)] -pub struct Statistics { +pub(crate) struct Statistics { pub views: u64, } diff --git a/src/client/response/mod.rs b/src/client/response/mod.rs index 595bf51..d5ab14a 100644 --- a/src/client/response/mod.rs +++ b/src/client/response/mod.rs @@ -1,31 +1,31 @@ -pub mod channel; -pub mod player; -pub mod playlist; -pub mod playlist_music; -pub mod search; -pub mod trends; -pub mod url_endpoint; -pub mod video_details; -pub mod video_item; +pub(crate) mod channel; +pub(crate) mod player; +pub(crate) mod playlist; +pub(crate) mod playlist_music; +pub(crate) mod search; +pub(crate) mod trends; +pub(crate) mod url_endpoint; +pub(crate) mod video_details; +pub(crate) mod video_item; -pub use channel::Channel; -pub use player::Player; -pub use playlist::Playlist; -pub use playlist::PlaylistCont; -pub use playlist_music::PlaylistMusic; -pub use search::Search; -pub use trends::Startpage; -pub use trends::Trending; -pub use url_endpoint::ResolvedUrl; -pub use video_details::VideoComments; -pub use video_details::VideoDetails; -pub use video_item::YouTubeListItem; -pub use video_item::YouTubeListMapper; +pub(crate) use channel::Channel; +pub(crate) use player::Player; +pub(crate) use playlist::Playlist; +pub(crate) use playlist::PlaylistCont; +pub(crate) use playlist_music::PlaylistMusic; +pub(crate) use search::Search; +pub(crate) use trends::Startpage; +pub(crate) use trends::Trending; +pub(crate) use url_endpoint::ResolvedUrl; +pub(crate) use video_details::VideoComments; +pub(crate) use video_details::VideoDetails; +pub(crate) use video_item::YouTubeListItem; +pub(crate) use video_item::YouTubeListMapper; #[cfg(feature = "rss")] -pub mod channel_rss; +pub(crate) mod channel_rss; #[cfg(feature = "rss")] -pub use channel_rss::ChannelRss; +pub(crate) use channel_rss::ChannelRss; use serde::Deserialize; use serde_with::{json::JsonString, serde_as, DefaultOnError, VecSkipError}; @@ -39,20 +39,20 @@ use crate::serializer::{ #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ContentRenderer { +pub(crate) struct ContentRenderer { pub content: T, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ContentsRenderer { +pub(crate) struct ContentsRenderer { #[serde(alias = "tabs")] pub contents: Vec, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ThumbnailsWrap { +pub(crate) struct ThumbnailsWrap { #[serde(default)] pub thumbnail: Thumbnails, } @@ -61,14 +61,14 @@ pub struct ThumbnailsWrap { /// Not only used for thumbnails, but also for avatars and banners. #[derive(Default, Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Thumbnails { +pub(crate) struct Thumbnails { #[serde(default)] pub thumbnails: Vec, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Thumbnail { +pub(crate) struct Thumbnail { pub url: String, pub width: u32, pub height: u32, @@ -76,32 +76,32 @@ pub struct Thumbnail { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ContinuationItemRenderer { +pub(crate) struct ContinuationItemRenderer { pub continuation_endpoint: ContinuationEndpoint, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ContinuationEndpoint { +pub(crate) struct ContinuationEndpoint { pub continuation_command: ContinuationCommand, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ContinuationCommand { +pub(crate) struct ContinuationCommand { pub token: String, } #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Icon { +pub(crate) struct Icon { pub icon_type: IconType, } #[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, Hash)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] -pub enum IconType { +pub(crate) enum IconType { /// Checkmark for verified channels Check, /// Music note for verified artists @@ -112,14 +112,14 @@ pub enum IconType { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct VideoOwner { +pub(crate) struct VideoOwner { pub video_owner_renderer: VideoOwnerRenderer, } #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct VideoOwnerRenderer { +pub(crate) struct VideoOwnerRenderer { pub title: TextComponent, pub thumbnail: Thumbnails, #[serde_as(as = "Option")] @@ -131,33 +131,33 @@ pub struct VideoOwnerRenderer { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ChannelBadge { +pub(crate) struct ChannelBadge { pub metadata_badge_renderer: ChannelBadgeRenderer, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ChannelBadgeRenderer { +pub(crate) struct ChannelBadgeRenderer { pub style: ChannelBadgeStyle, } #[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, Hash)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] -pub enum ChannelBadgeStyle { +pub(crate) enum ChannelBadgeStyle { BadgeStyleTypeVerified, BadgeStyleTypeVerifiedArtist, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Alert { +pub(crate) struct Alert { pub alert_renderer: AlertRenderer, } #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct AlertRenderer { +pub(crate) struct AlertRenderer { #[serde_as(as = "Text")] pub text: String, } @@ -167,7 +167,7 @@ pub struct AlertRenderer { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Continuation { +pub(crate) struct Continuation { /// Number of search results #[serde_as(as = "Option")] pub estimated_results: Option, @@ -181,21 +181,21 @@ pub struct Continuation { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ContinuationActionWrap { +pub(crate) struct ContinuationActionWrap { pub append_continuation_items_action: ContinuationAction, } #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ContinuationAction { +pub(crate) struct ContinuationAction { #[serde_as(as = "VecLogError<_>")] pub continuation_items: MapResult>, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ResponseContext { +pub(crate) struct ResponseContext { pub visitor_data: Option, } @@ -204,7 +204,7 @@ pub struct ResponseContext { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MusicItem { +pub(crate) struct MusicItem { pub thumbnail: MusicThumbnailRenderer, #[serde(default)] #[serde_as(deserialize_as = "DefaultOnError")] @@ -217,28 +217,28 @@ pub struct MusicItem { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MusicThumbnailRenderer { +pub(crate) struct MusicThumbnailRenderer { #[serde(alias = "croppedSquareThumbnailRenderer")] pub music_thumbnail_renderer: ThumbnailsWrap, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PlaylistItemData { +pub(crate) struct PlaylistItemData { pub video_id: String, } #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MusicContentsRenderer { +pub(crate) struct MusicContentsRenderer { pub contents: Vec, #[serde_as(as = "Option>")] pub continuations: Option>, } #[derive(Debug, Deserialize)] -pub struct MusicColumn { +pub(crate) struct MusicColumn { #[serde( rename = "musicResponsiveListItemFlexColumnRenderer", alias = "musicResponsiveListItemFixedColumnRenderer" @@ -248,19 +248,19 @@ pub struct MusicColumn { #[serde_as] #[derive(Debug, Deserialize)] -pub struct MusicColumnRenderer { +pub(crate) struct MusicColumnRenderer { pub text: TextComponent, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MusicContinuation { +pub(crate) struct MusicContinuation { pub next_continuation_data: MusicContinuationData, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MusicContinuationData { +pub(crate) struct MusicContinuationData { pub continuation: String, } @@ -312,7 +312,7 @@ impl From for crate::model::Verification { } } -pub fn alerts_to_err(alerts: Option>) -> ExtractionError { +pub(crate) fn alerts_to_err(alerts: Option>) -> ExtractionError { match alerts { Some(alerts) => ExtractionError::ContentUnavailable( alerts diff --git a/src/client/response/player.rs b/src/client/response/player.rs index b363e3a..a07677d 100644 --- a/src/client/response/player.rs +++ b/src/client/response/player.rs @@ -9,7 +9,7 @@ use crate::serializer::{text::Text, MapResult, VecLogError}; #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Player { +pub(crate) struct Player { pub playability_status: PlayabilityStatus, pub streaming_data: Option, pub captions: Option, @@ -18,7 +18,7 @@ pub struct Player { #[derive(Debug, Deserialize)] #[serde(tag = "status", rename_all = "SCREAMING_SNAKE_CASE")] -pub enum PlayabilityStatus { +pub(crate) enum PlayabilityStatus { #[serde(rename_all = "camelCase")] Ok { live_streamability: Option }, /// Video cant be played because of DRM / Geoblock @@ -35,12 +35,12 @@ pub enum PlayabilityStatus { } #[derive(Debug, Deserialize)] -pub struct Empty {} +pub(crate) struct Empty {} #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct StreamingData { +pub(crate) struct StreamingData { #[serde_as(as = "JsonString")] pub expires_in_seconds: u32, #[serde(default)] @@ -58,7 +58,7 @@ pub struct StreamingData { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Format { +pub(crate) struct Format { pub itag: u32, pub url: Option, @@ -119,7 +119,7 @@ impl Format { #[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)] #[serde(rename_all = "lowercase")] -pub enum Quality { +pub(crate) enum Quality { Tiny, Small, Medium, @@ -132,7 +132,7 @@ pub enum Quality { } #[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub enum AudioQuality { +pub(crate) enum AudioQuality { #[serde(rename = "AUDIO_QUALITY_LOW", alias = "low")] Low, #[serde(rename = "AUDIO_QUALITY_MEDIUM", alias = "medium")] @@ -143,7 +143,7 @@ pub enum AudioQuality { #[derive(Default, Clone, Copy, Debug, Deserialize, PartialEq, Eq, Hash)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] -pub enum FormatType { +pub(crate) enum FormatType { #[default] Default, /// This stream only works via DASH and not via progressive HTTP. @@ -152,13 +152,13 @@ pub enum FormatType { #[derive(Default, Debug, Deserialize)] #[serde(default, rename_all = "camelCase")] -pub struct ColorInfo { +pub(crate) struct ColorInfo { pub primaries: Primaries, } #[derive(Default, Clone, Copy, Debug, Deserialize, PartialEq, Eq, Hash)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] -pub enum Primaries { +pub(crate) enum Primaries { #[default] ColorPrimariesBt709, ColorPrimariesBt2020, @@ -166,7 +166,7 @@ pub enum Primaries { #[derive(Default, Debug, Deserialize)] #[serde(default, rename_all = "camelCase")] -pub struct AudioTrack { +pub(crate) struct AudioTrack { pub id: String, pub display_name: String, pub audio_is_default: bool, @@ -174,20 +174,20 @@ pub struct AudioTrack { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Captions { +pub(crate) struct Captions { pub player_captions_tracklist_renderer: PlayerCaptionsTracklistRenderer, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PlayerCaptionsTracklistRenderer { +pub(crate) struct PlayerCaptionsTracklistRenderer { pub caption_tracks: Vec, } #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CaptionTrack { +pub(crate) struct CaptionTrack { pub base_url: String, #[serde_as(as = "Text")] pub name: String, @@ -197,7 +197,7 @@ pub struct CaptionTrack { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct VideoDetails { +pub(crate) struct VideoDetails { pub video_id: String, pub title: String, #[serde_as(as = "JsonString")] diff --git a/src/client/response/playlist.rs b/src/client/response/playlist.rs index 0810379..4327090 100644 --- a/src/client/response/playlist.rs +++ b/src/client/response/playlist.rs @@ -12,7 +12,7 @@ use super::{ #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Playlist { +pub(crate) struct Playlist { pub contents: Option, pub header: Option
, pub sidebar: Option, @@ -23,7 +23,7 @@ pub struct Playlist { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PlaylistCont { +pub(crate) struct PlaylistCont { #[serde(default)] #[serde_as(as = "VecSkipError<_>")] pub on_response_received_actions: Vec, @@ -31,52 +31,52 @@ pub struct PlaylistCont { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Contents { +pub(crate) struct Contents { pub two_column_browse_results_renderer: ContentsRenderer, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Tab { +pub(crate) struct Tab { pub tab_renderer: ContentRenderer, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SectionList { +pub(crate) struct SectionList { pub section_list_renderer: ContentsRenderer, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ItemSection { +pub(crate) struct ItemSection { pub item_section_renderer: ContentsRenderer, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PlaylistVideoListRenderer { +pub(crate) struct PlaylistVideoListRenderer { pub playlist_video_list_renderer: PlaylistVideoList, } #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PlaylistVideoList { +pub(crate) struct PlaylistVideoList { #[serde_as(as = "VecLogError<_>")] pub contents: MapResult>, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Header { +pub(crate) struct Header { pub playlist_header_renderer: HeaderRenderer, } #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct HeaderRenderer { +pub(crate) struct HeaderRenderer { pub playlist_id: String, #[serde_as(as = "Text")] pub title: String, @@ -95,48 +95,48 @@ pub struct HeaderRenderer { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PlaylistHeaderBanner { +pub(crate) struct PlaylistHeaderBanner { pub hero_playlist_thumbnail_renderer: ThumbnailsWrap, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Byline { +pub(crate) struct Byline { pub playlist_byline_renderer: BylineRenderer, } #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct BylineRenderer { +pub(crate) struct BylineRenderer { #[serde_as(as = "Text")] pub text: String, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Sidebar { +pub(crate) struct Sidebar { pub playlist_sidebar_renderer: SidebarRenderer, } #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SidebarRenderer { +pub(crate) struct SidebarRenderer { #[serde_as(as = "VecSkipError<_>")] pub items: Vec, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SidebarItemPrimary { +pub(crate) struct SidebarItemPrimary { pub playlist_sidebar_primary_info_renderer: SidebarPrimaryInfoRenderer, } #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SidebarPrimaryInfoRenderer { +pub(crate) struct SidebarPrimaryInfoRenderer { pub thumbnail_renderer: PlaylistThumbnailRenderer, /// - `"495", " videos"` /// - `"3,310,996 views"` @@ -147,7 +147,7 @@ pub struct SidebarPrimaryInfoRenderer { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PlaylistThumbnailRenderer { +pub(crate) struct PlaylistThumbnailRenderer { // the alternative field name is used by YTM playlists #[serde(alias = "playlistCustomThumbnailRenderer")] pub playlist_video_thumbnail_renderer: ThumbnailsWrap, @@ -156,7 +156,7 @@ pub struct PlaylistThumbnailRenderer { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub enum PlaylistItem { +pub(crate) enum PlaylistItem { /// Video in playlist PlaylistVideoRenderer(PlaylistVideoRenderer), /// Continauation items are located at the end of a list @@ -174,7 +174,7 @@ pub enum PlaylistItem { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PlaylistVideoRenderer { +pub(crate) struct PlaylistVideoRenderer { pub video_id: String, pub thumbnail: Thumbnails, #[serde_as(as = "Text")] @@ -203,14 +203,14 @@ impl TryFrom for crate::model::PlaylistVideo { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct OnResponseReceivedAction { +pub(crate) struct OnResponseReceivedAction { pub append_continuation_items_action: AppendAction, } #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct AppendAction { +pub(crate) struct AppendAction { #[serde_as(as = "VecLogError<_>")] pub continuation_items: MapResult>, } diff --git a/src/client/response/playlist_music.rs b/src/client/response/playlist_music.rs index 85ad5ff..0ab3901 100644 --- a/src/client/response/playlist_music.rs +++ b/src/client/response/playlist_music.rs @@ -11,33 +11,33 @@ use super::{ #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PlaylistMusic { +pub(crate) struct PlaylistMusic { pub contents: Contents, pub header: Header, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Contents { +pub(crate) struct Contents { pub single_column_browse_results_renderer: ContentsRenderer, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Tab { +pub(crate) struct Tab { pub tab_renderer: ContentRenderer, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SectionList { +pub(crate) struct SectionList { /// Includes a continuation token for fetching recommendations pub section_list_renderer: MusicContentsRenderer, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ItemSection { +pub(crate) struct ItemSection { #[serde(alias = "musicPlaylistShelfRenderer")] pub music_shelf_renderer: MusicShelf, } @@ -45,7 +45,7 @@ pub struct ItemSection { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MusicShelf { +pub(crate) struct MusicShelf { /// Playlist ID (only for playlists) pub playlist_id: Option, #[serde_as(as = "VecSkipError<_>")] @@ -57,20 +57,20 @@ pub struct MusicShelf { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PlaylistMusicItem { +pub(crate) struct PlaylistMusicItem { pub music_responsive_list_item_renderer: MusicItem, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Header { +pub(crate) struct Header { pub music_detail_header_renderer: HeaderRenderer, } #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct HeaderRenderer { +pub(crate) struct HeaderRenderer { #[serde_as(as = "crate::serializer::text::Text")] pub title: String, /// Content type + Channel/Artist + Year. diff --git a/src/client/response/search.rs b/src/client/response/search.rs index d185ad3..15869fb 100644 --- a/src/client/response/search.rs +++ b/src/client/response/search.rs @@ -6,7 +6,7 @@ use super::video_item::YouTubeListRendererWrap; #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Search { +pub(crate) struct Search { #[serde_as(as = "Option")] pub estimated_results: Option, pub contents: Contents, @@ -14,12 +14,12 @@ pub struct Search { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Contents { +pub(crate) struct Contents { pub two_column_search_results_renderer: TwoColumnSearchResultsRenderer, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TwoColumnSearchResultsRenderer { +pub(crate) struct TwoColumnSearchResultsRenderer { pub primary_contents: YouTubeListRendererWrap, } diff --git a/src/client/response/trends.rs b/src/client/response/trends.rs index 94e7960..3ac3c57 100644 --- a/src/client/response/trends.rs +++ b/src/client/response/trends.rs @@ -5,33 +5,33 @@ use super::{video_item::YouTubeListRendererWrap, ContentRenderer, ResponseContex #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Startpage { +pub(crate) struct Startpage { pub contents: Contents, pub response_context: ResponseContext, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Trending { +pub(crate) struct Trending { pub contents: Contents, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Contents { +pub(crate) struct Contents { pub two_column_browse_results_renderer: BrowseResults, } #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct BrowseResults { +pub(crate) struct BrowseResults { #[serde_as(as = "VecSkipError<_>")] pub tabs: Vec>, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Tab { +pub(crate) struct Tab { pub tab_renderer: ContentRenderer, } diff --git a/src/client/response/url_endpoint.rs b/src/client/response/url_endpoint.rs index c2c7dff..396dc89 100644 --- a/src/client/response/url_endpoint.rs +++ b/src/client/response/url_endpoint.rs @@ -6,14 +6,14 @@ use crate::model::UrlTarget; /// navigation/resolve_url response model #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ResolvedUrl { +pub(crate) struct ResolvedUrl { pub endpoint: NavigationEndpoint, } #[serde_as] #[derive(Debug, Deserialize, Default)] #[serde(rename_all = "camelCase")] -pub struct NavigationEndpoint { +pub(crate) struct NavigationEndpoint { #[serde(default)] #[serde_as(deserialize_as = "DefaultOnError")] pub watch_endpoint: Option, @@ -30,7 +30,7 @@ pub struct NavigationEndpoint { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WatchEndpoint { +pub(crate) struct WatchEndpoint { pub video_id: String, #[serde(default)] pub start_time_seconds: u32, @@ -38,43 +38,43 @@ pub struct WatchEndpoint { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct BrowseEndpoint { +pub(crate) struct BrowseEndpoint { pub browse_id: String, pub browse_endpoint_context_supported_configs: Option, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UrlEndpoint { +pub(crate) struct UrlEndpoint { pub url: String, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct BrowseEndpointConfig { +pub(crate) struct BrowseEndpointConfig { pub browse_endpoint_context_music_config: BrowseEndpointMusicConfig, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct BrowseEndpointMusicConfig { +pub(crate) struct BrowseEndpointMusicConfig { pub page_type: PageType, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CommandMetadata { +pub(crate) struct CommandMetadata { pub web_command_metadata: WebCommandMetadata, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WebCommandMetadata { +pub(crate) struct WebCommandMetadata { pub web_page_type: PageType, } #[derive(Debug, Clone, Copy, Deserialize, PartialEq, Eq)] -pub enum PageType { +pub(crate) enum PageType { #[serde(rename = "MUSIC_PAGE_TYPE_ARTIST")] Artist, #[serde(rename = "MUSIC_PAGE_TYPE_ALBUM")] @@ -89,7 +89,7 @@ pub enum PageType { } impl PageType { - pub fn to_url_target(self, id: String) -> UrlTarget { + pub(crate) fn to_url_target(self, id: String) -> UrlTarget { match self { PageType::Artist => UrlTarget::Channel { id }, PageType::Album => UrlTarget::Playlist { id }, diff --git a/src/client/response/video_details.rs b/src/client/response/video_details.rs index bca46ed..72add27 100644 --- a/src/client/response/video_details.rs +++ b/src/client/response/video_details.rs @@ -24,7 +24,7 @@ use super::{ResponseContext, YouTubeListItem}; #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct VideoDetails { +pub(crate) struct VideoDetails { /// Video metadata + recommended videos pub contents: Option, /// Video ID @@ -38,13 +38,13 @@ pub struct VideoDetails { /// Video details main object, contains video metadata and recommended videos #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Contents { +pub(crate) struct Contents { pub two_column_watch_next_results: TwoColumnWatchNextResults, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TwoColumnWatchNextResults { +pub(crate) struct TwoColumnWatchNextResults { /// Metadata about the video pub results: VideoResultsWrap, /// Video recommendations @@ -56,7 +56,7 @@ pub struct TwoColumnWatchNextResults { /// Metadata about the video #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct VideoResultsWrap { +pub(crate) struct VideoResultsWrap { pub results: VideoResults, } @@ -64,7 +64,7 @@ pub struct VideoResultsWrap { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct VideoResults { +pub(crate) struct VideoResults { #[serde_as(as = "VecLogError<_>")] pub contents: MapResult>, } @@ -73,7 +73,7 @@ pub struct VideoResults { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub enum VideoResultsItem { +pub(crate) enum VideoResultsItem { #[serde(rename_all = "camelCase")] VideoPrimaryInfoRenderer { #[serde_as(as = "Text")] @@ -107,14 +107,14 @@ pub enum VideoResultsItem { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ViewCount { +pub(crate) struct ViewCount { pub video_view_count_renderer: ViewCountRenderer, } #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ViewCountRenderer { +pub(crate) struct ViewCountRenderer { /// View count (`232,975,196 views`) #[serde_as(as = "Text")] pub view_count: String, @@ -125,7 +125,7 @@ pub struct ViewCountRenderer { /// Like/Dislike buttons #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct VideoActions { +pub(crate) struct VideoActions { pub menu_renderer: VideoActionsMenu, } @@ -133,7 +133,7 @@ pub struct VideoActions { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct VideoActionsMenu { +pub(crate) struct VideoActionsMenu { #[serde_as(as = "VecSkipError<_>")] pub top_level_buttons: Vec, } @@ -146,7 +146,7 @@ pub struct VideoActionsMenu { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub enum TopLevelButton { +pub(crate) enum TopLevelButton { ToggleButtonRenderer(ToggleButton), #[serde(rename_all = "camelCase")] SegmentedLikeDislikeButtonRenderer { @@ -157,7 +157,7 @@ pub enum TopLevelButton { /// Like/Dislike button #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ToggleButtonWrap { +pub(crate) struct ToggleButtonWrap { pub toggle_button_renderer: ToggleButton, } @@ -165,7 +165,7 @@ pub struct ToggleButtonWrap { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ToggleButton { +pub(crate) struct ToggleButton { /// Icon type: `LIKE` / `DISLIKE` pub default_icon: Icon, /// Number of likes (`like this video along with 4,010,156 other people`) @@ -179,7 +179,7 @@ pub struct ToggleButton { /// the Creative Commonse License. #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MetadataRowContainer { +pub(crate) struct MetadataRowContainer { pub metadata_row_container_renderer: MetadataRowContainerRenderer, } @@ -187,14 +187,14 @@ pub struct MetadataRowContainer { /// the Creative Commonse License. #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MetadataRowContainerRenderer { +pub(crate) struct MetadataRowContainerRenderer { pub rows: Vec, } /// Additional video metadata item (Creative Commons License) #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MetadataRow { +pub(crate) struct MetadataRow { pub metadata_row_renderer: MetadataRowRenderer, } @@ -202,7 +202,7 @@ pub struct MetadataRow { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MetadataRowRenderer { +pub(crate) struct MetadataRowRenderer { // `License` // #[serde_as(as = "Text")] // pub title: String, @@ -217,13 +217,13 @@ pub struct MetadataRowRenderer { /// Contains current video ID #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CurrentVideoEndpoint { +pub(crate) struct CurrentVideoEndpoint { pub watch_endpoint: CurrentVideoWatchEndpoint, } /// Contains current video ID #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CurrentVideoWatchEndpoint { +pub(crate) struct CurrentVideoWatchEndpoint { pub video_id: String, } @@ -234,7 +234,7 @@ pub struct CurrentVideoWatchEndpoint { #[serde_as] #[derive(Default, Debug, Deserialize)] #[serde(rename_all = "kebab-case", tag = "sectionIdentifier")] -pub enum ItemSection { +pub(crate) enum ItemSection { CommentsEntryPoint { #[serde_as(as = "VecSkipError<_>")] contents: Vec, @@ -250,7 +250,7 @@ pub enum ItemSection { /// Item section containing comment count #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ItemSectionCommentCount { +pub(crate) struct ItemSectionCommentCount { pub comments_entry_point_header_renderer: CommentsEntryPointHeaderRenderer, } @@ -258,7 +258,7 @@ pub struct ItemSectionCommentCount { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CommentsEntryPointHeaderRenderer { +pub(crate) struct CommentsEntryPointHeaderRenderer { #[serde_as(as = "Text")] pub comment_count: String, } @@ -266,14 +266,14 @@ pub struct CommentsEntryPointHeaderRenderer { /// Item section containing comments ctoken #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ItemSectionComments { +pub(crate) struct ItemSectionComments { pub continuation_item_renderer: ContinuationItemRenderer, } /// Video recommendations #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RecommendationResultsWrap { +pub(crate) struct RecommendationResultsWrap { pub secondary_results: RecommendationResults, } @@ -281,7 +281,7 @@ pub struct RecommendationResultsWrap { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RecommendationResults { +pub(crate) struct RecommendationResults { /// Can be `None` for age-restricted videos #[serde_as(as = "Option>")] pub results: Option>>, @@ -293,7 +293,7 @@ pub struct RecommendationResults { /// and the comment section. #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct EngagementPanel { +pub(crate) struct EngagementPanel { pub engagement_panel_section_list_renderer: EngagementPanelRenderer, } @@ -301,7 +301,7 @@ pub struct EngagementPanel { /// and the comment section. #[derive(Debug, Deserialize)] #[serde(rename_all = "kebab-case", tag = "targetId")] -pub enum EngagementPanelRenderer { +pub(crate) enum EngagementPanelRenderer { /// Chapter markers EngagementPanelMacroMarkersDescriptionChapters { content: ChapterMarkersContent }, /// Comment section (contains no comments, but the @@ -320,7 +320,7 @@ pub enum EngagementPanelRenderer { /// Chapter markers #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ChapterMarkersContent { +pub(crate) struct ChapterMarkersContent { pub macro_markers_list_renderer: MacroMarkersListRenderer, } @@ -328,7 +328,7 @@ pub struct ChapterMarkersContent { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MacroMarkersListRenderer { +pub(crate) struct MacroMarkersListRenderer { #[serde_as(as = "VecLogError<_>")] pub contents: MapResult>, } @@ -336,7 +336,7 @@ pub struct MacroMarkersListRenderer { /// Chapter marker #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MacroMarkersListItem { +pub(crate) struct MacroMarkersListItem { pub macro_markers_list_item_renderer: MacroMarkersListItemRenderer, } @@ -344,7 +344,7 @@ pub struct MacroMarkersListItem { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MacroMarkersListItemRenderer { +pub(crate) struct MacroMarkersListItemRenderer { /// Contains chapter start time in seconds pub on_tap: MacroMarkersListItemOnTap, #[serde(default)] @@ -357,13 +357,13 @@ pub struct MacroMarkersListItemRenderer { /// Contains chapter start time in seconds #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MacroMarkersListItemOnTap { +pub(crate) struct MacroMarkersListItemOnTap { pub watch_endpoint: MacroMarkersListItemWatchEndpoint, } /// Contains chapter start time in seconds #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MacroMarkersListItemWatchEndpoint { +pub(crate) struct MacroMarkersListItemWatchEndpoint { /// Chapter start time in seconds pub start_time_seconds: u32, } @@ -372,7 +372,7 @@ pub struct MacroMarkersListItemWatchEndpoint { /// (contains continuation tokens for fetching top/latest comments) #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CommentItemSectionHeader { +pub(crate) struct CommentItemSectionHeader { pub engagement_panel_title_header_renderer: CommentItemSectionHeaderRenderer, } @@ -381,7 +381,7 @@ pub struct CommentItemSectionHeader { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CommentItemSectionHeaderRenderer { +pub(crate) struct CommentItemSectionHeaderRenderer { /// Approximate comment count (e.g. `81`, `2.2K`, `705K`) /// /// The accurate count is included in the first comment response. @@ -395,7 +395,7 @@ pub struct CommentItemSectionHeaderRenderer { /// Comment section menu #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CommentItemSectionHeaderMenu { +pub(crate) struct CommentItemSectionHeaderMenu { pub sort_filter_sub_menu_renderer: CommentItemSectionHeaderMenuRenderer, } @@ -406,14 +406,14 @@ pub struct CommentItemSectionHeaderMenu { /// - Latest comments #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CommentItemSectionHeaderMenuRenderer { +pub(crate) struct CommentItemSectionHeaderMenuRenderer { pub sub_menu_items: Vec, } /// Comment section menu item #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CommentItemSectionHeaderMenuItem { +pub(crate) struct CommentItemSectionHeaderMenuItem { /// Continuation token for fetching comments pub service_endpoint: ContinuationEndpoint, } @@ -426,7 +426,7 @@ pub struct CommentItemSectionHeaderMenuItem { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct VideoComments { +pub(crate) struct VideoComments { /// - Initial response: 2*reloadContinuationItemsCommand /// - 1*commentsHeaderRenderer: number of comments /// - n*commentThreadRenderer, continuationItemRenderer: @@ -444,7 +444,7 @@ pub struct VideoComments { /// Video comments continuation #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CommentsContItem { +pub(crate) struct CommentsContItem { #[serde(alias = "reloadContinuationItemsCommand")] pub append_continuation_items_action: AppendComments, } @@ -453,7 +453,7 @@ pub struct CommentsContItem { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct AppendComments { +pub(crate) struct AppendComments { #[serde_as(as = "VecLogError<_>")] pub continuation_items: MapResult>, } @@ -461,7 +461,7 @@ pub struct AppendComments { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub enum CommentListItem { +pub(crate) enum CommentListItem { /// Top-level comment #[serde(rename_all = "camelCase")] CommentThreadRenderer { @@ -491,14 +491,14 @@ pub enum CommentListItem { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Comment { +pub(crate) struct Comment { pub comment_renderer: CommentRenderer, } #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CommentRenderer { +pub(crate) struct CommentRenderer { /// Author name /// /// There may be comments with missing authors (possibly deleted users?) @@ -529,13 +529,13 @@ pub struct CommentRenderer { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct AuthorEndpoint { +pub(crate) struct AuthorEndpoint { pub browse_endpoint: BrowseEndpoint, } #[derive(Default, Clone, Copy, Debug, Deserialize, PartialEq, Eq)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] -pub enum CommentPriority { +pub(crate) enum CommentPriority { /// Default rendering priority #[default] RenderingPriorityUnknown, @@ -547,7 +547,7 @@ pub enum CommentPriority { /// for fetching them. #[derive(Default, Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Replies { +pub(crate) struct Replies { pub comment_replies_renderer: RepliesRenderer, } @@ -556,7 +556,7 @@ pub struct Replies { #[serde_as] #[derive(Default, Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RepliesRenderer { +pub(crate) struct RepliesRenderer { #[serde_as(as = "VecSkipError<_>")] pub contents: Vec, } @@ -565,7 +565,7 @@ pub struct RepliesRenderer { /// Contains the CreatorHeart. #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CommentActionButtons { +pub(crate) struct CommentActionButtons { pub comment_action_buttons_renderer: CommentActionButtonsRenderer, } @@ -573,7 +573,7 @@ pub struct CommentActionButtons { /// Contains the CreatorHeart. #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CommentActionButtonsRenderer { +pub(crate) struct CommentActionButtonsRenderer { pub like_button: ToggleButtonWrap, pub creator_heart: Option, } @@ -581,27 +581,27 @@ pub struct CommentActionButtonsRenderer { /// Video creators can endorse comments by marking them with a ❤️. #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CreatorHeart { +pub(crate) struct CreatorHeart { pub creator_heart_renderer: CreatorHeartRenderer, } /// Video creators can endorse comments by marking them with a ❤️. #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CreatorHeartRenderer { +pub(crate) struct CreatorHeartRenderer { pub is_hearted: bool, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct AuthorCommentBadge { +pub(crate) struct AuthorCommentBadge { pub author_comment_badge_renderer: AuthorCommentBadgeRenderer, } /// YouTube channel badge (verified) of the comment author #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct AuthorCommentBadgeRenderer { +pub(crate) struct AuthorCommentBadgeRenderer { /// Verified: `CHECK` /// /// Artist: `OFFICIAL_ARTIST_BADGE` diff --git a/src/client/response/video_item.rs b/src/client/response/video_item.rs index f9c06db..fd51b90 100644 --- a/src/client/response/video_item.rs +++ b/src/client/response/video_item.rs @@ -18,7 +18,7 @@ use crate::{ #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub enum YouTubeListItem { +pub(crate) enum YouTubeListItem { #[serde(alias = "gridVideoRenderer", alias = "compactVideoRenderer")] VideoRenderer(VideoRenderer), @@ -73,7 +73,7 @@ pub enum YouTubeListItem { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct VideoRenderer { +pub(crate) struct VideoRenderer { pub video_id: String, pub thumbnail: Thumbnails, #[serde_as(as = "Text")] @@ -114,7 +114,7 @@ pub struct VideoRenderer { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PlaylistRenderer { +pub(crate) struct PlaylistRenderer { pub playlist_id: String, #[serde_as(as = "Text")] pub title: String, @@ -140,7 +140,7 @@ pub struct PlaylistRenderer { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ChannelRenderer { +pub(crate) struct ChannelRenderer { pub channel_id: String, #[serde_as(as = "Text")] pub title: String, @@ -164,7 +164,7 @@ pub struct ChannelRenderer { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct YouTubeListRendererWrap { +pub(crate) struct YouTubeListRendererWrap { #[serde(alias = "richGridRenderer")] pub section_list_renderer: YouTubeListRenderer, } @@ -172,7 +172,7 @@ pub struct YouTubeListRendererWrap { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct YouTubeListRenderer { +pub(crate) struct YouTubeListRenderer { #[serde_as(as = "VecLogError<_>")] pub contents: MapResult>, } @@ -180,7 +180,7 @@ pub struct YouTubeListRenderer { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UpcomingEventData { +pub(crate) struct UpcomingEventData { /// Unixtime in seconds #[serde_as(as = "JsonString")] pub start_time: i64, @@ -188,7 +188,7 @@ pub struct UpcomingEventData { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TimeOverlay { +pub(crate) struct TimeOverlay { pub thumbnail_overlay_time_status_renderer: TimeOverlayRenderer, } @@ -196,7 +196,7 @@ pub struct TimeOverlay { /// show certain video properties (e.g. active livestream) #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct VideoBadge { +pub(crate) struct VideoBadge { pub metadata_badge_renderer: VideoBadgeRenderer, } @@ -204,13 +204,13 @@ pub struct VideoBadge { /// show certain video properties (e.g. active livestream) #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct VideoBadgeRenderer { +pub(crate) struct VideoBadgeRenderer { pub style: VideoBadgeStyle, } #[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, Hash)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] -pub enum VideoBadgeStyle { +pub(crate) enum VideoBadgeStyle { /// Active livestream BadgeStyleTypeLiveNow, } @@ -218,7 +218,7 @@ pub enum VideoBadgeStyle { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TimeOverlayRenderer { +pub(crate) struct TimeOverlayRenderer { /// `29:54` /// /// 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)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] -pub enum TimeOverlayStyle { +pub(crate) enum TimeOverlayStyle { #[default] Default, Live, @@ -241,20 +241,20 @@ pub enum TimeOverlayStyle { #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct DetailedMetadataSnippet { +pub(crate) struct DetailedMetadataSnippet { #[serde_as(as = "Text")] pub snippet_text: String, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ChannelThumbnailSupportedRenderers { +pub(crate) struct ChannelThumbnailSupportedRenderers { pub channel_thumbnail_with_link_renderer: ChannelThumbnailWithLinkRenderer, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ChannelThumbnailWithLinkRenderer { +pub(crate) struct ChannelThumbnailWithLinkRenderer { pub thumbnail: Thumbnails, } @@ -293,7 +293,7 @@ impl IsShort for Vec { /// Result of mapping a list of different YouTube enities /// (videos, channels, playlists) #[derive(Debug)] -pub struct YouTubeListMapper { +pub(crate) struct YouTubeListMapper { lang: Language, pub items: Vec, pub warnings: Vec, @@ -442,7 +442,7 @@ impl YouTubeListMapper { } } - pub fn map_response(&mut self, mut res: MapResult>) { + pub(crate) fn map_response(&mut self, mut res: MapResult>) { self.warnings.append(&mut res.warnings); res.c.into_iter().for_each(|item| self.map_item(item)); } @@ -471,7 +471,7 @@ impl YouTubeListMapper { } } - pub fn map_response(&mut self, mut res: MapResult>) { + pub(crate) fn map_response(&mut self, mut res: MapResult>) { self.warnings.append(&mut res.warnings); res.c.into_iter().for_each(|item| self.map_item(item)); } @@ -500,7 +500,7 @@ impl YouTubeListMapper { } } - pub fn map_response(&mut self, mut res: MapResult>) { + pub(crate) fn map_response(&mut self, mut res: MapResult>) { self.warnings.append(&mut res.warnings); res.c.into_iter().for_each(|item| self.map_item(item)); } diff --git a/src/serializer/text.rs b/src/serializer/text.rs index a09b977..5833e1c 100644 --- a/src/serializer/text.rs +++ b/src/serializer/text.rs @@ -42,7 +42,7 @@ use crate::{ #[serde_as] #[derive(Clone, Debug, Deserialize)] #[serde(untagged)] -pub enum Text { +pub(crate) enum Text { Simple { #[serde(alias = "simpleText")] text: String, @@ -86,10 +86,10 @@ impl<'de> DeserializeAs<'de, Vec> for Text { /// /// Texts with links are mapped as a list of text components. #[derive(Default, Debug, Clone)] -pub struct TextComponents(pub Vec); +pub(crate) struct TextComponents(pub Vec); #[derive(Debug, Clone)] -pub enum TextComponent { +pub(crate) enum TextComponent { Video { text: String, video_id: String, @@ -130,7 +130,7 @@ struct RichTextRun { /// the links. #[derive(Deserialize)] #[serde(rename_all = "camelCase")] -pub struct AttributedText { +pub(crate) struct AttributedText { content: String, #[serde(default)] command_runs: Vec, @@ -345,7 +345,7 @@ impl From for crate::model::richtext::RichText { #[derive(Deserialize)] #[serde(rename_all = "camelCase")] -pub struct AccessibilityText { +pub(crate) struct AccessibilityText { accessibility_data: AccessibilityData, }