From b82a8700b2dd63c242f71ebafbda0bbfd92ca249 Mon Sep 17 00:00:00 2001 From: vltclz Date: Sat, 24 Feb 2024 01:36:47 +0100 Subject: [PATCH] fix unsupported operand type(s) for //: 'str' and 'int' --- instagrapi/extractors.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/instagrapi/extractors.py b/instagrapi/extractors.py index ab2b5cf8..223ae118 100644 --- a/instagrapi/extractors.py +++ b/instagrapi/extractors.py @@ -278,7 +278,9 @@ def extract_direct_thread(data): if "inviter" in data: data["inviter"] = extract_user_short(data["inviter"]) data["left_users"] = data.get("left_users", []) - data["last_activity_at"] = datetime.datetime.fromtimestamp(data["last_activity_at"] // 1_000_000) + data["last_activity_at"] = datetime.datetime.fromtimestamp( + data["last_activity_at"] // 1_000_000 + ) return DirectThread(**data) @@ -334,8 +336,10 @@ def extract_direct_message(data): if xma_media_share: data["xma_share"] = extract_media_v1_xma(xma_media_share[0]) - data['timestamp'] = datetime.datetime.fromtimestamp(data['timestamp'] // 1_000_000) - data['user_id'] = str(data['user_id']) + data["timestamp"] = datetime.datetime.fromtimestamp( + int(data["timestamp"]) // 1_000_000 + ) + data["user_id"] = str(data.get("user_id", "")) return DirectMessage(**data)