X-Git-Url: https://projects.mako.cc/source/iron-blogger/blobdiff_plain/32e6bed76a40a5464923cd78ce0ff8be5146f98e..bf1fb66fb40e3ad7a6bb8a3c361aa3318cfc0331:/report.py diff --git a/report.py b/report.py old mode 100644 new mode 100755 index 2c9a97e..998a1cc --- a/report.py +++ b/report.py @@ -1,3 +1,4 @@ +#!/usr/bin/python import yaml import feedparser import datetime @@ -20,9 +21,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)