mirror of
https://gitlab.com/jeancf/twoot.git
synced 2025-02-17 13:58:11 +00:00
Fliexibility in timestamp
This commit is contained in:
parent
65d91bf025
commit
00f374896d
4
twoot.py
4
twoot.py
|
@ -373,7 +373,11 @@ def main(argv):
|
||||||
|
|
||||||
# Extract time stamp
|
# Extract time stamp
|
||||||
time_string = status.find('span', class_='tweet-date').a.get('title')
|
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()
|
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
|
# Check if time is within acceptable range
|
||||||
if not is_time_valid(timestamp, max_age, min_delay):
|
if not is_time_valid(timestamp, max_age, min_delay):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user