diff options
Diffstat (limited to '')
-rw-r--r-- | crates/yt/src/update/mod.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/crates/yt/src/update/mod.rs b/crates/yt/src/update/mod.rs index a25c233..36c8c81 100644 --- a/crates/yt/src/update/mod.rs +++ b/crates/yt/src/update/mod.rs @@ -147,13 +147,15 @@ pub fn video_entry_to_video(entry: &InfoJson, sub: Option<&Subscription>) -> Res let subscription_name = if let Some(sub) = sub { Some(sub.name.clone()) - } else if let Some(uploader) = entry.get("uploader") { - if entry.get("webpage_url_domain") - == Some(&serde_json::Value::String("youtube.com".to_owned())) + } else if let Some(uploader) = entry.get("uploader").map(|val| json_cast!(val, as_str)) { + if entry + .get("webpage_url_domain") + .map(|val| json_cast!(val, as_str)) + == Some("youtube.com") { Some(format!("{uploader} - Videos")) } else { - Some(json_cast!(uploader, as_str).to_owned()) + Some(uploader.to_owned()) } } else { None |