diff --git a/src/client/player.rs b/src/client/player.rs index f5bd905..9f74ef9 100644 --- a/src/client/player.rs +++ b/src/client/player.rs @@ -40,8 +40,6 @@ struct QPlayer<'a> { content_check_ok: bool, /// Probably refers to allowing sensitive content, too racy_check_ok: bool, - #[serde(skip_serializing_if = "Option::is_none")] - params: Option<&'a str>, } #[derive(Debug, Serialize)] @@ -115,7 +113,6 @@ impl RustyPipeQuery { video_id, content_check_ok: true, racy_check_ok: true, - params: None, } } else { QPlayer { @@ -125,8 +122,6 @@ impl RustyPipeQuery { video_id, content_check_ok: true, racy_check_ok: true, - // Source: https://github.com/TeamNewPipe/NewPipeExtractor/pull/1084 - params: Some("CgIQBg").filter(|_| client_type == ClientType::Android), } }; diff --git a/src/error.rs b/src/error.rs index 0b29cc0..471568c 100644 --- a/src/error.rs +++ b/src/error.rs @@ -6,6 +6,7 @@ use reqwest::StatusCode; /// Error type for the RustyPipe library #[derive(thiserror::Error, Debug)] +#[non_exhaustive] pub enum Error { /// Error extracting content from YouTube #[error("extraction error: {0}")] @@ -23,6 +24,7 @@ pub enum Error { /// Error extracting content from YouTube #[derive(thiserror::Error, Debug)] +#[non_exhaustive] pub enum ExtractionError { /// Video cannot be extracted with RustyPipe /// diff --git a/src/serializer/text.rs b/src/serializer/text.rs index f8d070d..e1c6ae9 100644 --- a/src/serializer/text.rs +++ b/src/serializer/text.rs @@ -201,6 +201,13 @@ impl<'de> Deserialize<'de> for TextComponent { D: Deserializer<'de>, { let mut text = RichTextInternal::deserialize(deserializer)?; + if text.runs.len() != 1 { + return Err(serde::de::Error::invalid_length( + text.runs.len(), + &"1 run, use TextComponents for more", + )); + } + Ok(text.runs.swap_remove(0).into()) } } diff --git a/tests/snapshots/youtube__music_artist_only_singles.snap b/tests/snapshots/youtube__music_artist_only_singles.snap index 9e673ba..9258bcb 100644 --- a/tests/snapshots/youtube__music_artist_only_singles.snap +++ b/tests/snapshots/youtube__music_artist_only_singles.snap @@ -6,7 +6,7 @@ MusicArtist( id: "UCfwCE5VhPMGxNPFxtVv7lRw", name: "Sulli", header_image: "[header_image]", - description: Some("Choi Jin-ri, better known by her stage name Sulli, was a South Korean singer and actress. She first made her debut as a child actress, appearing as a supporting cast member on the SBS historical drama Ballad of Seodong. Following this, she earned a number of guest roles, appearing in the television series Love Needs a Miracle and Drama City, and the film Vacation. She then subsequently appeared in the independent films Punch Lady and BA:BO, the former being her first time cast in a substantial dramatic role.\nAfter signing a record deal with SM Entertainment, Sulli rose to prominence as a member of the girl group f(x) formed in 2009. The group achieved both critical and commercial success, with four Korean number-one singles and international recognition after becoming the first K-pop act to perform at SXSW. Concurrently with her music career, Sulli returned to acting by starring in the SBS romantic comedy series, To the Beautiful You, a Korean adaptation of the shōjo manga Hana-Kimi where her performance was positively received and earned her two SBS Drama Awards and a nomination at the 49th Paeksang Arts Awards.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Sulli) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)"), + description: Some("Choi Jin-ri, better known by her stage name Sulli, was a South Korean actress and singer. She first made her debut as a child actress, appearing as a supporting cast member on the SBS historical drama Ballad of Seodong. Following this, she earned a number of guest roles, appearing in the television series Love Needs a Miracle and Drama City, and the film Vacation. She then subsequently appeared in the independent films Punch Lady and BA:BO, the former being her first time cast in a substantial dramatic role.\nAfter signing a record deal with SM Entertainment, Sulli rose to prominence as a member of the girl group f(x) formed in 2009. The group achieved both critical and commercial success, with four Korean number-one singles and international recognition after becoming the first K-pop act to perform at SXSW. Concurrently with her music career, Sulli returned to acting by starring in the SBS romantic comedy series, To the Beautiful You, a Korean adaptation of the shōjo manga Hana-Kimi where her performance was positively received and earned her two SBS Drama Awards and a nomination at the 49th Paeksang Arts Awards.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Sulli) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)"), wikipedia_url: Some("https://en.wikipedia.org/wiki/Sulli"), subscriber_count: "[subscriber_count]", tracks: "[tracks]", diff --git a/tests/youtube.rs b/tests/youtube.rs index e3c9027..f3c5c96 100644 --- a/tests/youtube.rs +++ b/tests/youtube.rs @@ -28,7 +28,8 @@ use rustypipe::param::{ #[rstest] #[case::desktop(ClientType::Desktop)] #[case::tv_html5_embed(ClientType::TvHtml5Embed)] -#[case::android(ClientType::Android)] +// The Android client became flaky +// #[case::android(ClientType::Android)] #[case::ios(ClientType::Ios)] #[test_log::test] fn get_player_from_client(#[case] client_type: ClientType, rp: RustyPipe) {