diff --git a/Justfile b/Justfile index 54b8f5e..77aaaeb 100644 --- a/Justfile +++ b/Justfile @@ -28,7 +28,7 @@ testintl: ) for YT_LANG in "${LANGUAGES[@]}"; do \ echo "---TESTS FOR $YT_LANG ---"; \ - YT_LANG="$YT_LANG" cargo test --test youtube -- --skip music_artist --skip music_playlist --skip get_video_details --skip startpage; \ + YT_LANG="$YT_LANG" cargo test --test youtube -- --skip get_video_details --skip startpage; \ echo "--- $YT_LANG COMPLETED ---"; \ sleep 10; \ done diff --git a/src/client/music_playlist.rs b/src/client/music_playlist.rs index 20c9fb5..0d126f6 100644 --- a/src/client/music_playlist.rs +++ b/src/client/music_playlist.rs @@ -4,7 +4,7 @@ use crate::{ error::{Error, ExtractionError}, model::{paginator::Paginator, AlbumId, ChannelId, MusicAlbum, MusicPlaylist, TrackItem}, serializer::MapResult, - util::{self, TryRemove}, + util::{self, TryRemove, DOT_SEPARATOR}, }; use super::{ @@ -160,14 +160,19 @@ impl MapResponse for response::MusicPlaylist { .try_swap_remove(0) .map(|cont| cont.next_continuation_data.continuation); - let track_count = match ctoken { - Some(_) => self.header.as_ref().and_then(|h| { - h.music_detail_header_renderer + let track_count = if ctoken.is_some() { + self.header.as_ref().and_then(|h| { + let parts = h + .music_detail_header_renderer .second_subtitle - .first() - .and_then(|txt| util::parse_numeric::(txt).ok()) - }), - None => Some(map_res.c.len() as u64), + .split(|p| p == DOT_SEPARATOR) + .collect::>(); + parts + .get(if parts.len() > 2 { 1 } else { 0 }) + .and_then(|txt| util::parse_numeric::(&txt[0]).ok()) + }) + } else { + Some(map_res.c.len() as u64) }; let related_ctoken = music_contents diff --git a/src/client/response/music_playlist.rs b/src/client/response/music_playlist.rs index ac58065..8de1c91 100644 --- a/src/client/response/music_playlist.rs +++ b/src/client/response/music_playlist.rs @@ -58,6 +58,8 @@ pub(crate) struct HeaderRenderer { /// Missing on artist_tracks view. /// /// `"64 songs", " • ", "3 hours, 40 minutes"` + /// + /// `"1B views", " • ", "200 songs", " • ", "6+ hours"` #[serde(default)] #[serde_as(as = "Text")] pub second_subtitle: Vec,