mirror of
https://github.com/sjlongland/tornado-news.git
synced 2025-09-13 10:03:14 +10:00
Handle feeds with entries that lack IDs
The Australian Bureau of Meteorology is one such feed. http://media.bom.gov.au/rss/ Instead, we'll generate one using the SHA1 hash of the link.
This commit is contained in:
parent
e107cee304
commit
b353f70cfa
@ -75,8 +75,14 @@ class FeedEntry(object):
|
||||
else:
|
||||
content = entry['summary']
|
||||
|
||||
try:
|
||||
entry_id = entry['id']
|
||||
except KeyError:
|
||||
# Aust. Bureau of Meteorology doesn't have an 'id'
|
||||
entry_id = sha1(entry['link']).hexdigest()
|
||||
|
||||
return cls(
|
||||
source, entry['id'], entry['link'], entry['title'],
|
||||
source, entry_id, entry['link'], entry['title'],
|
||||
entry.get('author') or 'Anonymous',
|
||||
timegm(entry.get('updated_parsed') or \
|
||||
entry['published_parsed']),
|
||||
|
Loading…
Reference in New Issue
Block a user