runtime error handling

This commit is contained in:
Simon
2026-03-29 16:24:49 +00:00
parent 99fe4c947c
commit 243d19cec0
4 changed files with 653 additions and 6 deletions

View File

@@ -1218,7 +1218,14 @@ mod tests {
let item = provider.apply_detail_video(item, html).expect("detail");
assert_eq!(item.title, "Real Title");
assert_eq!(item.url, "https://cdn.example/master.m3u8");
assert_eq!(item.formats.as_ref().and_then(|values| values.first()).map(|value| value.format.clone()).as_deref(), Some("m3u8"));
let first_format = item
.formats
.as_ref()
.and_then(|values| values.first())
.expect("expected a parsed format");
let first_format_json =
serde_json::to_value(first_format).expect("format should serialize");
assert_eq!(first_format_json.get("format").and_then(|value| value.as_str()), Some("m3u8"));
assert_eq!(item.duration, 1740);
assert_eq!(item.views, Some(1400));
assert_eq!(item.uploader.as_deref(), Some("Kayley Gunner"));