fix: unavailable album items

This commit is contained in:
ThetaDev 2022-12-05 23:56:39 +01:00
parent b02cc15b28
commit 9e4787f501
7 changed files with 7607 additions and 6 deletions

View file

@ -0,0 +1,258 @@
---
source: tests/youtube.rs
expression: album
---
MusicAlbum(
id: "MPREb_AzuWg8qAVVl",
playlist_id: Some("OLAK5uy_mux5ygfN9sbiR1ma3yh1GHTmqNekZNoAI"),
name: "13 Reasons Why (Season 3)",
cover: "[cover]",
artists: [],
description: None,
album_type: Album,
year: Some(2019),
by_va: true,
tracks: [
TrackItem(
id: "R3VIKRtzAdE",
title: "Teeth",
duration: Some(205),
cover: [],
artists: [
ArtistId(
id: Some("UCCj0RlDqqahEB5BXVtDcPqg"),
name: "5 Seconds of Summer",
),
],
artist_id: Some("UCCj0RlDqqahEB5BXVtDcPqg"),
album: Some(AlbumId(
id: "MPREb_AzuWg8qAVVl",
name: "13 Reasons Why (Season 3)",
)),
view_count: None,
is_video: false,
track_nr: Some(1),
),
TrackItem(
id: "t0v0UOgOt18",
title: "Die A Little",
duration: Some(174),
cover: [],
artists: [
ArtistId(
id: Some("UCMrCoizKiBxqeg5pTpBXn1A"),
name: "YUNGBLUD",
),
],
artist_id: Some("UCMrCoizKiBxqeg5pTpBXn1A"),
album: Some(AlbumId(
id: "MPREb_AzuWg8qAVVl",
name: "13 Reasons Why (Season 3)",
)),
view_count: None,
is_video: false,
track_nr: Some(2),
),
TrackItem(
id: "HjJYAkUXrxI",
title: "fuck, i\'m lonely (feat. Anne-Marie)",
duration: Some(199),
cover: [],
artists: [
ArtistId(
id: Some("UCWjoDY2SXJ5dvcdunWI6mjQ"),
name: "Lauv",
),
],
artist_id: Some("UCWjoDY2SXJ5dvcdunWI6mjQ"),
album: Some(AlbumId(
id: "MPREb_AzuWg8qAVVl",
name: "13 Reasons Why (Season 3)",
)),
view_count: None,
is_video: false,
track_nr: Some(3),
),
TrackItem(
id: "Hg0KUOTL06I",
title: "Swim Home",
duration: Some(187),
cover: [],
artists: [
ArtistId(
id: Some("UChzK2t3sjnQkWzGnyKXOSSg"),
name: "Cautious Clay",
),
],
artist_id: Some("UChzK2t3sjnQkWzGnyKXOSSg"),
album: Some(AlbumId(
id: "MPREb_AzuWg8qAVVl",
name: "13 Reasons Why (Season 3)",
)),
view_count: None,
is_video: false,
track_nr: Some(5),
),
TrackItem(
id: "c8AfY6yhdkM",
title: "Another Summer Night Without You",
duration: Some(159),
cover: [],
artists: [
ArtistId(
id: Some("UCvsgN5NKOzXnAURfaf3TOig"),
name: "Alexander 23",
),
],
artist_id: Some("UCvsgN5NKOzXnAURfaf3TOig"),
album: Some(AlbumId(
id: "MPREb_AzuWg8qAVVl",
name: "13 Reasons Why (Season 3)",
)),
view_count: None,
is_video: false,
track_nr: Some(6),
),
TrackItem(
id: "_ZmdHjVvwhc",
title: "Miss U",
duration: Some(186),
cover: [],
artists: [
ArtistId(
id: Some("UCI4YNnmHjXFaaKvfdmpWvJQ"),
name: "Charli XCX",
),
],
artist_id: Some("UCI4YNnmHjXFaaKvfdmpWvJQ"),
album: Some(AlbumId(
id: "MPREb_AzuWg8qAVVl",
name: "13 Reasons Why (Season 3)",
)),
view_count: None,
is_video: false,
track_nr: Some(7),
),
TrackItem(
id: "wBe1Zi3q1n8",
title: "Favorite Drug",
duration: Some(209),
cover: [],
artists: [
ArtistId(
id: Some("UCDaFVUr2n8T7_X1f5yJ1xlw"),
name: "daydream Masi",
),
],
artist_id: Some("UCDaFVUr2n8T7_X1f5yJ1xlw"),
album: Some(AlbumId(
id: "MPREb_AzuWg8qAVVl",
name: "13 Reasons Why (Season 3)",
)),
view_count: None,
is_video: false,
track_nr: Some(8),
),
TrackItem(
id: "l8Pj8s9uPGc",
title: "Keeping It In The Dark",
duration: Some(209),
cover: [],
artists: [
ArtistId(
id: Some("UCZcc-WkffIMBVGUr6j9e6aQ"),
name: "Daya",
),
],
artist_id: Some("UCZcc-WkffIMBVGUr6j9e6aQ"),
album: Some(AlbumId(
id: "MPREb_AzuWg8qAVVl",
name: "13 Reasons Why (Season 3)",
)),
view_count: None,
is_video: false,
track_nr: Some(9),
),
TrackItem(
id: "Kn3cruxYj0c",
title: "All That (feat. Jeremih)",
duration: Some(174),
cover: [],
artists: [
ArtistId(
id: Some("UCQPPz_A65SWYi2wXX8z76AQ"),
name: "Drama Relax",
),
],
artist_id: Some("UCQPPz_A65SWYi2wXX8z76AQ"),
album: Some(AlbumId(
id: "MPREb_AzuWg8qAVVl",
name: "13 Reasons Why (Season 3)",
)),
view_count: None,
is_video: false,
track_nr: Some(11),
),
TrackItem(
id: "Sy1lIOl1YN0",
title: "This Baby Dont Cry",
duration: Some(185),
cover: [],
artists: [
ArtistId(
id: Some("UChTOXkDhGJ0JftnfMWjpCCg"),
name: "K.Flay",
),
],
artist_id: Some("UChTOXkDhGJ0JftnfMWjpCCg"),
album: Some(AlbumId(
id: "MPREb_AzuWg8qAVVl",
name: "13 Reasons Why (Season 3)",
)),
view_count: None,
is_video: false,
track_nr: Some(12),
),
TrackItem(
id: "njdlNT1RRo4",
title: "Walk Forever By My Side",
duration: Some(237),
cover: [],
artists: [
ArtistId(
id: Some("UCMUB52aO4CqrUXmLwbfRWYA"),
name: "Twin Shadow",
),
],
artist_id: Some("UCMUB52aO4CqrUXmLwbfRWYA"),
album: Some(AlbumId(
id: "MPREb_AzuWg8qAVVl",
name: "13 Reasons Why (Season 3)",
)),
view_count: None,
is_video: false,
track_nr: Some(13),
),
TrackItem(
id: "Si-CXM8CHqQ",
title: "Ordinary World (feat. White Sea)",
duration: Some(246),
cover: [],
artists: [
ArtistId(
id: Some("UC4YvDAbE1EYwZpj6gQ-lpLw"),
name: "Eskmo",
),
],
artist_id: Some("UC4YvDAbE1EYwZpj6gQ-lpLw"),
album: Some(AlbumId(
id: "MPREb_AzuWg8qAVVl",
name: "13 Reasons Why (Season 3)",
)),
view_count: None,
is_video: false,
track_nr: Some(18),
),
],
variants: [],
)

View file

@ -4,18 +4,20 @@ use std::fmt::Display;
use fancy_regex::Regex;
use once_cell::sync::Lazy;
use rstest::rstest;
use rustypipe::param::Country;
use time::macros::date;
use time::OffsetDateTime;
use rustypipe::client::{ClientType, RustyPipe, RustyPipeQuery};
use rustypipe::error::{Error, ExtractionError};
use rustypipe::model::richtext::ToPlaintext;
use rustypipe::model::{
AlbumType, AudioCodec, AudioFormat, Channel, FromYtItem, MusicEntityType, MusicGenre,
Paginator, UrlTarget, Verification, VideoCodec, VideoFormat, YouTubeItem, YtStream,
richtext::ToPlaintext, AlbumType, AudioCodec, AudioFormat, Channel, FromYtItem,
MusicEntityType, MusicGenre, Paginator, UrlTarget, Verification, VideoCodec, VideoFormat,
YouTubeItem, YtStream,
};
use rustypipe::param::{
search_filter::{self, SearchFilter},
Country,
};
use rustypipe::param::search_filter::{self, SearchFilter};
//#PLAYER
@ -1364,6 +1366,7 @@ async fn music_playlist_not_found() {
#[case::ep("ep", "MPREb_u1I69lSAe5v")]
#[case::audiobook("audiobook", "MPREb_gaoNzsQHedo")]
#[case::show("show", "MPREb_cwzk8EUwypZ")]
#[case::unavailable("unavailable", "MPREb_AzuWg8qAVVl")]
#[tokio::test]
async fn music_album(#[case] name: &str, #[case] id: &str) {
let rp = RustyPipe::builder().strict().build();