utils: fix iso8601 parsing
youtube: change datetime format in output
This commit is contained in:
parent
98646f3226
commit
92d98a1e6c
@ -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:
|
||||
|
@ -48,7 +48,7 @@ class YouTube(Plugin):
|
||||
dislikes=dislikes,
|
||||
score=score,
|
||||
views=views,
|
||||
date=date.strftime('%Y.%m.%d'))
|
||||
date=date.strftime('%d.%m.%Y %H:%M:%S UTC'))
|
||||
|
||||
@irc3.event(r'(?i)^:\S+ PRIVMSG (?P<target>\S+) :.*(?:youtube.*?(?:v=|/v/)'
|
||||
r'|youtu\.be/)(?P<video_id>[-_a-zA-Z0-9]+).*')
|
||||
|
Loading…
Reference in New Issue
Block a user