Fliexibility in timestamp

This commit is contained in:
jeancf 2022-01-03 18:11:40 +01:00
parent 65d91bf025
commit 00f374896d

View File

@ -373,7 +373,11 @@ def main(argv):
# Extract time stamp
time_string = status.find('span', class_='tweet-date').a.get('title')
try:
timestamp = datetime.datetime.strptime(time_string, '%d/%m/%Y, %H:%M:%S').timestamp()
except:
# Dec 21, 2021 · 12:00 PM UTC
timestamp = datetime.datetime.strptime(time_string, '%b %d, %Y · %I:%M %p %Z').timestamp()
# Check if time is within acceptable range
if not is_time_valid(timestamp, max_age, min_delay):