aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-09-28 10:33:05 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-09-28 10:33:05 +0200
commit0c90ac01d2fd503905f1601959002c89146fc7f7 (patch)
treecdf354232f6618e591687179d63dde14bf9e183d
parenttest (diff)
downloadnewspipe-0c90ac01d2fd503905f1601959002c89146fc7f7.tar.gz
newspipe-0c90ac01d2fd503905f1601959002c89146fc7f7.tar.bz2
newspipe-0c90ac01d2fd503905f1601959002c89146fc7f7.zip
test
-rw-r--r--src/crawler/classic_crawler.py2
-rw-r--r--src/web/lib/article_utils.py6
2 files changed, 6 insertions, 2 deletions
diff --git a/src/crawler/classic_crawler.py b/src/crawler/classic_crawler.py
index dc367440..2e292624 100644
--- a/src/crawler/classic_crawler.py
+++ b/src/crawler/classic_crawler.py
@@ -122,7 +122,7 @@ async def insert_database(user, feed):
existing_article_req = art_contr.read(feed_id=feed.id,
**extract_id(article))
except Exception as e:
- print("existing_article_req: " + e)
+ print("existing_article_req: " + str(e))
continue
exist = existing_article_req.count() != 0
diff --git a/src/web/lib/article_utils.py b/src/web/lib/article_utils.py
index b5b9f246..71e83880 100644
--- a/src/web/lib/article_utils.py
+++ b/src/web/lib/article_utils.py
@@ -26,8 +26,12 @@ def extract_id(entry, keys=[('link', 'link'), ('published', 'date'),
if entry_key in entry and pyagg_key not in ids:
ids[pyagg_key] = entry[entry_key]
if 'date' in pyagg_key:
- ids[pyagg_key] = dateutil.parser.parse(ids[pyagg_key])\
+ try:
+ ids[pyagg_key] = dateutil.parser.parse(ids[pyagg_key])\
.isoformat()
+ except ValueError as e:
+ print("extract_id: " + str(e))
+ ids[pyagg_key] = datetime.now().isoformat()
return ids
bgstack15