diff options
author | cedricbonhomme <devnull@localhost> | 2012-04-20 14:30:16 +0200 |
---|---|---|
committer | cedricbonhomme <devnull@localhost> | 2012-04-20 14:30:16 +0200 |
commit | 8ad800252042839a5d7d0ea3cfaea0a56987efcc (patch) | |
tree | c322107ec957e782bb734fc01d5df9880ebaa43b /source/feedgetter.py | |
parent | Added tag for the version 3.1 (last stable version with an SQLite database). (diff) | |
download | newspipe-8ad800252042839a5d7d0ea3cfaea0a56987efcc.tar.gz newspipe-8ad800252042839a5d7d0ea3cfaea0a56987efcc.tar.bz2 newspipe-8ad800252042839a5d7d0ea3cfaea0a56987efcc.zip |
SHA1 is replaced by urlsafe_b64encode for id of articles.
Diffstat (limited to 'source/feedgetter.py')
-rwxr-xr-x | source/feedgetter.py | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/source/feedgetter.py b/source/feedgetter.py index e3469132..351d099d 100755 --- a/source/feedgetter.py +++ b/source/feedgetter.py @@ -99,10 +99,8 @@ class FeedGetter(object): except: feed_image = "/img/feed-icon-28x28.png" - sha1_hash = hashlib.sha1() - sha1_hash.update(feed_link.encode('utf-8')) - feed_id = sha1_hash.hexdigest() - + feed_id = utils.uri_b64encode(feed_link.encode('utf-8')) + collection_dic = {"feed_id": feed_id, \ "type": 0, \ "feed_image": feed_image, \ @@ -111,7 +109,7 @@ class FeedGetter(object): "site_link": a_feed.feed.link.encode('utf-8'), \ "mail": False \ } - + self.articles.add_collection(collection_dic) articles = [] @@ -134,10 +132,7 @@ class FeedGetter(object): except: post_date = datetime(*article.published_parsed[:6]) - - sha1_hash = hashlib.sha1() - sha1_hash.update(article.link.encode('utf-8')) - article_id = sha1_hash.hexdigest() + article_id = utils.uri_b64encode(article.link.encode('utf-8')) article = {"article_id": article_id, \ "type":1, \ @@ -148,7 +143,7 @@ class FeedGetter(object): "article_readed": False, \ "article_like": False \ } - + articles.append(article) self.articles.add_articles(articles, feed_id) |