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:
@@ -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),
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user