diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-09-28 14:45:44 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-09-28 14:45:44 +0200 |
commit | d38794d2b7c9ab59a45032570ce56b0d3a7b52d7 (patch) | |
tree | 5aeb9c4541376638684773a0aba506e8f557dffc /src/web | |
parent | test (diff) | |
download | newspipe-d38794d2b7c9ab59a45032570ce56b0d3a7b52d7.tar.gz newspipe-d38794d2b7c9ab59a45032570ce56b0d3a7b52d7.tar.bz2 newspipe-d38794d2b7c9ab59a45032570ce56b0d3a7b52d7.zip |
Bugfix.
Diffstat (limited to 'src/web')
-rw-r--r-- | src/web/lib/article_utils.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/web/lib/article_utils.py b/src/web/lib/article_utils.py index 71e83880..de8a78a4 100644 --- a/src/web/lib/article_utils.py +++ b/src/web/lib/article_utils.py @@ -1,6 +1,6 @@ import logging import dateutil.parser -from datetime import datetime +from datetime import datetime, timezone import conf from web.lib.utils import to_hash @@ -16,8 +16,8 @@ def extract_id(entry, keys=[('link', 'link'), ('published', 'date'), """ entry_id = entry.get('entry_id') or entry.get('id') if entry_id: - return {'entry_id': entry_id} if not entry_id and force_id: + logger.info('no entry id!!!') return to_hash("".join(entry[entry_key] for _, entry_key in keys if entry_key in entry).encode('utf8')) else: @@ -30,7 +30,7 @@ def extract_id(entry, keys=[('link', 'link'), ('published', 'date'), ids[pyagg_key] = dateutil.parser.parse(ids[pyagg_key])\ .isoformat() except ValueError as e: - print("extract_id: " + str(e)) + logger.exception("extract_id: " + str(e)) ids[pyagg_key] = datetime.now().isoformat() return ids @@ -46,8 +46,8 @@ def construct_article(entry, feed): try: date = dateutil.parser.parse(entry[date_key])\ .astimezone(timezone.utc) - except Exception: - pass + except Exception as e: + logger.exception(str(e)) else: break |