From 3e071defe4f19a36cef9194c5fc95320f9961989 Mon Sep 17 00:00:00 2001 From: cedricbonhomme Date: Thu, 2 Sep 2010 09:10:39 +0200 Subject: Improvement of the feedgetter module. Now pyAggr3g470r tries first to get the whole article (a_feed['entries'][i].content[j].value) and in case of failure tries to get the description/summary (a_feed['entries'][i].description) --- feedgetter.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'feedgetter.py') diff --git a/feedgetter.py b/feedgetter.py index a886f351..84fbd6c7 100755 --- a/feedgetter.py +++ b/feedgetter.py @@ -100,10 +100,14 @@ class FeedGetter(object): # feed already in the base pass for article in a_feed['entries']: + description = "" try: - description = article.description.encode('utf-8') - except Exception, e: - description = "" + description = article.content[0].value.encode('utf-8') + except AttributeError: + try: + description = article.description.encode('utf-8') + except Exception, e: + description = "" try: self.c.execute('insert into articles values (?,?,?,?,?,?,?)', (\ -- cgit