Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Commit

Permalink
RSS: Ignore invalid date - #267 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxMaSk committed Dec 1, 2017
1 parent 97dfa09 commit 9d8ac96
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions th_rss/my_rss.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9d8ac96

Please sign in to comment.