diff --git a/codegen/src/abtest.rs b/codegen/src/abtest.rs index 9acf827..cc9491a 100644 --- a/codegen/src/abtest.rs +++ b/codegen/src/abtest.rs @@ -24,6 +24,7 @@ pub enum ABTest { TrendsPageHeaderRenderer = 5, DiscographyPage = 6, ShortDateFormat = 7, + PlaylistsForShorts = 9, } const TESTS_TO_RUN: [ABTest; 3] = [ @@ -94,6 +95,7 @@ pub async fn run_test( ABTest::TrendsPageHeaderRenderer => trends_page_header_renderer(&query).await, ABTest::DiscographyPage => discography_page(&query).await, ABTest::ShortDateFormat => short_date_format(&query).await, + ABTest::PlaylistsForShorts => playlists_for_shorts(&query).await, } .unwrap(); pb.inc(1); @@ -243,3 +245,13 @@ pub async fn short_date_format(rp: &RustyPipeQuery) -> Result { .unwrap_or_default() })) } + +pub async fn playlists_for_shorts(rp: &RustyPipeQuery) -> Result { + let playlist = rp.playlist("UUSHh8gHdtzO2tXd593_bjErWg").await?; + let v1 = playlist + .videos + .items + .first() + .ok_or_else(|| anyhow::anyhow!("no videos"))?; + Ok(v1.publish_date_txt.is_none()) +} diff --git a/notes/AB_Tests.md b/notes/AB_Tests.md index b9ffbf0..f4294cd 100644 --- a/notes/AB_Tests.md +++ b/notes/AB_Tests.md @@ -360,8 +360,8 @@ YouTube changed the header renderer type on the trending page to a `pageHeaderRe - **Impact:** 🟡 Medium - **Endpoint:** browse (music artist) -YouTube merged the 2 sections for singles and albums on artist pages together. Now -there is only a *Top Releases* section. +YouTube merged the 2 sections for singles and albums on artist pages together. Now there +is only a _Top Releases_ section. YouTube also changed the way the full discography page is fetched, surprisingly making it easier for alternative clients. The discography page now has its own content ID in @@ -382,5 +382,26 @@ visitor data cookie to be set, as it was the case with the old system. - **Encountered on:** 28.05.2023 - **Impact:** 🟡 Medium -YouTube changed their date format from the long format (*21 hours ago*, *3 days ago*) to -a short format (*21h ago*, *3d ago*). +YouTube changed their date format from the long format (_21 hours ago_, _3 days ago_) to +a short format (_21h ago_, _3d ago_). + +## [9] Playlists for Shorts + +- **Encountered on:** 26.06.2023 +- **Impact:** 🟡 Medium +- **Endpoint:** browse (playlist) + +![A/B test 9 screenshot](./_img/ab_9.png) + +Original issue: https://github.com/TeamNewPipe/NewPipeExtractor/issues/10774 + +YouTube added a filter system for playlists, allowing users to only see shorts/full +videos. + +When shorts filter is enabled or when there are only shorts in a playlist, YouTube +return shorts UI elements instead of standard video ones, the ones that are also used +for shorts shelves in searches and suggestions and shorts in the corresponding channel +tab. + +Since the reel items dont include upload date information you can circumvent this new UI +by using the mobile client. But that may change in the future. diff --git a/notes/_img/ab_9.png b/notes/_img/ab_9.png new file mode 100644 index 0000000..adca439 Binary files /dev/null and b/notes/_img/ab_9.png differ diff --git a/src/client/response/playlist.rs b/src/client/response/playlist.rs index e0fe342..fbc76b4 100644 --- a/src/client/response/playlist.rs +++ b/src/client/response/playlist.rs @@ -29,6 +29,7 @@ pub(crate) struct ItemSection { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] pub(crate) struct PlaylistVideoListRenderer { + #[serde(alias = "richGridRenderer")] pub playlist_video_list_renderer: YouTubeListRenderer, } diff --git a/tests/youtube.rs b/tests/youtube.rs index c1a86dd..5835b1d 100644 --- a/tests/youtube.rs +++ b/tests/youtube.rs @@ -2241,14 +2241,10 @@ fn music_genre(#[case] id: &str, #[case] name: &str, rp: RustyPipe, unlocalized: assert!(!playlist.thumbnail.is_empty(), "got no cover"); if !playlist.from_ytm { - assert!( - playlist.channel.is_some(), - "pl: {}, got no channel", - playlist.id - ); - let channel = playlist.channel.as_ref().unwrap(); - validate::channel_id(&channel.id).unwrap(); - assert!(!channel.name.is_empty()); + if let Some(channel) = playlist.channel.as_ref() { + validate::channel_id(&channel.id).unwrap(); + assert!(!channel.name.is_empty()); + } } else { assert!(playlist.channel.is_none()); }