utils: fix iso8601 parsing
youtube: change datetime format in output
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user