Improve the logic for choosing a link from a feed.
This commit is contained in:
parent
364ecc7623
commit
3580088d8c
|
@ -20,9 +20,15 @@ def get_date(post):
|
|||
return post.updated
|
||||
|
||||
def get_link(post):
|
||||
if 'links' in post:
|
||||
links = dict((l.rel, l) for l in post.links if 'html' in l.type)
|
||||
if 'self' in links:
|
||||
return links['self'].href
|
||||
elif 'alternate' in links:
|
||||
return links['alternate'].href
|
||||
if 'href' in post:
|
||||
return post.href
|
||||
return post.links[0]['href']
|
||||
return None
|
||||
|
||||
def parse_feeds(weeks, uri):
|
||||
feed = feedparser.parse(uri)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Subject: IRON BLOGGER results for the week of ${week_start.strftime("%F")}
|
||||
Subject: IRON BLOGGER results for the week beginning ${week_start.strftime("%F")}
|
||||
To: iron-blogger@mit.edu
|
||||
|
||||
People who posted:
|
||||
|
|
Loading…
Reference in a new issue