From d29bbd8b25a18505cbaaea8506858dedb480b098 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Mon, 31 Oct 2022 11:10:10 +0100 Subject: [PATCH] feat: music search, mapping done --- src/client/music_search.rs | 2 +- src/client/response/music_item.rs | 88 ++-- src/client/response/music_search.rs | 1 + ...st__tests__map_music_album_one_artist.snap | 4 +- ...aylist__tests__map_music_album_single.snap | 2 +- ...ests__map_music_album_various_artists.snap | 2 +- ...arch__tests__map_music_search_default.snap | 347 +++++++++++++++- ..._search__tests__map_music_search_typo.snap | 386 +++++++++++++++++- src/model/mod.rs | 1 - 9 files changed, 793 insertions(+), 40 deletions(-) diff --git a/src/client/music_search.rs b/src/client/music_search.rs index 523ca7d..cc4b9f7 100644 --- a/src/client/music_search.rs +++ b/src/client/music_search.rs @@ -64,7 +64,7 @@ impl MapResponse for response::MusicSearch { lang: crate::param::Language, _deobf: Option<&crate::deobfuscate::Deobfuscator>, ) -> Result, crate::error::ExtractionError> { - dbg!(&self); + // dbg!(&self); let mut tabs = self.contents.tabbed_search_results_renderer.contents; let sections = tabs diff --git a/src/client/response/music_item.rs b/src/client/response/music_item.rs index cd7d5cc..f418f17 100644 --- a/src/client/response/music_item.rs +++ b/src/client/response/music_item.rs @@ -8,7 +8,7 @@ use crate::{ text::{Text, TextComponents}, MapResult, VecLogError, }, - util, + util::{self, TryRemove}, }; use super::{ @@ -150,6 +150,12 @@ pub(crate) struct MusicColumnRenderer { pub text: TextComponents, } +impl From for TextComponents { + fn from(col: MusicColumn) -> Self { + col.renderer.text + } +} + impl From for Vec { fn from(tr: MusicThumbnailRenderer) -> Self { tr.music_thumbnail_renderer.thumbnail.into() @@ -225,7 +231,7 @@ impl MusicListMapper { title.ok_or_else(|| format!("track {}: could not get title", id))?; let mut subtitle_parts = c2 - .ok_or_else(|| format!("track {}: could not get subtitle", id))? + .ok_or_else(|| format!("item {}: could not get subtitle", id))? .renderer .text .split(util::DOT_SEPARATOR) @@ -320,39 +326,65 @@ impl MusicListMapper { let is_video = !first_tn.map(|tn| tn.height == tn.width).unwrap_or_default(); - let duration = item - .fixed_columns - .first() - .and_then(|col| { - col.renderer + let (artists_p, album_p, duration_p) = match item.flex_column_display_style + { + FlexColumnDisplayStyle::TwoLines => { + let mut subtitle_parts = c2 + .ok_or_else(|| format!("track {}: could not get subtitle", id))? + .renderer .text - .0 - .first() - .and_then(|txt| util::parse_video_length(txt.as_str())) - }) + .split(util::DOT_SEPARATOR) + .into_iter(); + // Skip first part (track type) + subtitle_parts.next(); + ( + subtitle_parts.next(), + subtitle_parts.next(), + subtitle_parts.next(), + ) + } + FlexColumnDisplayStyle::Default => { + let mut fixed_columns = item.fixed_columns; + ( + c2.map(TextComponents::from), + c3.map(TextComponents::from), + fixed_columns.try_swap_remove(0).map(TextComponents::from), + ) + } + }; + + let duration = duration_p + .and_then(|p| util::parse_video_length(&p.to_string())) .ok_or_else(|| format!("track {}: could not parse duration", id))?; - let album = c3.and_then(|col| { - col.renderer - .text - .0 - .into_iter() - .find_map(|c| model::AlbumId::try_from(c).ok()) - }); + // The album field contains the track count for search videos + let (album, view_count) = match (item.flex_column_display_style, is_video) { + (FlexColumnDisplayStyle::TwoLines, true) => ( + None, + album_p.and_then(|p| { + util::parse_large_numstr(&p.to_string(), self.lang) + }), + ), + (_, false) => ( + album_p.and_then(|p| { + p.0.into_iter() + .find_map(|c| model::AlbumId::try_from(c).ok()) + }), + None, + ), + (FlexColumnDisplayStyle::Default, true) => (None, None), + }; - let mut artists_txt = c2 - .as_ref() - .and_then(|col| col.renderer.text.to_opt_string()); - let mut artists = c2 - .map(|col| { - col.renderer - .text - .0 - .into_iter() + let mut artists_txt = + artists_p.as_ref().and_then(TextComponents::to_opt_string); + let mut artists = artists_p + .map(|p| { + p.0.into_iter() .filter_map(|c| ChannelId::try_from(c).ok()) .collect::>() }) .unwrap_or_default(); + if let Some(a) = &self.o_artists { if artists.is_empty() && artists_txt.is_none() { let xa = a.clone(); @@ -369,7 +401,7 @@ impl MusicListMapper { artists, artists_txt, album, - view_count: None, + view_count, is_video, }); Ok(()) diff --git a/src/client/response/music_search.rs b/src/client/response/music_search.rs index 79dcb0b..feb66a5 100644 --- a/src/client/response/music_search.rs +++ b/src/client/response/music_search.rs @@ -24,6 +24,7 @@ pub(crate) struct SectionList { pub section_list_renderer: ContentsRenderer, } +#[allow(clippy::enum_variant_names)] #[serde_as] #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] diff --git a/src/client/snapshots/rustypipe__client__music_playlist__tests__map_music_album_one_artist.snap b/src/client/snapshots/rustypipe__client__music_playlist__tests__map_music_album_one_artist.snap index befbd6f..1266f51 100644 --- a/src/client/snapshots/rustypipe__client__music_playlist__tests__map_music_album_one_artist.snap +++ b/src/client/snapshots/rustypipe__client__music_playlist__tests__map_music_album_one_artist.snap @@ -35,7 +35,7 @@ MusicAlbum( ), ], artists_txt: "Oonagh", - album_type: album, + album_type: Album, year: Some(2016), by_va: false, tracks: [ @@ -351,7 +351,7 @@ MusicAlbum( ), ], artists_txt: "Oonagh", - album_type: album, + album_type: Album, year: None, ), ], diff --git a/src/client/snapshots/rustypipe__client__music_playlist__tests__map_music_album_single.snap b/src/client/snapshots/rustypipe__client__music_playlist__tests__map_music_album_single.snap index 0dc5d8b..b79b023 100644 --- a/src/client/snapshots/rustypipe__client__music_playlist__tests__map_music_album_single.snap +++ b/src/client/snapshots/rustypipe__client__music_playlist__tests__map_music_album_single.snap @@ -39,7 +39,7 @@ MusicAlbum( ), ], artists_txt: "Joel Brandenstein & Vanessa Mai", - album_type: single, + album_type: Single, year: Some(2020), by_va: false, tracks: [ diff --git a/src/client/snapshots/rustypipe__client__music_playlist__tests__map_music_album_various_artists.snap b/src/client/snapshots/rustypipe__client__music_playlist__tests__map_music_album_various_artists.snap index d30763c..4e94524 100644 --- a/src/client/snapshots/rustypipe__client__music_playlist__tests__map_music_album_various_artists.snap +++ b/src/client/snapshots/rustypipe__client__music_playlist__tests__map_music_album_various_artists.snap @@ -30,7 +30,7 @@ MusicAlbum( ], artists: [], artists_txt: "Various Artists", - album_type: single, + album_type: Single, year: Some(2022), by_va: true, tracks: [ diff --git a/src/client/snapshots/rustypipe__client__music_search__tests__map_music_search_default.snap b/src/client/snapshots/rustypipe__client__music_search__tests__map_music_search_default.snap index 6cc3db4..860b4fe 100644 --- a/src/client/snapshots/rustypipe__client__music_search__tests__map_music_search_default.snap +++ b/src/client/snapshots/rustypipe__client__music_search__tests__map_music_search_default.snap @@ -3,9 +3,350 @@ source: src/client/music_search.rs expression: map_res.c --- MusicSearchResult( - tracks: [], - albums: [], - artists: [], + tracks: [ + TrackItem( + id: "ZeerrnuLi5E", + title: "Black Mamba", + duration: 230, + cover: [ + Thumbnail( + url: "https://i.ytimg.com/vi/ZeerrnuLi5E/sddefault.jpg?sqp=-oaymwEWCJADEOEBIAQqCghqEJQEGHgg6AJIWg&rs=AMzJL3maNxpYzTFmXZBd8s1w1iE6rTBDaw", + width: 400, + height: 225, + ), + ], + artists: [ + ChannelId( + id: "UCEdZAdnnKqbaHOlv8nM6OtA", + name: "aespa", + ), + ], + artists_txt: Some("aespa"), + album: None, + view_count: Some(235000000), + is_video: true, + ), + TrackItem( + id: "BL-aIpCLWnU", + title: "Black Mamba", + duration: 175, + cover: [ + Thumbnail( + url: "https://lh3.googleusercontent.com/MOL4_Ula9hocErkX2xK_7mISFiWvQz51vReT14KCHF9wsqCEH6sO8iilFFelWMn7JOYIk2WFa-gMmw2uvw=w60-h60-l90-rj", + width: 60, + height: 60, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/MOL4_Ula9hocErkX2xK_7mISFiWvQz51vReT14KCHF9wsqCEH6sO8iilFFelWMn7JOYIk2WFa-gMmw2uvw=w120-h120-l90-rj", + width: 120, + height: 120, + ), + ], + artists: [ + ChannelId( + id: "UCEdZAdnnKqbaHOlv8nM6OtA", + name: "aespa", + ), + ], + artists_txt: Some("aespa"), + album: Some(AlbumId( + id: "MPREb_OpHWHwyNOuY", + name: "Black Mamba", + )), + view_count: None, + is_video: false, + ), + TrackItem( + id: "cATe8Toht70", + title: "Black Mamba", + duration: 74, + cover: [ + Thumbnail( + url: "https://lh3.googleusercontent.com/ZesxRmV1_bDW89z70eojCd6DofYPbzbgGaXSIRP3UjmE4nIAkOuWc8pXaozR4AwrzPQublDCKrg6vcxHOg=w60-h60-l90-rj", + width: 60, + height: 60, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/ZesxRmV1_bDW89z70eojCd6DofYPbzbgGaXSIRP3UjmE4nIAkOuWc8pXaozR4AwrzPQublDCKrg6vcxHOg=w120-h120-l90-rj", + width: 120, + height: 120, + ), + ], + artists: [ + ChannelId( + id: "UCfCNL5oajlQBAlyjWv1ChVw", + name: "Hans Zimmer", + ), + ChannelId( + id: "UCvTXGTZf9EvuCAwZOkoR2iQ", + name: "Lorne Balfe", + ), + ], + artists_txt: Some("Hans Zimmer & Lorne Balfe"), + album: Some(AlbumId( + id: "MPREb_UmDOhLpDsc0", + name: "Megamind (Music from the Motion Picture)", + )), + view_count: None, + is_video: false, + ), + TrackItem( + id: "WwNKyoizf8k", + title: "BLACK MAMBA", + duration: 182, + cover: [ + Thumbnail( + url: "https://lh3.googleusercontent.com/gall0XXuwoV_SYR3S6EgtOGaBC3YOR5wOpQxCyqgxC3Xht3Jc95Y-sFg-sGAcQl946MfurGY_xSv0YBT=w60-h60-l90-rj", + width: 60, + height: 60, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/gall0XXuwoV_SYR3S6EgtOGaBC3YOR5wOpQxCyqgxC3Xht3Jc95Y-sFg-sGAcQl946MfurGY_xSv0YBT=w120-h120-l90-rj", + width: 120, + height: 120, + ), + ], + artists: [ + ChannelId( + id: "UCz6yr3CgFGrrrPDa2asbWMQ", + name: "Bayamon PR Tribe", + ), + ], + artists_txt: Some("Bayamon PR Tribe"), + album: Some(AlbumId( + id: "MPREb_RV0PGHyGfkp", + name: "LISTEN ME", + )), + view_count: None, + is_video: false, + ), + TrackItem( + id: "yQUU29NwNF4", + title: "aespa(에스파) - Black Mamba @인기가요 inkigayo 20201122", + duration: 213, + cover: [ + Thumbnail( + url: "https://i.ytimg.com/vi/yQUU29NwNF4/sddefault.jpg?sqp=-oaymwEWCJADEOEBIAQqCghqEJQEGHgg6AJIWg&rs=AMzJL3k0HD8CTPlz4YU0hvy1GqKSf2HKUQ", + width: 400, + height: 225, + ), + ], + artists: [ + ChannelId( + id: "UCS_hnpJLQTvBkqALgapi_4g", + name: "스브스케이팝 X INKIGAYO", + ), + ], + artists_txt: Some("스브스케이팝 X INKIGAYO"), + album: None, + view_count: Some(10000000), + is_video: true, + ), + TrackItem( + id: "Ky5RT5oGg0w", + title: "Black Mamba", + duration: 287, + cover: [ + Thumbnail( + url: "https://i.ytimg.com/vi/Ky5RT5oGg0w/sddefault.jpg?sqp=-oaymwEWCJADEOEBIAQqCghqEJQEGHgg6AJIWg&rs=AMzJL3mB-DDgCruC-dhPM0v66ckiZJQnJg", + width: 400, + height: 225, + ), + ], + artists: [ + ChannelId( + id: "UCEdZAdnnKqbaHOlv8nM6OtA", + name: "aespa", + ), + ], + artists_txt: Some("aespa"), + album: None, + view_count: Some(18000000), + is_video: true, + ), + TrackItem( + id: "dz9bieeSVRw", + title: "aespa - Black Mamba (Music Bank) | KBS WORLD TV 201127", + duration: 192, + cover: [ + Thumbnail( + url: "https://i.ytimg.com/vi/dz9bieeSVRw/sddefault.jpg?sqp=-oaymwEWCJADEOEBIAQqCghqEJQEGHgg6AJIWg&rs=AMzJL3lsJGKTqJhnt-ckrJtBLlvSp46Y5g", + width: 400, + height: 225, + ), + ], + artists: [ + ChannelId( + id: "UC5BMQOsAB8hKUyHu9KI6yig", + name: "KBS WORLD TV", + ), + ], + artists_txt: Some("KBS WORLD TV"), + album: None, + view_count: Some(3200000), + is_video: true, + ), + ], + albums: [ + AlbumItem( + id: "MPREb_OpHWHwyNOuY", + name: "Black Mamba", + cover: [ + Thumbnail( + url: "https://lh3.googleusercontent.com/MOL4_Ula9hocErkX2xK_7mISFiWvQz51vReT14KCHF9wsqCEH6sO8iilFFelWMn7JOYIk2WFa-gMmw2uvw=w60-h60-l90-rj", + width: 60, + height: 60, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/MOL4_Ula9hocErkX2xK_7mISFiWvQz51vReT14KCHF9wsqCEH6sO8iilFFelWMn7JOYIk2WFa-gMmw2uvw=w120-h120-l90-rj", + width: 120, + height: 120, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/MOL4_Ula9hocErkX2xK_7mISFiWvQz51vReT14KCHF9wsqCEH6sO8iilFFelWMn7JOYIk2WFa-gMmw2uvw=w226-h226-l90-rj", + width: 226, + height: 226, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/MOL4_Ula9hocErkX2xK_7mISFiWvQz51vReT14KCHF9wsqCEH6sO8iilFFelWMn7JOYIk2WFa-gMmw2uvw=w544-h544-l90-rj", + width: 544, + height: 544, + ), + ], + artists: [ + ChannelId( + id: "UCEdZAdnnKqbaHOlv8nM6OtA", + name: "aespa", + ), + ], + artists_txt: "aespa", + album_type: Single, + year: Some(2020), + ), + AlbumItem( + id: "MPREb_pvdHyqvGjbI", + name: "Girls - The 2nd Mini Album", + cover: [ + Thumbnail( + url: "https://lh3.googleusercontent.com/JYOTl7neLJLMUEVjdg_qIqz7XjUZB2AQAx_sRDlNVd5jSYiv1xA0v68ZN8Kn0KKf1fSfQnTaeakGeQgI=w60-h60-l90-rj", + width: 60, + height: 60, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/JYOTl7neLJLMUEVjdg_qIqz7XjUZB2AQAx_sRDlNVd5jSYiv1xA0v68ZN8Kn0KKf1fSfQnTaeakGeQgI=w120-h120-l90-rj", + width: 120, + height: 120, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/JYOTl7neLJLMUEVjdg_qIqz7XjUZB2AQAx_sRDlNVd5jSYiv1xA0v68ZN8Kn0KKf1fSfQnTaeakGeQgI=w226-h226-l90-rj", + width: 226, + height: 226, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/JYOTl7neLJLMUEVjdg_qIqz7XjUZB2AQAx_sRDlNVd5jSYiv1xA0v68ZN8Kn0KKf1fSfQnTaeakGeQgI=w544-h544-l90-rj", + width: 544, + height: 544, + ), + ], + artists: [ + ChannelId( + id: "UCEdZAdnnKqbaHOlv8nM6OtA", + name: "aespa", + ), + ], + artists_txt: "aespa", + album_type: Album, + year: Some(2022), + ), + AlbumItem( + id: "MPREb_CznUTKnATw6", + name: "Black Mamba (feat. Foolio)", + cover: [ + Thumbnail( + url: "https://lh3.googleusercontent.com/3ut0tvS5LYcfHjLwrYPSYNbraALbFb9ov28b2GXHB8ABaMGWILUko_BJa1jpsSVrELE_B8so3NtYMVfb1g=w60-h60-l90-rj", + width: 60, + height: 60, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/3ut0tvS5LYcfHjLwrYPSYNbraALbFb9ov28b2GXHB8ABaMGWILUko_BJa1jpsSVrELE_B8so3NtYMVfb1g=w120-h120-l90-rj", + width: 120, + height: 120, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/3ut0tvS5LYcfHjLwrYPSYNbraALbFb9ov28b2GXHB8ABaMGWILUko_BJa1jpsSVrELE_B8so3NtYMVfb1g=w226-h226-l90-rj", + width: 226, + height: 226, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/3ut0tvS5LYcfHjLwrYPSYNbraALbFb9ov28b2GXHB8ABaMGWILUko_BJa1jpsSVrELE_B8so3NtYMVfb1g=w544-h544-l90-rj", + width: 544, + height: 544, + ), + ], + artists: [ + ChannelId( + id: "UCZK5n7V2-iPHfUXLV2tDvzw", + name: "Cojack", + ), + ], + artists_txt: "Cojack", + album_type: Single, + year: Some(2020), + ), + ], + artists: [ + ArtistItem( + id: "UCEdZAdnnKqbaHOlv8nM6OtA", + name: "aespa", + avatar: [ + Thumbnail( + url: "https://lh3.googleusercontent.com/gV8Sbt3iKraNm_H9ZaH3oh6ERRdN0Dj6qHmTLPiQQ4WS8uGNN09HlpujMJOWwei_z5yC9Th1cZXyOQ=w60-h60-p-l90-rj", + width: 60, + height: 60, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/gV8Sbt3iKraNm_H9ZaH3oh6ERRdN0Dj6qHmTLPiQQ4WS8uGNN09HlpujMJOWwei_z5yC9Th1cZXyOQ=w120-h120-p-l90-rj", + width: 120, + height: 120, + ), + ], + subscriber_count: Some(4120000), + ), + ArtistItem( + id: "UCaDT20-B3U8h-tPg_VMvntw", + name: "The Black Mamba", + avatar: [ + Thumbnail( + url: "https://lh3.googleusercontent.com/Vq3Jc5g2QNJCdkwHbk4uShyhlzwKx0oVovyBXH_AzQs7i6lF7eRN149E56bo4OP_rP2TPvYem8RV3DhV=w60-h60-l90-rj", + width: 60, + height: 60, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/Vq3Jc5g2QNJCdkwHbk4uShyhlzwKx0oVovyBXH_AzQs7i6lF7eRN149E56bo4OP_rP2TPvYem8RV3DhV=w120-h120-l90-rj", + width: 120, + height: 120, + ), + ], + subscriber_count: Some(2640), + ), + ArtistItem( + id: "UCLcwLJIGBDDvbfq8JERV6Ag", + name: "Black Mamba", + avatar: [ + Thumbnail( + url: "https://lh3.googleusercontent.com/qPN6oDatmKgTxytO4b8ScN1qGGMBpsF2_vH9OG1sSDn8Hew28J8vy9y4WNWOJYvSCyHbghIs_B5aGgkJ=w60-h60-l90-rj", + width: 60, + height: 60, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/qPN6oDatmKgTxytO4b8ScN1qGGMBpsF2_vH9OG1sSDn8Hew28J8vy9y4WNWOJYvSCyHbghIs_B5aGgkJ=w120-h120-l90-rj", + width: 120, + height: 120, + ), + ], + subscriber_count: Some(9), + ), + ], playlists: [ MusicPlaylistItem( id: "VLPLk76iSbFqNJsu_Gozn9SkEXxQ7t-bpXid", diff --git a/src/client/snapshots/rustypipe__client__music_search__tests__map_music_search_typo.snap b/src/client/snapshots/rustypipe__client__music_search__tests__map_music_search_typo.snap index 5dae64e..f46ee6d 100644 --- a/src/client/snapshots/rustypipe__client__music_search__tests__map_music_search_typo.snap +++ b/src/client/snapshots/rustypipe__client__music_search__tests__map_music_search_typo.snap @@ -3,8 +3,306 @@ source: src/client/music_search.rs expression: map_res.c --- MusicSearchResult( - tracks: [], - albums: [], + tracks: [ + TrackItem( + id: "6485PhOtHzY", + title: "Lieblingsmensch", + duration: 191, + cover: [ + Thumbnail( + url: "https://lh3.googleusercontent.com/dwrJ5NnlZU7CBziLRlTm1uizuolakRAX7g34-eKeqEZQGZgwmvhqcs3TiZClfm7v6a-KYHieitdakpPo=w60-h60-l90-rj", + width: 60, + height: 60, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/dwrJ5NnlZU7CBziLRlTm1uizuolakRAX7g34-eKeqEZQGZgwmvhqcs3TiZClfm7v6a-KYHieitdakpPo=w120-h120-l90-rj", + width: 120, + height: 120, + ), + ], + artists: [ + ChannelId( + id: "UCIh4j8fXWf2U0ro0qnGU8Mg", + name: "Namika", + ), + ], + artists_txt: Some("Namika"), + album: Some(AlbumId( + id: "MPREb_RXHxrUFfrvQ", + name: "Lieblingsmensch", + )), + view_count: None, + is_video: false, + ), + TrackItem( + id: "pt0YvfnhGgI", + title: "Lieblingsmensch", + duration: 524, + cover: [ + Thumbnail( + url: "https://lh3.googleusercontent.com/38mrm1ntm4MQfmB4Pl2EdY7o6McbLq06sC7qqLxDMqOfL-eqySheDnfl3IOpZYIE_ozt6Bywlmjj2DCe=w60-h60-l90-rj", + width: 60, + height: 60, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/38mrm1ntm4MQfmB4Pl2EdY7o6McbLq06sC7qqLxDMqOfL-eqySheDnfl3IOpZYIE_ozt6Bywlmjj2DCe=w120-h120-l90-rj", + width: 120, + height: 120, + ), + ], + artists: [ + ChannelId( + id: "UCCpID8TTjkkjLCwBybAfHSg", + name: "Boris Brejcha", + ), + ], + artists_txt: Some("Boris Brejcha"), + album: Some(AlbumId( + id: "MPREb_VFqQlfPhsFW", + name: "Lieblingsmensch", + )), + view_count: None, + is_video: false, + ), + TrackItem( + id: "0yPnvetCm-U", + title: "Lieblingsmensch", + duration: 174, + cover: [ + Thumbnail( + url: "https://lh3.googleusercontent.com/RORTouE503-ZZqgAov66r2cK-YyTJbZIwbM1Hz58ja7jNgWSG_xjTLxK41nwAT8ejRvY7U35dMm4OOYhYg=w60-h60-l90-rj", + width: 60, + height: 60, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/RORTouE503-ZZqgAov66r2cK-YyTJbZIwbM1Hz58ja7jNgWSG_xjTLxK41nwAT8ejRvY7U35dMm4OOYhYg=w120-h120-l90-rj", + width: 120, + height: 120, + ), + ], + artists: [ + ChannelId( + id: "UCvfUKCnUBfsZAVHgF-pYmJg", + name: "Voyce", + ), + ], + artists_txt: Some("Voyce"), + album: Some(AlbumId( + id: "MPREb_SpT32xAd4YR", + name: "Gegenstück EP", + )), + view_count: None, + is_video: false, + ), + TrackItem( + id: "3ryohiCVq3M", + title: "Namika - Lieblingsmensch (Official Video)", + duration: 191, + cover: [ + Thumbnail( + url: "https://i.ytimg.com/vi/3ryohiCVq3M/sddefault.jpg?sqp=-oaymwEWCJADEOEBIAQqCghqEJQEGHgg6AJIWg&rs=AMzJL3nsa7wZ13z3ie49RzcBHKQAmjlU9w", + width: 400, + height: 225, + ), + ], + artists: [ + ChannelId( + id: "UCIh4j8fXWf2U0ro0qnGU8Mg", + name: "Namika", + ), + ], + artists_txt: Some("Namika"), + album: None, + view_count: Some(108000000), + is_video: true, + ), + TrackItem( + id: "6Bt1KeMNqvc", + title: "Lieblingsmensch Namika Lyrics", + duration: 188, + cover: [ + Thumbnail( + url: "https://i.ytimg.com/vi/6Bt1KeMNqvc/sddefault.jpg?sqp=-oaymwEWCJADEOEBIAQqCghqEJQEGHgg6AJIWg&rs=AMzJL3n9IkVmxE5YqesHGPS0xtJemxrNzQ", + width: 400, + height: 225, + ), + ], + artists: [ + ChannelId( + id: "UCgoJMRKimbxB374QjHgE6kA", + name: "jessika adam", + ), + ], + artists_txt: Some("jessika adam"), + album: None, + view_count: Some(10000000), + is_video: true, + ), + TrackItem( + id: "5YQRHUItXTI", + title: "Namika - Lieblingsmensch 1 Hour Version", + duration: 3801, + cover: [ + Thumbnail( + url: "https://i.ytimg.com/vi/5YQRHUItXTI/sddefault.jpg?sqp=-oaymwEWCJADEOEBIAQqCghqEJQEGHgg6AJIWg&rs=AMzJL3kP0NYgZ5YbsGdULVIXOu08eoHGrw", + width: 400, + height: 225, + ), + ], + artists: [ + ChannelId( + id: "UCiQjRO2m3dBBlg7sqTaFA_A", + name: "ZockerAlarm", + ), + ], + artists_txt: Some("ZockerAlarm"), + album: None, + view_count: Some(56000), + is_video: true, + ), + ], + albums: [ + AlbumItem( + id: "MPREb_RXHxrUFfrvQ", + name: "Lieblingsmensch", + cover: [ + Thumbnail( + url: "https://lh3.googleusercontent.com/dwrJ5NnlZU7CBziLRlTm1uizuolakRAX7g34-eKeqEZQGZgwmvhqcs3TiZClfm7v6a-KYHieitdakpPo=w60-h60-l90-rj", + width: 60, + height: 60, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/dwrJ5NnlZU7CBziLRlTm1uizuolakRAX7g34-eKeqEZQGZgwmvhqcs3TiZClfm7v6a-KYHieitdakpPo=w120-h120-l90-rj", + width: 120, + height: 120, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/dwrJ5NnlZU7CBziLRlTm1uizuolakRAX7g34-eKeqEZQGZgwmvhqcs3TiZClfm7v6a-KYHieitdakpPo=w226-h226-l90-rj", + width: 226, + height: 226, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/dwrJ5NnlZU7CBziLRlTm1uizuolakRAX7g34-eKeqEZQGZgwmvhqcs3TiZClfm7v6a-KYHieitdakpPo=w544-h544-l90-rj", + width: 544, + height: 544, + ), + ], + artists: [ + ChannelId( + id: "UCIh4j8fXWf2U0ro0qnGU8Mg", + name: "Namika", + ), + ], + artists_txt: "Namika", + album_type: Single, + year: Some(2015), + ), + AlbumItem( + id: "MPREb_V5f8YfHKp2j", + name: "Lieblingsmensch", + cover: [ + Thumbnail( + url: "https://lh3.googleusercontent.com/vh1NIdzUQTuH3jlZFTJ-XK3f_QIUVJGZe1qTE-O1O8MZtylnx7JpYtd0NPSUWFFgIzlysNfbUOaeryr5Zw=w60-h60-l90-rj", + width: 60, + height: 60, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/vh1NIdzUQTuH3jlZFTJ-XK3f_QIUVJGZe1qTE-O1O8MZtylnx7JpYtd0NPSUWFFgIzlysNfbUOaeryr5Zw=w120-h120-l90-rj", + width: 120, + height: 120, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/vh1NIdzUQTuH3jlZFTJ-XK3f_QIUVJGZe1qTE-O1O8MZtylnx7JpYtd0NPSUWFFgIzlysNfbUOaeryr5Zw=w226-h226-l90-rj", + width: 226, + height: 226, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/vh1NIdzUQTuH3jlZFTJ-XK3f_QIUVJGZe1qTE-O1O8MZtylnx7JpYtd0NPSUWFFgIzlysNfbUOaeryr5Zw=w544-h544-l90-rj", + width: 544, + height: 544, + ), + ], + artists: [ + ChannelId( + id: "UCIh4j8fXWf2U0ro0qnGU8Mg", + name: "Namika", + ), + ], + artists_txt: "Namika", + album_type: Ep, + year: Some(2015), + ), + AlbumItem( + id: "MPREb_AlIjxpnBKtn", + name: "Lieblingsmensch (Edit)", + cover: [ + Thumbnail( + url: "https://lh3.googleusercontent.com/52NEd25MuR_LmWQw_sbHEm1s4jdiUm1SB25aLeFSaz70Z89GTdghmRNd21YgggAFbAg4NgMHiGpSdCyANw=w60-h60-l90-rj", + width: 60, + height: 60, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/52NEd25MuR_LmWQw_sbHEm1s4jdiUm1SB25aLeFSaz70Z89GTdghmRNd21YgggAFbAg4NgMHiGpSdCyANw=w120-h120-l90-rj", + width: 120, + height: 120, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/52NEd25MuR_LmWQw_sbHEm1s4jdiUm1SB25aLeFSaz70Z89GTdghmRNd21YgggAFbAg4NgMHiGpSdCyANw=w226-h226-l90-rj", + width: 226, + height: 226, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/52NEd25MuR_LmWQw_sbHEm1s4jdiUm1SB25aLeFSaz70Z89GTdghmRNd21YgggAFbAg4NgMHiGpSdCyANw=w544-h544-l90-rj", + width: 544, + height: 544, + ), + ], + artists: [ + ChannelId( + id: "UCCpID8TTjkkjLCwBybAfHSg", + name: "Boris Brejcha", + ), + ], + artists_txt: "Boris Brejcha", + album_type: Single, + year: Some(2019), + ), + AlbumItem( + id: "MPREb_VFqQlfPhsFW", + name: "Lieblingsmensch", + cover: [ + Thumbnail( + url: "https://lh3.googleusercontent.com/38mrm1ntm4MQfmB4Pl2EdY7o6McbLq06sC7qqLxDMqOfL-eqySheDnfl3IOpZYIE_ozt6Bywlmjj2DCe=w60-h60-l90-rj", + width: 60, + height: 60, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/38mrm1ntm4MQfmB4Pl2EdY7o6McbLq06sC7qqLxDMqOfL-eqySheDnfl3IOpZYIE_ozt6Bywlmjj2DCe=w120-h120-l90-rj", + width: 120, + height: 120, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/38mrm1ntm4MQfmB4Pl2EdY7o6McbLq06sC7qqLxDMqOfL-eqySheDnfl3IOpZYIE_ozt6Bywlmjj2DCe=w226-h226-l90-rj", + width: 226, + height: 226, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/38mrm1ntm4MQfmB4Pl2EdY7o6McbLq06sC7qqLxDMqOfL-eqySheDnfl3IOpZYIE_ozt6Bywlmjj2DCe=w544-h544-l90-rj", + width: 544, + height: 544, + ), + ], + artists: [ + ChannelId( + id: "UCCpID8TTjkkjLCwBybAfHSg", + name: "Boris Brejcha", + ), + ], + artists_txt: "Boris Brejcha", + album_type: Single, + year: Some(2019), + ), + ], artists: [ ArtistItem( id: "UCIh4j8fXWf2U0ro0qnGU8Mg", @@ -58,6 +356,88 @@ MusicSearchResult( subscriber_count: Some(22700), ), ], - playlists: [], + playlists: [ + MusicPlaylistItem( + id: "VLPL46jG0sBz4EabjYqv0tVEd1RvrZRjfJ8m", + name: "Lieblingsmensch", + thumbnail: [ + Thumbnail( + url: "https://yt3.ggpht.com/by72Kvz8N4he_jFPWRBMwQhNJiFa-Zy-rstO8aVacuFMZiH6tYQUMLbUtNZOs_8m2evJ59ccTKM=s192", + width: 192, + height: 192, + ), + Thumbnail( + url: "https://yt3.ggpht.com/by72Kvz8N4he_jFPWRBMwQhNJiFa-Zy-rstO8aVacuFMZiH6tYQUMLbUtNZOs_8m2evJ59ccTKM=s576", + width: 576, + height: 576, + ), + Thumbnail( + url: "https://yt3.ggpht.com/by72Kvz8N4he_jFPWRBMwQhNJiFa-Zy-rstO8aVacuFMZiH6tYQUMLbUtNZOs_8m2evJ59ccTKM=s1200", + width: 1200, + height: 1200, + ), + ], + channel: Some(ChannelId( + id: "UC2iUWrsf_RJIskqCZZHz4tg", + name: "Saskia Wehmeyer", + )), + track_count: Some(16), + from_ytm: false, + ), + MusicPlaylistItem( + id: "VLPL-2Z-8cOvEixQ2EKumbXXW8XivJG6U7-D", + name: "Namika - Lieblingsmensch", + thumbnail: [ + Thumbnail( + url: "https://yt3.ggpht.com/wQgbTyXbuwVAO1fK5Ssk6CfhXuRO0w-k8ipIv8nNsrD88lIL4wWMPkeDenb3Dy-XbqcCZNOVOkk=s192", + width: 192, + height: 192, + ), + Thumbnail( + url: "https://yt3.ggpht.com/wQgbTyXbuwVAO1fK5Ssk6CfhXuRO0w-k8ipIv8nNsrD88lIL4wWMPkeDenb3Dy-XbqcCZNOVOkk=s576", + width: 576, + height: 576, + ), + Thumbnail( + url: "https://yt3.ggpht.com/wQgbTyXbuwVAO1fK5Ssk6CfhXuRO0w-k8ipIv8nNsrD88lIL4wWMPkeDenb3Dy-XbqcCZNOVOkk=s1200", + width: 1200, + height: 1200, + ), + ], + channel: Some(ChannelId( + id: "UCSj8sEcs5CEUmeIZMSPB7Ew", + name: "Daniel Switali", + )), + track_count: Some(16), + from_ytm: false, + ), + MusicPlaylistItem( + id: "VLPLDnJKuRrOR5sx_jZ8-dsweq1OdayL_kpz", + name: "Lieblingsmensch", + thumbnail: [ + Thumbnail( + url: "https://yt3.ggpht.com/xij8t1OQqD8qwjx4AaYBbKkXsQDB5L70hKuFBicbaw7fQ2m9NMdsm_86bxyIIeyblwcm9FaWiA=s192", + width: 192, + height: 192, + ), + Thumbnail( + url: "https://yt3.ggpht.com/xij8t1OQqD8qwjx4AaYBbKkXsQDB5L70hKuFBicbaw7fQ2m9NMdsm_86bxyIIeyblwcm9FaWiA=s576", + width: 576, + height: 576, + ), + Thumbnail( + url: "https://yt3.ggpht.com/xij8t1OQqD8qwjx4AaYBbKkXsQDB5L70hKuFBicbaw7fQ2m9NMdsm_86bxyIIeyblwcm9FaWiA=s1200", + width: 1200, + height: 1200, + ), + ], + channel: Some(ChannelId( + id: "UCs2uL32TTzWX0oVoblPF1nQ", + name: "Nicole Kr", + )), + track_count: Some(6), + from_ytm: false, + ), + ], corrected_query: Some("lieblingsmensch"), ) diff --git a/src/model/mod.rs b/src/model/mod.rs index d6f3ddb..932ff28 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -950,7 +950,6 @@ pub struct MusicPlaylistItem { /// YouTube Music album type #[derive(Default, Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq)] -#[serde(rename_all = "snake_case")] pub enum AlbumType { /// Regular album (default) #[default]