feedparser
feedparser copied to clipboard
feed entry published date should have better defaults
There are two possible fallbacks for the feed date that are missing:
- the entry's
createddate field - the feed itself's
updateddate 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!