X-Git-Url: https://projects.mako.cc/source/iron-blogger/blobdiff_plain/5bb64b79fe4931750c8f0bd2b8202c2460b4e37c..4441af62e955d91c3c00713dd34c5e7b9f81b6b5:/scan-feeds.py?ds=inline diff --git a/scan-feeds.py b/scan-feeds.py index bf60aef..0cf58f1 100755 --- a/scan-feeds.py +++ b/scan-feeds.py @@ -15,7 +15,7 @@ try: except IOError: log = {} -START = datetime.datetime(2009, 12, 21, 6) +START = datetime.datetime(2011, 10, 24, 6) def parse_published(pub): return parse(pub).astimezone(tz.tzlocal()).replace(tzinfo=None) @@ -30,6 +30,9 @@ def get_link(post): def parse_feeds(weeks, uri): feed = feedparser.parse(uri) + + print >>sys.stderr, "Parsing: %s" % uri + if not feed.entries: print >>sys.stderr, "WARN: no entries for ", uri for post in feed.entries: @@ -48,10 +51,16 @@ def parse_feeds(weeks, uri): if post['url'] not in [p['url'] for p in weeks[wn]]: weeks[wn].append(post) -for (username, u) in users.items(): - weeks = log.setdefault(username, []) - for l in u['links']: - parse_feeds(weeks, l[2]) +if len(sys.argv) > 1: + for username in sys.argv[1:]: + weeks = log.setdefault(username, []) + for l in users[username]['links']: + parse_feeds(weeks, l[2]) +else: + for (username, u) in users.items(): + weeks = log.setdefault(username, []) + for l in u['links']: + parse_feeds(weeks, l[2]) with open('out/report.yml', 'w') as f: yaml.safe_dump(log, f)