From e68413912ba74e8d5f38fab45df20374a3214800 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Mon, 30 Mar 2020 22:01:51 +0200 Subject: catch ParseError form dateutil --- newspipe/lib/article_utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/newspipe/lib/article_utils.py b/newspipe/lib/article_utils.py index 0490d4d7..7e1b2a36 100644 --- a/newspipe/lib/article_utils.py +++ b/newspipe/lib/article_utils.py @@ -2,6 +2,7 @@ import html import logging import re from datetime import datetime, timezone +from dateutil.parser._parser import ParserError from enum import Enum from urllib.parse import SplitResult, urlsplit, urlunsplit @@ -47,6 +48,8 @@ async def construct_article(entry, feed, fields=None, fetch=True): article["date"] = dateutil.parser.parse(entry[date_key]).astimezone( timezone.utc ) + except ParserError: + logger.exception("Error when parsing date {}".format(entry[date_key])) except Exception as e: logger.exception(e) else: -- cgit