aboutsummaryrefslogtreecommitdiff
path: root/source/sqlite2mongo.py
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2012-05-01 14:10:25 +0200
committercedricbonhomme <devnull@localhost>2012-05-01 14:10:25 +0200
commitba14debbde6cde5d77f5d57e67d4bef341042857 (patch)
treeca50a7169cd0f86b472c6a36fd4ed1dd4e9276c5 /source/sqlite2mongo.py
parentExport tp webzine nearly OK. (diff)
downloadnewspipe-ba14debbde6cde5d77f5d57e67d4bef341042857.tar.gz
newspipe-ba14debbde6cde5d77f5d57e67d4bef341042857.tar.bz2
newspipe-ba14debbde6cde5d77f5d57e67d4bef341042857.zip
urlsafe_b64encode is replaced by SHA1 for id of articles.
Diffstat (limited to 'source/sqlite2mongo.py')
-rw-r--r--source/sqlite2mongo.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/sqlite2mongo.py b/source/sqlite2mongo.py
index c4bb4e17..ecb0ec7f 100644
--- a/source/sqlite2mongo.py
+++ b/source/sqlite2mongo.py
@@ -1,6 +1,7 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
+import hashlib
import sqlite3
import mongodb
@@ -34,7 +35,9 @@ def sqlite2mongo():
feed[2] + "'").fetchall()
except:
continue
- feed_id = utils.uri_b64encode(feed[2].encode('utf-8'))
+ sha1_hash = hashlib.sha1()
+ sha1_hash.update(feed[2].encode('utf-8'))
+ feed_id = sha1_hash.hexdigest()
new_collection = {"feed_id" : feed_id.encode('utf-8'), \
"type": 0, \
@@ -50,7 +53,9 @@ def sqlite2mongo():
# Walk through the list of articles for the current feed.
articles = []
for article in list_of_articles:
- article_id = utils.uri_b64encode(article[2].encode('utf-8'))
+ sha1_hash = hashlib.sha1()
+ sha1_hash.update(article[2].encode('utf-8'))
+ article_id = sha1_hash.hexdigest()
article = {"article_id": article_id.encode('utf-8'), \
"type":1, \
bgstack15