feedparser icon indicating copy to clipboard operation
feedparser copied to clipboard

feed entry published date should have better defaults

Open anarcat opened this issue 8 years ago • 0 comments

There are two possible fallbacks for the feed date that are missing:

  • the entry's created date field
  • the feed itself's updated date field

in my code, I worked around this by doing this in a loop when processing entries:

        # add more defaults to entry dates:
        # 1. created_parsed of the item
        # 2. updated_parsed of the feed
        entry['updated_parsed'] = entry.get('updated_parsed', entry.get('created_parsed', data['feed'].get('updated_parsed', False)))  # noqa
        assert entry.get('updated_parsed') is not None

quite a mouthful... it seems to me the entry getter should at least add created as a fallback, but also use the feed's updated date as a fallback as well...

is there a better way to do this? or to monkeypatch around that issue in a cleaner way?

thanks!

anarcat avatar Sep 10 '17 21:09 anarcat