fix: handle itemSectionRenderer in recommended videos

This commit is contained in:
ThetaDev 2022-10-11 22:21:32 +02:00
parent c65af48a4b
commit eb9d3680cc
9 changed files with 18121 additions and 69 deletions

View file

@ -168,13 +168,11 @@ async fn get_playlist(
assert!(playlist.video_count > 10);
assert_eq!(playlist.video_count > 100, is_long);
assert_eq!(playlist.description, description);
match playlist.channel {
Some(c) => {
let expect = channel.unwrap();
assert_eq!(c.id, expect.0);
assert_eq!(c.name, expect.1);
}
None => assert!(channel.is_none()),
if let Some(expect) = channel {
let c = playlist.channel.unwrap();
assert_eq!(c.id, expect.0);
assert_eq!(c.name, expect.1);
}
assert!(!playlist.thumbnail.is_empty());
}
@ -439,7 +437,9 @@ async fn get_video_details_chapters() {
assert!(!details.is_live);
assert!(!details.is_ccommons);
insta::assert_ron_snapshot!(details.chapters, {
// In rare cases, YouTube does not return chapters here
if !details.chapters.is_empty() {
insta::assert_ron_snapshot!(details.chapters, {
"[].thumbnail" => insta::dynamic_redaction(move |value, _path| {
assert!(!value.as_slice().unwrap().is_empty());
"[ok]"
@ -518,6 +518,7 @@ async fn get_video_details_chapters() {
),
]
"###);
}
assert!(!details.recommended.is_exhausted());