mirror of
https://gitlab.com/jeancf/twoot.git
synced 2025-02-17 13:58:11 +00:00
Fixed float timestamp bug
This commit is contained in:
parent
156df6040c
commit
93f8e493db
6
twoot.py
6
twoot.py
|
@ -887,10 +887,10 @@ 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:
|
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:
|
except:
|
||||||
# Dec 21, 2021 · 12:00 PM UTC
|
# 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
|
# Check if time is within acceptable range
|
||||||
if not is_time_valid(timestamp):
|
if not is_time_valid(timestamp):
|
||||||
|
@ -1024,7 +1024,7 @@ def main(argv):
|
||||||
tweet = {
|
tweet = {
|
||||||
"author": author,
|
"author": author,
|
||||||
"author_account": author_account,
|
"author_account": author_account,
|
||||||
"timestamp": timestamp,
|
"timestamp": timestamp.timestamp(),
|
||||||
"tweet_id": tweet_id,
|
"tweet_id": tweet_id,
|
||||||
"tweet_text": tweet_text,
|
"tweet_text": tweet_text,
|
||||||
"video": video_file,
|
"video": video_file,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user