diff options
author | cedricbonhomme <devnull@localhost> | 2010-01-31 12:45:38 +0100 |
---|---|---|
committer | cedricbonhomme <devnull@localhost> | 2010-01-31 12:45:38 +0100 |
commit | 7eaee7d8c2f06a8ed15c326e31f9724ee75e8040 (patch) | |
tree | a7388e4d773984a8989b7fc87e3e2ed1e30275b0 /feedgetter.py | |
parent | All date are parsed into the standard Python datetime format. (diff) | |
download | newspipe-7eaee7d8c2f06a8ed15c326e31f9724ee75e8040.tar.gz newspipe-7eaee7d8c2f06a8ed15c326e31f9724ee75e8040.tar.bz2 newspipe-7eaee7d8c2f06a8ed15c326e31f9724ee75e8040.zip |
Sort articles by date for each feeds.
Diffstat (limited to 'feedgetter.py')
-rw-r--r-- | feedgetter.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/feedgetter.py b/feedgetter.py index 8c2d6e4c..a99d8a29 100644 --- a/feedgetter.py +++ b/feedgetter.py @@ -69,7 +69,8 @@ class FeedGetter(object): self.c = self.conn.cursor() self.c.execute('''create table if not exists rss_feed (date text, feed_title text, feed_site_link text, \ - article_title text, article_link text PRIMARY KEY)''') + article_title text, article_link text PRIMARY KEY, \ + article_content text)''') # add the articles in the base self.add_into_sqlite(feedparser.parse(the_good_url)) @@ -85,12 +86,17 @@ class FeedGetter(object): """ for article in a_feed['entries']: try: - self.c.execute('insert into rss_feed values (?,?,?,?,?)', (\ + content = article.description.encode('utf-8') + except Exception, e: + content = "No description" + try: + self.c.execute('insert into rss_feed values (?,?,?,?,?,?)', (\ datetime(*article.updated_parsed[:6]), \ a_feed.feed.title.encode('utf-8'), \ a_feed.feed.link.encode('utf-8'), \ article.title.encode('utf-8'), \ - article.link.encode('utf-8'))) + article.link.encode('utf-8'), \ + content)) except sqlite3.IntegrityError: pass |