diff --git a/twitter.py b/twitter.py index 5901450..66a7042 100644 --- a/twitter.py +++ b/twitter.py @@ -193,6 +193,7 @@ def parse_tweet(tweet): "full_text": tweet["legacy"]["full_text"], "created_at": tweet["legacy"]["created_at"], "timestamp": int(datetime.strptime(tweet["legacy"]["created_at"], '%a %b %d %H:%M:%S %z %Y').timestamp()), + "reply_to": "", "media": [], "entities": [], "quoted": {}, @@ -201,6 +202,9 @@ def parse_tweet(tweet): } data["profile_image"] = data["profile_image"].replace("_normal.", ".") + if "in_reply_to_status_id_str" in tweet["legacy"]: + data["reply_to"] = tweet["legacy"]["in_reply_to_status_id_str"] + for m in tweet["legacy"]["entities"].get("media", []): data["media"].append(parse_media(m)) @@ -271,7 +275,7 @@ def main(config): check_interval = config.get("check_interval", 42) check_interval_slow = config.get("check_interval_slow", 600) slow_hours = config.get("slow_hours", [0, 1, 2, 3, 4, 5, 6]) - last_check_time = defaultdict(lambda: 0.0) + last_check_time = defaultdict(float) while 1: json_data = {}