fix: handle engagement: null in watchlist and YouTube normalizer

When X posts return engagement: null, dict.get("engagement", {})
returns None (key exists with null value), causing AttributeError.
Use `or {}` idiom to coalesce None to empty dict.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matt Van Horn
2026-02-15 07:29:27 -08:00
parent 87bb469ab7
commit 7d6bac7b0e
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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"),