diff --git a/src/client/mod.rs b/src/client/mod.rs index d94a856..0615b6a 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -146,6 +146,14 @@ struct QBrowse<'a> { browse_id: &'a str, } +#[derive(Debug, Serialize)] +#[serde(rename_all = "camelCase")] +struct QBrowseParams<'a> { + context: YTContext<'a>, + browse_id: &'a str, + params: &'a str, +} + #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] struct QContinuation<'a> { diff --git a/src/client/music_artist.rs b/src/client/music_artist.rs index b0efdf4..218ec04 100644 --- a/src/client/music_artist.rs +++ b/src/client/music_artist.rs @@ -3,7 +3,6 @@ use std::{borrow::Cow, rc::Rc}; use futures::{stream, StreamExt}; use once_cell::sync::Lazy; use regex::Regex; -use serde::Serialize; use crate::{ error::{Error, ExtractionError}, @@ -14,17 +13,9 @@ use crate::{ use super::{ response::{self, music_item::MusicListMapper, url_endpoint::PageType}, - ClientType, MapResponse, QBrowse, RustyPipeQuery, YTContext, + ClientType, MapResponse, QBrowse, QBrowseParams, RustyPipeQuery, }; -#[derive(Debug, Serialize)] -#[serde(rename_all = "camelCase")] -struct QBrowseParams<'a> { - context: YTContext<'a>, - browse_id: &'a str, - params: &'a str, -} - impl RustyPipeQuery { /// Get a YouTube Music artist page /// diff --git a/src/client/music_genres.rs b/src/client/music_genres.rs index 30877ad..380b4b0 100644 --- a/src/client/music_genres.rs +++ b/src/client/music_genres.rs @@ -1,7 +1,5 @@ use std::borrow::Cow; -use serde::Serialize; - use crate::{ error::{Error, ExtractionError}, model::{MusicGenre, MusicGenreItem, MusicGenreSection}, @@ -10,17 +8,9 @@ use crate::{ use super::{ response::{self, music_item::MusicListMapper}, - ClientType, MapResponse, QBrowse, RustyPipeQuery, YTContext, + ClientType, MapResponse, QBrowse, QBrowseParams, RustyPipeQuery, }; -#[derive(Debug, Serialize)] -#[serde(rename_all = "camelCase")] -struct QGenre<'a> { - context: YTContext<'a>, - browse_id: &'a str, - params: &'a str, -} - impl RustyPipeQuery { /// Get a list of moods and genres from YouTube Music pub async fn music_genres(&self) -> Result, Error> { @@ -44,7 +34,7 @@ impl RustyPipeQuery { pub async fn music_genre>(&self, genre_id: S) -> Result { let genre_id = genre_id.as_ref(); let context = self.get_context(ClientType::DesktopMusic, true, None).await; - let request_body = QGenre { + let request_body = QBrowseParams { context, browse_id: "FEmusic_moods_and_genres_category", params: genre_id, diff --git a/src/client/music_playlist.rs b/src/client/music_playlist.rs index 107a0b8..3a646ca 100644 --- a/src/client/music_playlist.rs +++ b/src/client/music_playlist.rs @@ -57,6 +57,19 @@ impl RustyPipeQuery { ) .await?; + // In rare cases, albums may have track numbers =0 (example: MPREb_RM0QfZ0eSKL) + // They should be replaced with the track number derived from the previous track. + let mut n_prev = 0; + for track in album.tracks.iter_mut() { + let tn = track.track_nr.unwrap_or_default(); + if tn == 0 { + n_prev += 1; + track.track_nr = Some(n_prev); + } else { + n_prev = tn; + } + } + // YouTube Music is replacing album tracks with their respective music videos. To get the original // tracks, we have to fetch the album as a playlist and replace the offending track ids. if let Some(playlist_id) = &album.playlist_id { @@ -67,7 +80,7 @@ impl RustyPipeQuery { .enumerate() .filter_map(|(i, track)| { if track.is_video { - Some((i, track.name.to_owned())) + track.track_nr.map(|n| (i, n)) } else { None } @@ -75,27 +88,14 @@ impl RustyPipeQuery { .collect::>(); if !to_replace.is_empty() { - match self.music_playlist(playlist_id).await { - Ok(playlist) => { - for (i, title) in to_replace { - let found_track = playlist.tracks.items.iter().find_map(|track| { - if track.name == title && !track.is_video { - Some((track.id.to_owned(), track.duration)) - } else { - None - } - }); - if let Some((track_id, duration)) = found_track { - album.tracks[i].id = track_id; - if let Some(duration) = duration { - album.tracks[i].duration = Some(duration); - } - album.tracks[i].is_video = false; - } - } + let playlist = self.playlist_w_unavail(playlist_id).await?; + + for (i, track_n) in to_replace { + if let Some(t) = playlist.videos.items.get(track_n as usize - 1) { + album.tracks[i].id = t.id.to_owned(); + album.tracks[i].duration = Some(t.length); + album.tracks[i].is_video = false; } - Err(Error::Extraction(_)) => {} - Err(e) => return Err(e), } } } diff --git a/src/client/playlist.rs b/src/client/playlist.rs index e14c98a..fae3622 100644 --- a/src/client/playlist.rs +++ b/src/client/playlist.rs @@ -9,7 +9,10 @@ use crate::{ util::{self, TryRemove}, }; -use super::{response, ClientType, MapResponse, MapResult, QBrowse, QContinuation, RustyPipeQuery}; +use super::{ + response, ClientType, MapResponse, MapResult, QBrowse, QBrowseParams, QContinuation, + RustyPipeQuery, +}; impl RustyPipeQuery { /// Get a YouTube playlist @@ -31,6 +34,29 @@ impl RustyPipeQuery { .await } + /// Get a YouTube playlist including unavailable tracks + pub(crate) async fn playlist_w_unavail>( + &self, + playlist_id: S, + ) -> Result { + let playlist_id = playlist_id.as_ref(); + let context = self.get_context(ClientType::Desktop, true, None).await; + let request_body = QBrowseParams { + context, + browse_id: &format!("VL{playlist_id}"), + params: "wgYCCAA%3D", + }; + + self.execute_request::( + ClientType::Desktop, + "playlist", + playlist_id, + "browse", + &request_body, + ) + .await + } + /// Get more playlist items using the given continuation token pub async fn playlist_continuation>( &self, diff --git a/tests/snapshots/youtube__music_album_ep.snap b/tests/snapshots/youtube__music_album_ep.snap index 161096d..ad3d47b 100644 --- a/tests/snapshots/youtube__music_album_ep.snap +++ b/tests/snapshots/youtube__music_album_ep.snap @@ -43,7 +43,7 @@ MusicAlbum( TrackItem( id: "Jz-26iiDuYs", name: "Waldbrand", - duration: Some(208), + duration: Some(209), cover: [], artists: [ ArtistId( diff --git a/tests/snapshots/youtube__music_album_tn_zero.snap b/tests/snapshots/youtube__music_album_tn_zero.snap new file mode 100644 index 0000000..c4e7f6e --- /dev/null +++ b/tests/snapshots/youtube__music_album_tn_zero.snap @@ -0,0 +1,780 @@ +--- +source: tests/youtube.rs +expression: album +--- +MusicAlbum( + id: "MPREb_RM0QfZ0eSKL", + playlist_id: Some("OLAK5uy_kJpQ8rrI50kwRV-FTS92jdE-RAkUnFFTc"), + name: "Wake Your Mind (Deluxe Edition)", + cover: "[cover]", + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + description: Some("Wake Your Mind is the fifth studio album by German Trance duo Cosmic Gate. It was released on October 24, 2011 as a digital release on Beatport and October 31, 2011 on all other digital retailers.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Wake_Your_Mind) under Creative Commons Attribution CC-BY-SA 3.0 (https://creativecommons.org/licenses/by-sa/3.0/legalcode)"), + album_type: Album, + year: Some(2011), + by_va: false, + tracks: [ + TrackItem( + id: "i2BXHjoK6Pc", + name: "Sometimes They Come Back for More", + duration: Some(448), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ArtistId( + id: Some("UCeaHkytFYZHuP_5My8uhaRQ"), + name: "Arnej", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(1), + by_va: false, + ), + TrackItem( + id: "HbjCfOa8P5Y", + name: "Be Your Sound", + duration: Some(252), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ArtistId( + id: Some("UCU-OklRKmlSN9FUhyvwkylg"), + name: "Emma Hewitt", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(2), + by_va: false, + ), + TrackItem( + id: "qRicdCPpo9Q", + name: "Wake Your Mind", + duration: Some(365), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ArtistId( + id: Some("UCc7OiFZMRwpZXRJ6jQas2pg"), + name: "Cary Brothers", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(3), + by_va: false, + ), + TrackItem( + id: "Sdvmezb4uTw", + name: "The Theme", + duration: Some(260), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(4), + by_va: false, + ), + TrackItem( + id: "hNDXx4vaoKs", + name: "All Around You", + duration: Some(334), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ArtistId( + id: Some("UC5hgy_aZwBDZLfxrMHFoD_Q"), + name: "Aruna", + ), + ArtistId( + id: Some("UCq346_97fIcWXPiGOtqLPtg"), + name: "Shane 54", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(5), + by_va: false, + ), + TrackItem( + id: "qB1Y4-O9MRM", + name: "Never Apart", + duration: Some(330), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ArtistId( + id: Some("UCkWEAKM8DvaE0dEqPgxK-3Q"), + name: "Alana Aldea", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(6), + by_va: false, + ), + TrackItem( + id: "bZkY60_Ohvs", + name: "Over the Rainbow", + duration: Some(293), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate and J\'Something", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(7), + by_va: false, + ), + TrackItem( + id: "znQfnmObaDg", + name: "Nothing Ever Lasts", + duration: Some(368), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ArtistId( + id: Some("UC2-3iA9cVO3zmfqBpI_9SAw"), + name: "Andrew Bayer", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(8), + by_va: false, + ), + TrackItem( + id: "Mu0HlrLCP44", + name: "Calm Down", + duration: Some(337), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ArtistId( + id: Some("UCU-OklRKmlSN9FUhyvwkylg"), + name: "Emma Hewitt", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(9), + by_va: false, + ), + TrackItem( + id: "87L2Lqeaz4Y", + name: "Barra", + duration: Some(222), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(10), + by_va: false, + ), + TrackItem( + id: "ZPrAwsjeUBo", + name: "Drifting Away", + duration: Some(336), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ArtistId( + id: Some("UCU22cXBIulEYuIjQ3ez7Cbg"), + name: "Cathy Burton", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(11), + by_va: false, + ), + TrackItem( + id: "Y9FknSw3x6U", + name: "Flying Blind", + duration: Some(365), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ArtistId( + id: Some("UCYMm13OXcL9llzuervQ1_Ig"), + name: "JES", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(12), + by_va: false, + ), + TrackItem( + id: "w9SUevHpYaU", + name: "Perfect Stranger", + duration: Some(331), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(13), + by_va: false, + ), + TrackItem( + id: "3UweyDiE1Og", + name: "Beautiful Destruction", + duration: Some(361), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ArtistId( + id: Some("UCkWEAKM8DvaE0dEqPgxK-3Q"), + name: "Alana Aldea", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(14), + by_va: false, + ), + TrackItem( + id: "huS3sgQ7ZiI", + name: "Free Falling [Barra]", + duration: Some(226), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ArtistId( + id: Some("UC5hgy_aZwBDZLfxrMHFoD_Q"), + name: "Aruna", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(15), + by_va: false, + ), + TrackItem( + id: "PbTuejdARwQ", + name: "Sometimes They Come Back for More (Stoneface & Terminal Remix)", + duration: Some(463), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate and Arnej", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(16), + by_va: false, + ), + TrackItem( + id: "B1u98t6fwjs", + name: "Be Your Sound (Orjan Nilsen Remix)", + duration: Some(537), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ArtistId( + id: Some("UCU-OklRKmlSN9FUhyvwkylg"), + name: "Emma Hewitt", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(17), + by_va: false, + ), + TrackItem( + id: "npQDHZh3xps", + name: "Wake Your Mind (Tritonal Remix)", + duration: Some(416), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ArtistId( + id: Some("UCc7OiFZMRwpZXRJ6jQas2pg"), + name: "Cary Brothers", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(18), + by_va: false, + ), + TrackItem( + id: "mbgIthuB8dY", + name: "The Blue Theme (Ferry Corsten Fix)", + duration: Some(446), + cover: [], + artists: [ + ArtistId( + id: Some("UC53Zmeku4tigP7KwAHxWX8A"), + name: "System F", + ), + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ], + artist_id: Some("UC53Zmeku4tigP7KwAHxWX8A"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(19), + by_va: false, + ), + TrackItem( + id: "uMfVA0Atofk", + name: "All Around You (Alexander Popov Remix)", + duration: Some(437), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ArtistId( + id: Some("UCq346_97fIcWXPiGOtqLPtg"), + name: "Shane 54", + ), + ArtistId( + id: Some("UC5hgy_aZwBDZLfxrMHFoD_Q"), + name: "Aruna", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(20), + by_va: false, + ), + TrackItem( + id: "W_8gRFJOLsY", + name: "Never Apart (Steve Brian Remix)", + duration: Some(406), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ArtistId( + id: Some("UCkWEAKM8DvaE0dEqPgxK-3Q"), + name: "Alana Aldea", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(21), + by_va: false, + ), + TrackItem( + id: "p_0jK0XDrg8", + name: "Over the Rainbow (W&W Remix)", + duration: Some(339), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ArtistId( + id: Some("UCx6EvdNe0luLrC_Rj8Wk10w"), + name: "J’Something", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(22), + by_va: false, + ), + TrackItem( + id: "CdCjMlyjpAg", + name: "Nothing Ever Lasts (Nitrous Oxide Remix)", + duration: Some(455), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate and Andrew Bayer", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(23), + by_va: false, + ), + TrackItem( + id: "c7yShI25Y-Q", + name: "Calm Down (Omnia Remix)", + duration: Some(391), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ArtistId( + id: Some("UCU-OklRKmlSN9FUhyvwkylg"), + name: "Emma Hewitt", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(24), + by_va: false, + ), + TrackItem( + id: "gJB7xwuvREs", + name: "Drifting Away (Faruk Sabanci Remix)", + duration: Some(393), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ArtistId( + id: Some("UCU22cXBIulEYuIjQ3ez7Cbg"), + name: "Cathy Burton", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(25), + by_va: false, + ), + TrackItem( + id: "lfOhL0ah0lw", + name: "Flying Blind (Tom Fall Remix)", + duration: Some(469), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate and JES", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(26), + by_va: false, + ), + TrackItem( + id: "ilrtbPk2RE8", + name: "Perfect Stranger (Wezz Devall Remix)", + duration: Some(404), + cover: [], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album: Some(AlbumId( + id: "MPREb_RM0QfZ0eSKL", + name: "Wake Your Mind (Deluxe Edition)", + )), + view_count: None, + is_video: false, + track_nr: Some(27), + by_va: false, + ), + ], + variants: [ + AlbumItem( + id: "MPREb_75NZMCMZQW4", + name: "Wake Your Mind", + cover: [ + Thumbnail( + url: "https://lh3.googleusercontent.com/gta0XN_TQLselp1ymFyIACP2_Px4wvoSdI0XKOAWKqlSuYvRGLg9FuKPX0DkJifUYAm7fNJmRpupyvgO=w226-h226-l90-rj", + width: 226, + height: 226, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/gta0XN_TQLselp1ymFyIACP2_Px4wvoSdI0XKOAWKqlSuYvRGLg9FuKPX0DkJifUYAm7fNJmRpupyvgO=w544-h544-l90-rj", + width: 544, + height: 544, + ), + ], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album_type: Album, + year: None, + by_va: false, + ), + AlbumItem( + id: "MPREb_csntSntqO8R", + name: "Wake Your Mind", + cover: [ + Thumbnail( + url: "https://lh3.googleusercontent.com/Rxmu8lBHszFtHGyToeorDBCpT9pmNQBWZLq7KXfxysktTx-ebcrIOBwpfuNbaNtGvrAfTSvAZelB5dXT6w=w226-h226-l90-rj", + width: 226, + height: 226, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/Rxmu8lBHszFtHGyToeorDBCpT9pmNQBWZLq7KXfxysktTx-ebcrIOBwpfuNbaNtGvrAfTSvAZelB5dXT6w=w544-h544-l90-rj", + width: 544, + height: 544, + ), + ], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album_type: Album, + year: None, + by_va: false, + ), + AlbumItem( + id: "MPREb_lidKOifLvXm", + name: "Wake Your Mind (The Extended Mixes)", + cover: [ + Thumbnail( + url: "https://lh3.googleusercontent.com/Odk-iPowyYddbohhb20Zf23qopAWms68hiWS1uHX_ej4Gab0-Dh3ZuhBIdumE6rqk5XD1faZhVBK59lg1Q=w226-h226-l90-rj", + width: 226, + height: 226, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/Odk-iPowyYddbohhb20Zf23qopAWms68hiWS1uHX_ej4Gab0-Dh3ZuhBIdumE6rqk5XD1faZhVBK59lg1Q=w544-h544-l90-rj", + width: 544, + height: 544, + ), + ], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album_type: Album, + year: None, + by_va: false, + ), + AlbumItem( + id: "MPREb_qSDBQBGK1bP", + name: "Wake Your Mind (Deluxe Edition)", + cover: [ + Thumbnail( + url: "https://lh3.googleusercontent.com/R39ek9HrT7nWzVZNj2GUR3owNlbgyT7e-W-5SuPRRpLgbrE_OSTAy70LzLlk42ftNtbRJQYSMrat8VfSFg=w226-h226-l90-rj", + width: 226, + height: 226, + ), + Thumbnail( + url: "https://lh3.googleusercontent.com/R39ek9HrT7nWzVZNj2GUR3owNlbgyT7e-W-5SuPRRpLgbrE_OSTAy70LzLlk42ftNtbRJQYSMrat8VfSFg=w544-h544-l90-rj", + width: 544, + height: 544, + ), + ], + artists: [ + ArtistId( + id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + name: "Cosmic Gate", + ), + ], + artist_id: Some("UC2JiS71Dbgd_4bB4hMKebeg"), + album_type: Album, + year: None, + by_va: false, + ), + ], +) diff --git a/tests/youtube.rs b/tests/youtube.rs index 98232c3..a3ddee6 100644 --- a/tests/youtube.rs +++ b/tests/youtube.rs @@ -1289,6 +1289,7 @@ fn music_playlist_not_found(rp: RustyPipe) { #[case::no_year("no_year", "MPREb_F3Af9UZZVxX")] #[case::version_no_artist("version_no_artist", "MPREb_h8ltx5oKvyY")] #[case::no_artist("no_artist", "MPREb_bqWA6mAZFWS")] +#[case::tn_zero("tn_zero", "MPREb_RM0QfZ0eSKL")] fn music_album(#[case] name: &str, #[case] id: &str, rp: RustyPipe) { let album = tokio_test::block_on(rp.query().music_album(id)).unwrap();