aboutsummaryrefslogtreecommitdiff
path: root/feedgetter.py
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2011-06-10 13:57:44 +0200
committercedricbonhomme <devnull@localhost>2011-06-10 13:57:44 +0200
commitc3ada18a3974d21679ecef6fc6e96df35da16a1b (patch)
tree066b30e88c61ab777699fbe8d7a9eebbeb0c4e58 /feedgetter.py
parentMinor bugfix: Missing feed id in the URL parameter. (diff)
downloadnewspipe-c3ada18a3974d21679ecef6fc6e96df35da16a1b.tar.gz
newspipe-c3ada18a3974d21679ecef6fc6e96df35da16a1b.tar.bz2
newspipe-c3ada18a3974d21679ecef6fc6e96df35da16a1b.zip
Minor improvement: test if the published/update date for the article is present before the data base insertion
Diffstat (limited to 'feedgetter.py')
-rwxr-xr-xfeedgetter.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/feedgetter.py b/feedgetter.py
index 54183b08..d272fcb1 100755
--- a/feedgetter.py
+++ b/feedgetter.py
@@ -133,9 +133,14 @@ class FeedGetter(object):
article_title = str(BeautifulSoup(article.title))
try:
+ post_date = datetime(*article.updated_parsed[:6])
+ except:
+ post_date = datetime(*article.published_parsed[:6])
+
+ try:
# try. Will only success if the article is not already in the data base
self.c.execute('insert into articles values (?, ?, ?, ?, ?, ?, ?)', (\
- datetime(*article.updated_parsed[:6]), \
+ post_date, \
article_title, \
article.link.encode('utf-8'), \
description, \
@@ -158,9 +163,9 @@ class FeedGetter(object):
except sqlite3.IntegrityError:
# article already in the data base
pass
- except:
+ except Exception, e:
# Missing information (updated_parsed, ...)
- pass
+ print e
if __name__ == "__main__":
bgstack15