From 9d8ac96691f30ba94bcdf81f0d34a04c03e0ba03 Mon Sep 17 00:00:00 2001 From: FoxMaSk Date: Fri, 1 Dec 2017 21:36:32 +0100 Subject: [PATCH] RSS: Ignore invalid date - #267 fixed --- th_rss/my_rss.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/th_rss/my_rss.py b/th_rss/my_rss.py index 6d80a54..d1f6ef0 100644 --- a/th_rss/my_rss.py +++ b/th_rss/my_rss.py @@ -31,7 +31,7 @@ def _get_published(self, entry): :param entry: :return: """ - published = '' + published = None if hasattr(entry, 'published_parsed'): if entry.published_parsed is not None: published = datetime.datetime.utcfromtimestamp(time.mktime(entry.published_parsed)) @@ -70,8 +70,8 @@ def read_data(self, **kwargs): # entry.*_parsed may be None when the date in a RSS Feed is invalid # so will have the "now" date as default published = self._get_published(entry) - published = now if published == '' else arrow.get(str(published)).to(settings.TIME_ZONE) - + if published: + published = arrow.get(str(published)).to(settings.TIME_ZONE) date_triggered = arrow.get(str(date_triggered)).to(settings.TIME_ZONE) if date_triggered is not None and published is not None and now >= published >= date_triggered: my_feeds.append(entry)