From 93f8e493db1ed9e5c095c5639342fe1fc220d6a5 Mon Sep 17 00:00:00 2001 From: jeancf Date: Wed, 28 Jun 2023 17:46:00 +0200 Subject: [PATCH] Fixed float timestamp bug --- twoot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/twoot.py b/twoot.py index f2fafb3..7f1d186 100755 --- a/twoot.py +++ b/twoot.py @@ -887,10 +887,10 @@ def main(argv): # Extract time stamp time_string = status.find('span', class_='tweet-date').a.get('title') try: - timestamp = datetime.strptime(time_string, '%d/%m/%Y, %H:%M:%S').timestamp() + timestamp = datetime.strptime(time_string, '%d/%m/%Y, %H:%M:%S') except: # Dec 21, 2021 · 12:00 PM UTC - timestamp = datetime.strptime(time_string, '%b %d, %Y · %I:%M %p %Z').timestamp() + timestamp = datetime.strptime(time_string, '%b %d, %Y · %I:%M %p %Z') # Check if time is within acceptable range if not is_time_valid(timestamp): @@ -1024,7 +1024,7 @@ def main(argv): tweet = { "author": author, "author_account": author_account, - "timestamp": timestamp, + "timestamp": timestamp.timestamp(), "tweet_id": tweet_id, "tweet_text": tweet_text, "video": video_file,