Some feeds, e.g.
http://japanfocus.org/admin/site_manage/rss/recent.rss
Don't have ids for items. Gracefully recover from that.
This commit is contained in:
The Dod 2015-08-01 04:37:41 +07:00
parent 1094586ef7
commit 858c26b925

View File

@ -102,7 +102,7 @@ def main(max_items):
msgs = []
for i, e in enumerate(feed.entries):
eid = '{0}|{1}'.format(feed_url,e.id)
eid = '{0}|{1}'.format(feed_url,e.get('id','???'))
if eid in db.keys() and not args.repost_existing: # been there, done that (or not - for a reason)
logging.debug('Skipping duplicate {0}'.format(eid))
@ -166,8 +166,11 @@ def main(max_items):
db[eid] = utfmsg # anydbm can't handle unicode, so it's a good thing we've also kept the utf-8 :)
except Exception, e:
logging.error(repr(e)) # usually not very informative :(
try: # temporary patch
if e.error:
logging.error(e.error)
except Exception,e:
logging.error('error loggin borked %s',repr(e)) # usually not very informative :(
if __name__=='__main__':