From 1c0c64a8bf209a322753008071cdb0a6b1a33c26 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Fri, 28 Oct 2022 18:49:10 +0200 Subject: [PATCH] feat: get YouTube visitor data --- src/client/channel.rs | 6 ++++++ src/client/player.rs | 1 + src/client/playlist.rs | 1 + src/client/response/channel.rs | 3 ++- src/client/response/player.rs | 3 ++- src/client/response/playlist.rs | 4 +++- src/client/response/search.rs | 3 ++- src/client/search.rs | 1 + ...pe__client__channel__tests__map_channel_info.snap | 1 + ...lient__channel__tests__map_channel_playlists.snap | 1 + ..._tests__map_channel_videos_20221011_richgrid.snap | 1 + ...tests__map_channel_videos_20221011_richgrid2.snap | 1 + ...ent__channel__tests__map_channel_videos_base.snap | 1 + ...nt__channel__tests__map_channel_videos_empty.snap | 1 + ...ent__channel__tests__map_channel_videos_live.snap | 1 + ...nt__channel__tests__map_channel_videos_music.snap | 1 + ...t__channel__tests__map_channel_videos_shorts.snap | 1 + ..._channel__tests__map_channel_videos_upcoming.snap | 1 + ...ient__player__tests__map_player_data_android.snap | 1 + ...ient__player__tests__map_player_data_desktop.snap | 1 + ..._player__tests__map_player_data_desktopmusic.snap | 1 + ...__client__player__tests__map_player_data_ios.snap | 1 + ..._player__tests__map_player_data_tvhtml5embed.snap | 1 + ...ent__playlist__tests__map_playlist_data_long.snap | 1 + ...__playlist__tests__map_playlist_data_nomusic.snap | 1 + ...nt__playlist__tests__map_playlist_data_short.snap | 1 + ...e__client__search__tests__map_search_default.snap | 1 + ...ipe__client__search__tests__map_search_empty.snap | 1 + ..._client__search__tests__map_search_playlists.snap | 1 + ...s__tests__map_video_details_20220924_newdesc.snap | 1 + ..._map_video_details_20221011_new_continuation.snap | 1 + ...s__tests__map_video_details_20221011_rec_isr.snap | 1 + ...eo_details__tests__map_video_details_agegate.snap | 1 + ...o_details__tests__map_video_details_ccommons.snap | 1 + ...o_details__tests__map_video_details_chapters.snap | 1 + ...video_details__tests__map_video_details_live.snap | 1 + ...ideo_details__tests__map_video_details_music.snap | 1 + ...__video_details__tests__map_video_details_mv.snap | 1 + src/client/video_details.rs | 3 ++- src/model/mod.rs | 12 ++++++++++++ 40 files changed, 62 insertions(+), 5 deletions(-) diff --git a/src/client/channel.rs b/src/client/channel.rs index b892f17..136489c 100644 --- a/src/client/channel.rs +++ b/src/client/channel.rs @@ -115,6 +115,7 @@ impl MapResponse>> for response::Channel { self.header, self.metadata, self.microformat, + self.response_context.visitor_data, v_res.c, id, lang, @@ -146,6 +147,7 @@ impl MapResponse>> for response::Channel { self.header, self.metadata, self.microformat, + self.response_context.visitor_data, p_res.c, id, lang, @@ -204,6 +206,7 @@ impl MapResponse> for response::Channel { self.header, self.metadata, self.microformat, + self.response_context.visitor_data, cinfo, id, lang, @@ -255,6 +258,7 @@ fn map_channel( header: Option, metadata: Option, microformat: Option, + visitor_data: Option, content: T, id: &str, lang: Language, @@ -298,6 +302,7 @@ fn map_channel( banner: header.banner.into(), mobile_banner: header.mobile_banner.into(), tv_banner: header.tv_banner.into(), + visitor_data, content, }, response::channel::Header::CarouselHeaderRenderer(carousel) => { @@ -332,6 +337,7 @@ fn map_channel( banner: Vec::new(), mobile_banner: Vec::new(), tv_banner: Vec::new(), + visitor_data, content, } } diff --git a/src/client/player.rs b/src/client/player.rs index 66417c5..148064f 100644 --- a/src/client/player.rs +++ b/src/client/player.rs @@ -275,6 +275,7 @@ impl MapResponse for response::Player { expires_in_seconds: streaming_data.expires_in_seconds, hls_manifest_url: streaming_data.hls_manifest_url, dash_manifest_url: streaming_data.dash_manifest_url, + visitor_data: self.response_context.visitor_data, }, warnings, }) diff --git a/src/client/playlist.rs b/src/client/playlist.rs index 9161847..7526e6f 100644 --- a/src/client/playlist.rs +++ b/src/client/playlist.rs @@ -169,6 +169,7 @@ impl MapResponse for response::Playlist { channel, last_update, last_update_txt, + visitor_data: self.response_context.visitor_data, }, warnings, }) diff --git a/src/client/response/channel.rs b/src/client/response/channel.rs index b90a79d..ea6167d 100644 --- a/src/client/response/channel.rs +++ b/src/client/response/channel.rs @@ -3,7 +3,7 @@ use serde_with::serde_as; use serde_with::{DefaultOnError, VecSkipError}; use super::url_endpoint::NavigationEndpoint; -use super::{Alert, ChannelBadge}; +use super::{Alert, ChannelBadge, ResponseContext}; use super::{ContentRenderer, ContentsRenderer}; use super::{Thumbnails, YouTubeListItem}; use crate::serializer::ignore_any; @@ -21,6 +21,7 @@ pub(crate) struct Channel { pub microformat: Option, #[serde_as(as = "Option")] pub alerts: Option>, + pub response_context: ResponseContext, } #[derive(Debug, Deserialize)] diff --git a/src/client/response/player.rs b/src/client/response/player.rs index a1162ad..4c2e31b 100644 --- a/src/client/response/player.rs +++ b/src/client/response/player.rs @@ -4,7 +4,7 @@ use serde::Deserialize; use serde_with::serde_as; use serde_with::{json::JsonString, DefaultOnError}; -use super::Thumbnails; +use super::{ResponseContext, Thumbnails}; use crate::serializer::{text::Text, MapResult, VecLogError}; #[derive(Debug, Deserialize)] @@ -14,6 +14,7 @@ pub(crate) struct Player { pub streaming_data: Option, pub captions: Option, pub video_details: Option, + pub response_context: ResponseContext, } #[derive(Debug, Deserialize)] diff --git a/src/client/response/playlist.rs b/src/client/response/playlist.rs index 4327090..74d3a54 100644 --- a/src/client/response/playlist.rs +++ b/src/client/response/playlist.rs @@ -6,7 +6,8 @@ use crate::serializer::{ignore_any, MapResult, VecLogError}; use crate::util::MappingError; use super::{ - Alert, ContentRenderer, ContentsRenderer, ContinuationEndpoint, Thumbnails, ThumbnailsWrap, + Alert, ContentRenderer, ContentsRenderer, ContinuationEndpoint, ResponseContext, Thumbnails, + ThumbnailsWrap, }; #[serde_as] @@ -18,6 +19,7 @@ pub(crate) struct Playlist { pub sidebar: Option, #[serde_as(as = "Option")] pub alerts: Option>, + pub response_context: ResponseContext, } #[serde_as] diff --git a/src/client/response/search.rs b/src/client/response/search.rs index 15869fb..92fc978 100644 --- a/src/client/response/search.rs +++ b/src/client/response/search.rs @@ -1,7 +1,7 @@ use serde::Deserialize; use serde_with::{json::JsonString, serde_as}; -use super::video_item::YouTubeListRendererWrap; +use super::{video_item::YouTubeListRendererWrap, ResponseContext}; #[serde_as] #[derive(Debug, Deserialize)] @@ -10,6 +10,7 @@ pub(crate) struct Search { #[serde_as(as = "Option")] pub estimated_results: Option, pub contents: Contents, + pub response_context: ResponseContext, } #[derive(Debug, Deserialize)] diff --git a/src/client/search.rs b/src/client/search.rs index 2243302..db0e8ab 100644 --- a/src/client/search.rs +++ b/src/client/search.rs @@ -109,6 +109,7 @@ impl MapResponse for response::Search { c: SearchResult { items: Paginator::new(self.estimated_results, mapper.items, mapper.ctoken), corrected_query: mapper.corrected_query, + visitor_data: self.response_context.visitor_data, }, warnings: mapper.warnings, }) diff --git a/src/client/snapshots/rustypipe__client__channel__tests__map_channel_info.snap b/src/client/snapshots/rustypipe__client__channel__tests__map_channel_info.snap index 1f6ba8d..7c369a7 100644 --- a/src/client/snapshots/rustypipe__client__channel__tests__map_channel_info.snap +++ b/src/client/snapshots/rustypipe__client__channel__tests__map_channel_info.snap @@ -142,6 +142,7 @@ Channel( height: 1192, ), ], + visitor_data: Some("CgszMUUzZDlGLWxiRSipqr2ZBg%3D%3D"), content: ChannelInfo( create_date: Some("2009-04-04"), view_count: Some(186854342), diff --git a/src/client/snapshots/rustypipe__client__channel__tests__map_channel_playlists.snap b/src/client/snapshots/rustypipe__client__channel__tests__map_channel_playlists.snap index 0221238..98519ee 100644 --- a/src/client/snapshots/rustypipe__client__channel__tests__map_channel_playlists.snap +++ b/src/client/snapshots/rustypipe__client__channel__tests__map_channel_playlists.snap @@ -142,6 +142,7 @@ Channel( height: 1192, ), ], + visitor_data: Some("CgttaWpyTVpUN1AyZyioqr2ZBg%3D%3D"), content: Paginator( count: None, items: [ diff --git a/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_20221011_richgrid.snap b/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_20221011_richgrid.snap index afe93e4..bfd9cab 100644 --- a/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_20221011_richgrid.snap +++ b/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_20221011_richgrid.snap @@ -113,6 +113,7 @@ Channel( height: 1192, ), ], + visitor_data: Some("CgtQdE9zVVR3NVBDbyjz0ZKaBg%3D%3D"), content: Paginator( count: None, items: [ diff --git a/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_20221011_richgrid2.snap b/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_20221011_richgrid2.snap index 965052f..c32b125 100644 --- a/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_20221011_richgrid2.snap +++ b/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_20221011_richgrid2.snap @@ -142,6 +142,7 @@ Channel( height: 1192, ), ], + visitor_data: Some("Cgs4ZFVmMzVlU1dxbyiBqpeaBg%3D%3D"), content: Paginator( count: None, items: [ diff --git a/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_base.snap b/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_base.snap index 25a9b7c..b847a69 100644 --- a/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_base.snap +++ b/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_base.snap @@ -142,6 +142,7 @@ Channel( height: 1192, ), ], + visitor_data: Some("CgszNU5rbDVZS2hMcyim4K2ZBg%3D%3D"), content: Paginator( count: None, items: [ diff --git a/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_empty.snap b/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_empty.snap index 80d53ad..a2653b9 100644 --- a/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_empty.snap +++ b/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_empty.snap @@ -30,6 +30,7 @@ Channel( banner: [], mobile_banner: [], tv_banner: [], + visitor_data: Some("Cgtvc2s4UllvTGl6byigxseZBg%3D%3D"), content: Paginator( count: Some(0), items: [], diff --git a/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_live.snap b/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_live.snap index fc8a24e..b38a2a9 100644 --- a/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_live.snap +++ b/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_live.snap @@ -126,6 +126,7 @@ Channel( height: 1192, ), ], + visitor_data: Some("CgtkYXJITElwYmd4OCj85a2ZBg%3D%3D"), content: Paginator( count: Some(21), items: [ diff --git a/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_music.snap b/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_music.snap index 806e3ee..d1f6ad4 100644 --- a/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_music.snap +++ b/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_music.snap @@ -113,6 +113,7 @@ Channel( height: 1192, ), ], + visitor_data: Some("CgtCV1l2R2Rzb2ZSZyiu4a2ZBg%3D%3D"), content: Paginator( count: Some(0), items: [], diff --git a/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_shorts.snap b/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_shorts.snap index 5bfbb39..e7ecee8 100644 --- a/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_shorts.snap +++ b/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_shorts.snap @@ -113,6 +113,7 @@ Channel( height: 1192, ), ], + visitor_data: Some("CgtneXVRbGtSMWtlYyj75a2ZBg%3D%3D"), content: Paginator( count: None, items: [ diff --git a/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_upcoming.snap b/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_upcoming.snap index 67b9a35..a6820c0 100644 --- a/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_upcoming.snap +++ b/src/client/snapshots/rustypipe__client__channel__tests__map_channel_videos_upcoming.snap @@ -130,6 +130,7 @@ Channel( height: 1192, ), ], + visitor_data: Some("Cgs4Ri1tLW1KNWozNCjGk8yZBg%3D%3D"), content: Paginator( count: None, items: [ diff --git a/src/client/snapshots/rustypipe__client__player__tests__map_player_data_android.snap b/src/client/snapshots/rustypipe__client__player__tests__map_player_data_android.snap index 19447f2..0a578f7 100644 --- a/src/client/snapshots/rustypipe__client__player__tests__map_player_data_android.snap +++ b/src/client/snapshots/rustypipe__client__player__tests__map_player_data_android.snap @@ -424,4 +424,5 @@ VideoPlayer( expires_in_seconds: 21540, hls_manifest_url: None, dash_manifest_url: Some("https://manifest.googlevideo.com/api/manifest/dash/expire/1659481355/ei/q1jpYtOPEYSBgQeHmqbwAQ/ip/2003%3Ade%3Aaf0e%3A2f00%3Ade47%3A297%3Aa6db%3A774e/id/a4fbddf14c6649b4/source/youtube/requiressl/yes/playback_host/rr5---sn-h0jeenek.googlevideo.com/mh/mQ/mm/31%2C29/mn/sn-h0jeenek%2Csn-h0jelnez/ms/au%2Crdu/mv/m/mvi/5/pl/37/hfr/1/as/fmp4_audio_clear%2Cfmp4_sd_hd_clear/initcwndbps/1527500/vprv/1/mt/1659459429/fvip/4/itag_bl/376%2C377%2C384%2C385%2C612%2C613%2C617%2C619%2C623%2C628%2C655%2C656%2C660%2C662%2C666%2C671/keepalive/yes/fexp/24001373%2C24007246/itag/0/sparams/expire%2Cei%2Cip%2Cid%2Csource%2Crequiressl%2Chfr%2Cas%2Cvprv%2Citag/sig/AOq0QJ8wRAIgMm4a_MIHA3YUszKeruSy3exs5JwNjJAyLAwxL0yPdNMCIANb9GDMSTp_NT-PPhbvYMwRULJ5a9BO6MYD9FuWprC1/lsparams/playback_host%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps/lsig/AG3C_xAwRQIgETSOwhwWVMy7gmrFXZlJu655ToLzSwOEsT16oRyrWhACIQDkvOEw1fImz5omu4iVIRNFe-z-JC9v8WUyx281dW2NOw%3D%3D"), + visitor_data: Some("Cgt2aHFtQU5YZFBvYyirsaWXBg%3D%3D"), ) diff --git a/src/client/snapshots/rustypipe__client__player__tests__map_player_data_desktop.snap b/src/client/snapshots/rustypipe__client__player__tests__map_player_data_desktop.snap index ffbc7f9..2a06529 100644 --- a/src/client/snapshots/rustypipe__client__player__tests__map_player_data_desktop.snap +++ b/src/client/snapshots/rustypipe__client__player__tests__map_player_data_desktop.snap @@ -541,4 +541,5 @@ VideoPlayer( expires_in_seconds: 21540, hls_manifest_url: None, dash_manifest_url: Some("https://manifest.googlevideo.com/api/manifest/dash/expire/1659481355/ei/q1jpYtq3BJCX1gKVyJGQDg/ip/2003%3Ade%3Aaf0e%3A2f00%3Ade47%3A297%3Aa6db%3A774e/id/a4fbddf14c6649b4/source/youtube/requiressl/yes/playback_host/rr4---sn-h0jelnez.googlevideo.com/mh/mQ/mm/31%2C26/mn/sn-h0jelnez%2Csn-4g5edn6k/ms/au%2Conr/mv/m/mvi/4/pl/37/hfr/all/as/fmp4_audio_clear%2Cwebm_audio_clear%2Cwebm2_audio_clear%2Cfmp4_sd_hd_clear%2Cwebm2_sd_hd_clear/initcwndbps/1513750/spc/lT-KhrZGE2opztWyVdAtyUNlb8dXPDs/vprv/1/mt/1659459429/fvip/4/keepalive/yes/fexp/24001373%2C24007246/itag/0/sparams/expire%2Cei%2Cip%2Cid%2Csource%2Crequiressl%2Chfr%2Cas%2Cspc%2Cvprv%2Citag/sig/AOq0QJ8wRgIhAPEjHK19PKVHqQeia6WF4qubuMYk74LGi8F8lk5ZMPkFAiEAsaB2pKQWBvuPnNUnbdQXHc-izgsHJUP793woC2xNJlg%3D/lsparams/playback_host%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps/lsig/AG3C_xAwRQIgOY4xu4H9wqPVZ7vF2i0hFcOnqrur1XGoA43a7ZEuuSUCIQCyPxBKXUQrKFmknNEGpX5GSWySKgMw_xHBikWpKpKwvg%3D%3D"), + visitor_data: Some("CgtoS1pCMVJTNUJISSirsaWXBg%3D%3D"), ) diff --git a/src/client/snapshots/rustypipe__client__player__tests__map_player_data_desktopmusic.snap b/src/client/snapshots/rustypipe__client__player__tests__map_player_data_desktopmusic.snap index e16d45e..d0bbd69 100644 --- a/src/client/snapshots/rustypipe__client__player__tests__map_player_data_desktopmusic.snap +++ b/src/client/snapshots/rustypipe__client__player__tests__map_player_data_desktopmusic.snap @@ -365,4 +365,5 @@ VideoPlayer( expires_in_seconds: 21540, hls_manifest_url: None, dash_manifest_url: Some("https://manifest.googlevideo.com/api/manifest/dash/expire/1659487474/ei/knDpYub6BojEgAf6jbLgDw/ip/2003%3Ade%3Aaf0e%3A2f00%3Ade47%3A297%3Aa6db%3A774e/id/a4fbddf14c6649b4/source/youtube/requiressl/yes/playback_host/rr5---sn-h0jeenek.googlevideo.com/mh/mQ/mm/31%2C29/mn/sn-h0jeenek%2Csn-h0jelnez/ms/au%2Crdu/mv/m/mvi/5/pl/37/hfr/all/as/fmp4_audio_clear%2Cwebm_audio_clear%2Cwebm2_audio_clear%2Cfmp4_sd_hd_clear%2Cwebm2_sd_hd_clear/initcwndbps/1418750/spc/lT-Khox4YuJQ2wmH79zYALRvsWTPCUc/vprv/1/mt/1659465669/fvip/4/keepalive/yes/fexp/24001373%2C24007246/itag/0/sparams/expire%2Cei%2Cip%2Cid%2Csource%2Crequiressl%2Chfr%2Cas%2Cspc%2Cvprv%2Citag/sig/AOq0QJ8wRAIgErABhAEaoKHUDu9dDbpxE_8gR4b8WWAi61fnu8UKnuICIEYrEKcHvqHdO4V3R7cvSGwi_HGH34IlQsKbziOfMBov/lsparams/playback_host%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps/lsig/AG3C_xAwRQIgJxHmH0Sxo3cY_pW_ZzQ3hW9-7oz6K_pZWcUdrDDQ2sQCIQDJYNINQwLgKelgbO3CZYx7sMxdUAFpWdokmRBQ77vwvw%3D%3D"), + visitor_data: Some("CgszSHZWNWs0SDhpTSiS4aWXBg%3D%3D"), ) diff --git a/src/client/snapshots/rustypipe__client__player__tests__map_player_data_ios.snap b/src/client/snapshots/rustypipe__client__player__tests__map_player_data_ios.snap index 78bc07b..287bb21 100644 --- a/src/client/snapshots/rustypipe__client__player__tests__map_player_data_ios.snap +++ b/src/client/snapshots/rustypipe__client__player__tests__map_player_data_ios.snap @@ -160,4 +160,5 @@ VideoPlayer( expires_in_seconds: 21540, hls_manifest_url: Some("https://manifest.googlevideo.com/api/manifest/hls_variant/expire/1659481355/ei/q1jpYq-xHs7NgQev0bfwAQ/ip/2003%3Ade%3Aaf0e%3A2f00%3Ade47%3A297%3Aa6db%3A774e/id/a4fbddf14c6649b4/source/youtube/requiressl/yes/playback_host/rr4---sn-h0jelnez.googlevideo.com/mh/mQ/mm/31%2C29/mn/sn-h0jelnez%2Csn-h0jeenek/ms/au%2Crdu/mv/m/mvi/4/pl/37/hfr/1/demuxed/1/tts_caps/1/maudio/1/initcwndbps/1513750/vprv/1/go/1/mt/1659459429/fvip/5/nvgoi/1/short_key/1/ncsapi/1/keepalive/yes/fexp/24001373%2C24007246/dover/13/itag/0/playlist_type/DVR/sparams/expire%2Cei%2Cip%2Cid%2Csource%2Crequiressl%2Chfr%2Cdemuxed%2Ctts_caps%2Cmaudio%2Cvprv%2Cgo%2Citag%2Cplaylist_type/sig/AOq0QJ8wRQIhAIYnEHvIgJtJ8hehAXNtVY3qsgsq_GdOhWf2hkJZe6lCAiBxaRY_nubYp6hBizcAg_KFkKnkG-t2XYLRQ5wGdM3AjA%3D%3D/lsparams/playback_host%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps/lsig/AG3C_xAwRgIhAM_91Kk_0VLuSsR6nLCY7LdtWojyRAzXSScd_X9ShRROAiEA1AF4VY04F71NsAI8_j3iqjuXnWL9s6NoXHq7P8-bHx8%3D/file/index.m3u8"), dash_manifest_url: None, + visitor_data: Some("Cgs4TXV4dk13WVEyWSirsaWXBg%3D%3D"), ) diff --git a/src/client/snapshots/rustypipe__client__player__tests__map_player_data_tvhtml5embed.snap b/src/client/snapshots/rustypipe__client__player__tests__map_player_data_tvhtml5embed.snap index e5184a2..dcffdf7 100644 --- a/src/client/snapshots/rustypipe__client__player__tests__map_player_data_tvhtml5embed.snap +++ b/src/client/snapshots/rustypipe__client__player__tests__map_player_data_tvhtml5embed.snap @@ -541,4 +541,5 @@ VideoPlayer( expires_in_seconds: 21540, hls_manifest_url: None, dash_manifest_url: Some("https://manifest.googlevideo.com/api/manifest/dash/expire/1659481355/ei/q1jpYv-eJ9uF6dsPhvyH8As/ip/2003%3Ade%3Aaf0e%3A2f00%3Ade47%3A297%3Aa6db%3A774e/id/a4fbddf14c6649b4/source/youtube/requiressl/yes/playback_host/rr4---sn-h0jelnez.googlevideo.com/mh/mQ/mm/31%2C29/mn/sn-h0jelnez%2Csn-h0jeenek/ms/au%2Crdu/mv/m/mvi/4/pl/37/hfr/all/as/fmp4_audio_clear%2Cfmp4_sd_hd_clear/initcwndbps/1527500/vprv/1/mt/1659459429/fvip/5/keepalive/yes/fexp/24001373%2C24007246/itag/0/sparams/expire%2Cei%2Cip%2Cid%2Csource%2Crequiressl%2Chfr%2Cas%2Cvprv%2Citag/sig/AOq0QJ8wRQIhANKWS7GCN4pSoHIQ6BMZdOaHAD0I25nHwRj7ds4qrxdEAiBsd9l8WIceqF7-2xyR82DGecCiS9hgUIPJhdNhkwVpHg%3D%3D/lsparams/playback_host%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps/lsig/AG3C_xAwRQIgMbu-wTOcXGCwGh27y0YZHktumKM1sopgxfQf8LCcCnECIQDnhFbgddOxwiQbnMOIcCn6ncpN54UyALRNigUSCp9Deg%3D%3D"), + visitor_data: Some("CgtacUJOMG81dTI3cyirsaWXBg%3D%3D"), ) diff --git a/src/client/snapshots/rustypipe__client__playlist__tests__map_playlist_data_long.snap b/src/client/snapshots/rustypipe__client__playlist__tests__map_playlist_data_long.snap index d2bcb21..ec08cf1 100644 --- a/src/client/snapshots/rustypipe__client__playlist__tests__map_playlist_data_long.snap +++ b/src/client/snapshots/rustypipe__client__playlist__tests__map_playlist_data_long.snap @@ -3142,4 +3142,5 @@ Playlist( )), last_update: "[date]", last_update_txt: Some("Last updated on Aug 7, 2022"), + visitor_data: Some("CgtZdi1GV3N3TnBuQSi46K-YBg%3D%3D"), ) diff --git a/src/client/snapshots/rustypipe__client__playlist__tests__map_playlist_data_nomusic.snap b/src/client/snapshots/rustypipe__client__playlist__tests__map_playlist_data_nomusic.snap index 40698fe..4dcaacc 100644 --- a/src/client/snapshots/rustypipe__client__playlist__tests__map_playlist_data_nomusic.snap +++ b/src/client/snapshots/rustypipe__client__playlist__tests__map_playlist_data_nomusic.snap @@ -2088,4 +2088,5 @@ Playlist( )), last_update: "[date]", last_update_txt: Some("Last updated on Jul 2, 2014"), + visitor_data: Some("CgtXY0lqNWN5VlNmTSik8q-YBg%3D%3D"), ) diff --git a/src/client/snapshots/rustypipe__client__playlist__tests__map_playlist_data_short.snap b/src/client/snapshots/rustypipe__client__playlist__tests__map_playlist_data_short.snap index cb76d35..6b92dda 100644 --- a/src/client/snapshots/rustypipe__client__playlist__tests__map_playlist_data_short.snap +++ b/src/client/snapshots/rustypipe__client__playlist__tests__map_playlist_data_short.snap @@ -3041,4 +3041,5 @@ Playlist( channel: None, last_update: "[date]", last_update_txt: Some("Updated today"), + visitor_data: Some("CgtLZVdRQ1dkM2VDVSi46K-YBg%3D%3D"), ) diff --git a/src/client/snapshots/rustypipe__client__search__tests__map_search_default.snap b/src/client/snapshots/rustypipe__client__search__tests__map_search_default.snap index 44a88f1..73cfaba 100644 --- a/src/client/snapshots/rustypipe__client__search__tests__map_search_default.snap +++ b/src/client/snapshots/rustypipe__client__search__tests__map_search_default.snap @@ -734,4 +734,5 @@ SearchResult( endpoint: browse, ), corrected_query: Some("doobydobap"), + visitor_data: Some("Cgs4MEJMc3FmVzVadyiNy4-aBg%3D%3D"), ) diff --git a/src/client/snapshots/rustypipe__client__search__tests__map_search_empty.snap b/src/client/snapshots/rustypipe__client__search__tests__map_search_empty.snap index 924e93b..9b7d8ad 100644 --- a/src/client/snapshots/rustypipe__client__search__tests__map_search_empty.snap +++ b/src/client/snapshots/rustypipe__client__search__tests__map_search_empty.snap @@ -10,4 +10,5 @@ SearchResult( endpoint: browse, ), corrected_query: None, + visitor_data: Some("Cgs1Q0NxX3llelBxWSi85ZGaBg%3D%3D"), ) diff --git a/src/client/snapshots/rustypipe__client__search__tests__map_search_playlists.snap b/src/client/snapshots/rustypipe__client__search__tests__map_search_playlists.snap index ccd3437..2ec5913 100644 --- a/src/client/snapshots/rustypipe__client__search__tests__map_search_playlists.snap +++ b/src/client/snapshots/rustypipe__client__search__tests__map_search_playlists.snap @@ -691,4 +691,5 @@ SearchResult( endpoint: browse, ), corrected_query: None, + visitor_data: Some("CgstZjhyS1IyR1R6dyiX4JGaBg%3D%3D"), ) diff --git a/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_20220924_newdesc.snap b/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_20220924_newdesc.snap index 8fe4e43..cd5de92 100644 --- a/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_20220924_newdesc.snap +++ b/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_20220924_newdesc.snap @@ -750,4 +750,5 @@ VideoDetails( ctoken: Some("Eg0SC1plZXJybnVMaTVFGAYyOCIRIgtaZWVycm51TGk1RTABeAIwAUIhZW5nYWdlbWVudC1wYW5lbC1jb21tZW50cy1zZWN0aW9u"), endpoint: next, ), + visitor_data: Some("CgtCeURHR09uNlJ5TSjOiLqZBg%3D%3D"), ) diff --git a/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_20221011_new_continuation.snap b/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_20221011_new_continuation.snap index 9d456b3..f7cc605 100644 --- a/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_20221011_new_continuation.snap +++ b/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_20221011_new_continuation.snap @@ -824,4 +824,5 @@ VideoDetails( ctoken: Some("Eg0SC1plZXJybnVMaTVFGAYyOCIRIgtaZWVycm51TGk1RTABeAIwAUIhZW5nYWdlbWVudC1wYW5lbC1jb21tZW50cy1zZWN0aW9u"), endpoint: next, ), + visitor_data: Some("Cgs2V0p6ZW5ab1ozTSjkrpaaBg%3D%3D"), ) diff --git a/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_20221011_rec_isr.snap b/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_20221011_rec_isr.snap index 27c86f6..64290ab 100644 --- a/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_20221011_rec_isr.snap +++ b/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_20221011_rec_isr.snap @@ -1282,4 +1282,5 @@ VideoDetails( ctoken: Some("Eg0SC25GREJ4QlVmRTc0GAYyOCIRIgtuRkRCeEJVZkU3NDABeAIwAUIhZW5nYWdlbWVudC1wYW5lbC1jb21tZW50cy1zZWN0aW9u"), endpoint: next, ), + visitor_data: Some("Cgtidzg4MlRTb3FKSSiqipeaBg%3D%3D"), ) diff --git a/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_agegate.snap b/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_agegate.snap index 263e711..e347844 100644 --- a/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_agegate.snap +++ b/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_agegate.snap @@ -54,4 +54,5 @@ VideoDetails( ctoken: Some("Eg0SC0hSS3UwY3Zycl9vGAYyOCIRIgtIUkt1MGN2cnJfbzABeAIwAUIhZW5nYWdlbWVudC1wYW5lbC1jb21tZW50cy1zZWN0aW9u"), endpoint: next, ), + visitor_data: Some("CgtxUUdrc1VSVE54Zyja1KiZBg%3D%3D"), ) diff --git a/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_ccommons.snap b/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_ccommons.snap index 47c7727..4f09d28 100644 --- a/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_ccommons.snap +++ b/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_ccommons.snap @@ -771,4 +771,5 @@ VideoDetails( ctoken: Some("Eg0SCzByYjlDZk92b2prGAYyOCIRIgswcmI5Q2ZPdm9qazABeAIwAUIhZW5nYWdlbWVudC1wYW5lbC1jb21tZW50cy1zZWN0aW9u"), endpoint: next, ), + visitor_data: Some("CgtoY1pQUF8wNW1qayjSjpSZBg%3D%3D"), ) diff --git a/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_chapters.snap b/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_chapters.snap index 6ba8145..cf0a7f7 100644 --- a/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_chapters.snap +++ b/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_chapters.snap @@ -1239,4 +1239,5 @@ VideoDetails( ctoken: Some("Eg0SC25GREJ4QlVmRTc0GAYyOCIRIgtuRkRCeEJVZkU3NDABeAIwAUIhZW5nYWdlbWVudC1wYW5lbC1jb21tZW50cy1zZWN0aW9u"), endpoint: next, ), + visitor_data: Some("CgtIV0JjSUtDQm9LQSjUjpSZBg%3D%3D"), ) diff --git a/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_live.snap b/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_live.snap index 84c663b..a13ff52 100644 --- a/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_live.snap +++ b/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_live.snap @@ -830,4 +830,5 @@ VideoDetails( ctoken: None, endpoint: next, ), + visitor_data: Some("CgtnQS1WdzlNNkNCSSiSmKiZBg%3D%3D"), ) diff --git a/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_music.snap b/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_music.snap index 771a3bf..1063b37 100644 --- a/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_music.snap +++ b/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_music.snap @@ -576,4 +576,5 @@ VideoDetails( ctoken: None, endpoint: next, ), + visitor_data: Some("CgtzclhqZVpoajVhVSi76qeZBg%3D%3D"), ) diff --git a/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_mv.snap b/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_mv.snap index c22301a..35853c7 100644 --- a/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_mv.snap +++ b/src/client/snapshots/rustypipe__client__video_details__tests__map_video_details_mv.snap @@ -787,4 +787,5 @@ VideoDetails( ctoken: Some("Eg0SC1plZXJybnVMaTVFGAYyOCIRIgtaZWVycm51TGk1RTABeAIwAUIhZW5nYWdlbWVudC1wYW5lbC1jb21tZW50cy1zZWN0aW9u"), endpoint: next, ), + visitor_data: Some("Cgtjemd0bDVxU1N1QSjRjpSZBg%3D%3D"), ) diff --git a/src/client/video_details.rs b/src/client/video_details.rs index dc62436..312608e 100644 --- a/src/client/video_details.rs +++ b/src/client/video_details.rs @@ -252,7 +252,7 @@ impl MapResponse for response::VideoDetails { let mut res = map_recommendations( r, sr.secondary_results.continuations, - self.response_context.visitor_data, + self.response_context.visitor_data.clone(), lang, ); warnings.append(&mut res.warnings); @@ -343,6 +343,7 @@ impl MapResponse for response::VideoDetails { None, crate::param::ContinuationEndpoint::Next, ), + visitor_data: self.response_context.visitor_data, }, warnings, }) diff --git a/src/model/mod.rs b/src/model/mod.rs index fb8bb4b..ab1b307 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -112,8 +112,12 @@ pub struct VideoPlayer { pub subtitles: Vec, /// Lifetime of the stream URLs in seconds pub expires_in_seconds: u32, + /// HLS manifest URL (for livestreams) pub hls_manifest_url: Option, + /// Dash manifest URL (for livestreams) pub dash_manifest_url: Option, + /// YouTube visitor data cookie + pub visitor_data: Option, } /// Video metadata from the player @@ -461,6 +465,8 @@ pub struct Playlist { pub last_update: Option, /// Textual last update date pub last_update_txt: Option, + /// YouTube visitor data cookie + pub visitor_data: Option, } /// YouTube video extracted from a playlist @@ -543,6 +549,8 @@ pub struct VideoDetails { /// /// Is initially empty. pub latest_comments: Paginator, + /// YouTube visitor data cookie + pub visitor_data: Option, } /// Chapter of a video @@ -675,6 +683,8 @@ pub struct Channel { pub mobile_banner: Vec, /// Banner image shown above the channel (16:9 fullscreen format for TV) pub tv_banner: Vec, + /// YouTube visitor data cookie + pub visitor_data: Option, /// Content fetched from the channel pub content: T, } @@ -745,6 +755,8 @@ pub struct SearchResult { /// for the corrected search term and displays it on top of the /// search results page. pub corrected_query: Option, + /// YouTube visitor data cookie + pub visitor_data: Option, } /// YouTube item (Video/Channel/Playlist)