From e027e399e5362153d4876128e610d2337431bacd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Tue, 2 Jul 2024 20:11:20 +0200 Subject: [PATCH] fix(backend): proper types for yt-dlp metadata --- cli/src/extractors/external/ytdlp.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cli/src/extractors/external/ytdlp.rs b/cli/src/extractors/external/ytdlp.rs index 0b0afd1..d930a13 100644 --- a/cli/src/extractors/external/ytdlp.rs +++ b/cli/src/extractors/external/ytdlp.rs @@ -137,7 +137,13 @@ impl Extractor for YtDlpExtractor { Entry { entity: address.clone(), attribute: attribute.clone(), - value: EntryValue::guess_from(value.to_string()), + value: match value { + serde_json::Value::String(s) => s.clone().into(), + serde_json::Value::Number(n) => n + .as_f64() + .map_or_else(|| n.to_string().into(), |f| f.into()), + _ => value.to_string().into(), + }, provenance: context.provenance.clone() + "EXTRACTOR yt-dlp", user: context.user.clone(), timestamp: chrono::Utc::now().naive_utc(),