Fixed float timestamp bug

This commit is contained in:
jeancf 2023-06-28 17:46:00 +02:00
parent 156df6040c
commit 93f8e493db

View File

@ -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,