aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2020-03-30 22:01:51 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2020-03-30 22:01:51 +0200
commite68413912ba74e8d5f38fab45df20374a3214800 (patch)
treee1ff35a5e4e5abf07ca9ebe86f227e96896c7c7d
parentcatch exception with trying to fetch feed icon with requests (diff)
downloadnewspipe-e68413912ba74e8d5f38fab45df20374a3214800.tar.gz
newspipe-e68413912ba74e8d5f38fab45df20374a3214800.tar.bz2
newspipe-e68413912ba74e8d5f38fab45df20374a3214800.zip
catch ParseError form dateutil
-rw-r--r--newspipe/lib/article_utils.py3
1 files changed, 3 insertions, 0 deletions
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:
bgstack15