Skip to content

AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary

fix: handle engagement: null in watchlist and YouTube normalizer

Matt Van Horn7d6bac7b0e88
diff --git a/scripts/lib/normalize.py b/scripts/lib/normalize.py
index 941a9bf3..3fd61a9c 100644
--- a/scripts/lib/normalize.py
+++ b/scripts/lib/normalize.py
@@ -174,7 +174,7 @@ def normalize_youtube_items(
for item in items:
# Parse engagement
- eng_raw = item.get("engagement", {})
+ eng_raw = item.get("engagement") or {}
engagement = schema.Engagement(
views=eng_raw.get("views"),
likes=eng_raw.get("likes"),
diff --git a/scripts/watchlist.py b/scripts/watchlist.py
index a058d258..4ec424fb 100644
--- a/scripts/watchlist.py
+++ b/scripts/watchlist.py
@@ -185,7 +185,7 @@ def _run_topic(topic: dict) -> dict:
"title": item.get("text", "")[:100],
"author": item.get("author_handle", ""),
"content": item.get("text", ""),
- "engagement_score": item.get("engagement", {}).get("likes", 0),
+ "engagement_score": (item.get("engagement") or {}).get("likes", 0),
"relevance_score": item.get("relevance", 0),
})