fix: A/B test 16 (pageHeaderRenderer on playlist pages)

This commit is contained in:
ThetaDev 2024-10-12 05:47:47 +02:00
parent f3f2e1d3ca
commit e65f14556f
No known key found for this signature in database
GPG key ID: E319D3C5148D65B6
17 changed files with 6435 additions and 182 deletions

View file

@ -157,7 +157,7 @@ pub(crate) struct WatchEndpointConfig {
#[derive(Default, Debug, Clone, Copy, Deserialize, PartialEq, Eq)]
pub(crate) enum MusicVideoType {
#[default]
#[serde(rename = "MUSIC_VIDEO_TYPE_OMV")]
#[serde(rename = "MUSIC_VIDEO_TYPE_OMV", alias = "MUSIC_VIDEO_TYPE_UGC")]
Video,
#[serde(rename = "MUSIC_VIDEO_TYPE_ATV")]
Track,
@ -333,4 +333,26 @@ impl NavigationEndpoint {
None
}
}
pub(crate) fn into_playlist_id(self) -> Option<String> {
match self {
NavigationEndpoint::Watch { watch_endpoint } => watch_endpoint.playlist_id,
NavigationEndpoint::Browse {
browse_endpoint,
command_metadata,
} => Some(browse_endpoint.browse_id).filter(|_| {
browse_endpoint
.browse_endpoint_context_supported_configs
.map(|c| c.browse_endpoint_context_music_config.page_type == PageType::Playlist)
.unwrap_or_default()
|| command_metadata
.map(|c| c.web_command_metadata.web_page_type == PageType::Playlist)
.unwrap_or_default()
}),
NavigationEndpoint::Url { .. } => None,
NavigationEndpoint::WatchPlaylist {
watch_playlist_endpoint,
} => Some(watch_playlist_endpoint.playlist_id),
}
}
}