From fc2aa3ecb8d4bf687a256577869da467cfc04102 Mon Sep 17 00:00:00 2001 From: Yuzhang Hu Date: Sun, 14 Apr 2024 10:16:52 -0700 Subject: [PATCH] [MISC] Robust post extraction (#72) * reddit: robust post extraction * helm: upgrade tag --- helm/values.yaml | 2 +- src/reddit_agent.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/helm/values.yaml b/helm/values.yaml index 82ff251..ce668bf 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -5,7 +5,7 @@ airflow: images: airflow: repository: finaldie/auto-news - tag: 0.9.7 + tag: 0.9.8 useDefaultImageForMigration: true diff --git a/src/reddit_agent.py b/src/reddit_agent.py index 400608d..8a6a77e 100644 --- a/src/reddit_agent.py +++ b/src/reddit_agent.py @@ -94,7 +94,7 @@ def _extractSubredditPosts(self, response, data_folder, run_id): ts = post["data"]["created_utc"] dt_utc = datetime.fromtimestamp(ts).isoformat() dt_pdt = utils.convertUTC2PDT_str(dt_utc).isoformat() - author = post["data"]["author"] + author = post["data"].get("author") or post["data"].get("author_fullname") or "unknown_author" subreddit = post["data"]["subreddit"] title = post["data"]["title"] post_long_id = f"{subreddit}_{title}_{author}_{ts}"