fix: rewritten album mv replacement

This commit is contained in:
ThetaDev 2023-02-09 00:30:22 +01:00
parent 3574a44b77
commit d0a8b6fabe
8 changed files with 841 additions and 45 deletions

View file

@ -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> {

View file

@ -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
///

View file

@ -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<Vec<MusicGenreItem>, Error> {
@ -44,7 +34,7 @@ impl RustyPipeQuery {
pub async fn music_genre<S: AsRef<str>>(&self, genre_id: S) -> Result<MusicGenre, Error> {
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,

View file

@ -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::<Vec<_>>();
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),
}
}
}

View file

@ -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<S: AsRef<str>>(
&self,
playlist_id: S,
) -> Result<Playlist, Error> {
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::<response::Playlist, _, _>(
ClientType::Desktop,
"playlist",
playlist_id,
"browse",
&request_body,
)
.await
}
/// Get more playlist items using the given continuation token
pub async fn playlist_continuation<S: AsRef<str>>(
&self,

View file

@ -43,7 +43,7 @@ MusicAlbum(
TrackItem(
id: "Jz-26iiDuYs",
name: "Waldbrand",
duration: Some(208),
duration: Some(209),
cover: [],
artists: [
ArtistId(

View file

@ -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: "JSomething",
),
],
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,
),
],
)

View file

@ -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();