aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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