diff options
author | cedricbonhomme <devnull@localhost> | 2012-05-01 14:10:25 +0200 |
---|---|---|
committer | cedricbonhomme <devnull@localhost> | 2012-05-01 14:10:25 +0200 |
commit | ba14debbde6cde5d77f5d57e67d4bef341042857 (patch) | |
tree | ca50a7169cd0f86b472c6a36fd4ed1dd4e9276c5 /source/feedgetter.py | |
parent | Export tp webzine nearly OK. (diff) | |
download | newspipe-ba14debbde6cde5d77f5d57e67d4bef341042857.tar.gz newspipe-ba14debbde6cde5d77f5d57e67d4bef341042857.tar.bz2 newspipe-ba14debbde6cde5d77f5d57e67d4bef341042857.zip |
urlsafe_b64encode is replaced by SHA1 for id of articles.
Diffstat (limited to 'source/feedgetter.py')
-rwxr-xr-x | source/feedgetter.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/feedgetter.py b/source/feedgetter.py index aa25f2a3..59322e6a 100755 --- a/source/feedgetter.py +++ b/source/feedgetter.py @@ -26,6 +26,7 @@ __revision__ = "$Date: 2012/04/22 $" __copyright__ = "Copyright (c) Cedric Bonhomme" __license__ = "GPLv3" +import hashlib import threading import feedparser from BeautifulSoup import BeautifulSoup @@ -96,7 +97,9 @@ class FeedGetter(object): except: feed_image = "/img/feed-icon-28x28.png" - feed_id = utils.uri_b64encode(feed_link.encode('utf-8')) + sha1_hash = hashlib.sha1() + sha1_hash.update(feed_link.encode('utf-8')) + feed_id = sha1_hash.hexdigest() collection_dic = {"feed_id": feed_id, \ "type": 0, \ @@ -129,7 +132,9 @@ class FeedGetter(object): except: post_date = datetime(*article.published_parsed[:6]) - article_id = utils.uri_b64encode(article.link.encode('utf-8')) + sha1_hash = hashlib.sha1() + sha1_hash.update(article.link.encode('utf-8')) + article_id = sha1_hash.hexdigest() article = {"article_id": article_id, \ "type":1, \ |