fix: add support for shorts playlists (A/B test 9)
This commit is contained in:
parent
1bab2ef301
commit
031b730c47
5 changed files with 42 additions and 12 deletions
|
|
@ -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<bool> {
|
|||
.unwrap_or_default()
|
||||
}))
|
||||
}
|
||||
|
||||
pub async fn playlists_for_shorts(rp: &RustyPipeQuery) -> Result<bool> {
|
||||
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())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||

|
||||
|
||||
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.
|
||||
|
|
|
|||
BIN
notes/_img/ab_9.png
Normal file
BIN
notes/_img/ab_9.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 550 KiB |
|
|
@ -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,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue