utils: fix iso8601 parsing

youtube: change datetime format in output
This commit is contained in:
2020-05-18 20:48:20 +00:00
parent 98646f3226
commit 92d98a1e6c
2 changed files with 5 additions and 2 deletions

View File

@@ -9,7 +9,10 @@ def re_generator(low: int = 5, high: int = 20) -> str:
def date_from_iso(date: str) -> datetime:
return datetime.strptime(date, '%Y-%m-%dT%H:%M:%S.%fZ')
try:
return datetime.strptime(date, '%Y-%m-%dT%H:%M:%S.%f%z')
except ValueError:
return datetime.strptime(date, '%Y-%m-%dT%H:%M:%S%z')
def is_int(val: str) -> bool: