feeds: better handle "empty" datetime

master
pictuga 2020-03-20 12:30:42 +01:00
parent d24734110a
commit 6a01fc439e
1 changed files with 5 additions and 2 deletions

View File

@ -469,7 +469,10 @@ class ParserHTML(ParserXML):
def parse_time(value): def parse_time(value):
if isinstance(value, basestring): if value is None or value == 0:
return None
elif isinstance(value, basestring):
if re.match(r'^[0-9]+$', value): if re.match(r'^[0-9]+$', value):
return datetime.fromtimestamp(int(value), tz.UTC) return datetime.fromtimestamp(int(value), tz.UTC)
@ -483,7 +486,7 @@ def parse_time(value):
return value return value
else: else:
return False return None
class ParserJSON(ParserBase): class ParserJSON(ParserBase):