Handle ValueError in get_date. Fixes #11

This commit is contained in:
Tulir Asokan 2020-02-09 21:59:42 +02:00
parent 4e3b9ef416
commit 4532e1bb4f

View File

@ -135,11 +135,11 @@ class RSSBot(Plugin):
def get_date(entry: Any) -> datetime: def get_date(entry: Any) -> datetime:
try: try:
return datetime.fromtimestamp(mktime(entry["published_parsed"])) return datetime.fromtimestamp(mktime(entry["published_parsed"]))
except (KeyError, TypeError): except (KeyError, TypeError, ValueError):
pass pass
try: try:
return datetime.fromtimestamp(mktime(entry["date_parsed"])) return datetime.fromtimestamp(mktime(entry["date_parsed"]))
except (KeyError, TypeError): except (KeyError, TypeError, ValueError):
pass pass
return datetime.now() return datetime.now()