aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/crawler.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2015-07-06 15:26:29 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2015-07-06 15:26:29 +0200
commita867c1243c80843f3736ee260b92d5b13ec510ec (patch)
tree18f4d724abb04d9a14ad7dd5c0b1aca8eb98b3ca /pyaggr3g470r/crawler.py
parentMerged in jaesivsm/pyaggr3g470r (pull request #16) (diff)
downloadnewspipe-a867c1243c80843f3736ee260b92d5b13ec510ec.tar.gz
newspipe-a867c1243c80843f3736ee260b92d5b13ec510ec.tar.bz2
newspipe-a867c1243c80843f3736ee260b92d5b13ec510ec.zip
Minor fixes from a quick review. Need to test deeper.
Diffstat (limited to 'pyaggr3g470r/crawler.py')
-rw-r--r--pyaggr3g470r/crawler.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/pyaggr3g470r/crawler.py b/pyaggr3g470r/crawler.py
index b70b4e70..4ebca1a3 100644
--- a/pyaggr3g470r/crawler.py
+++ b/pyaggr3g470r/crawler.py
@@ -64,7 +64,6 @@ def get(*args, **kwargs):
data = feedparser.parse(args[0])
return data
except Exception as e:
- #print(e)
raise e
@asyncio.coroutine
@@ -118,7 +117,8 @@ def insert_database(user, feed):
new_articles = []
art_contr = ArticleController(user.id)
for article in articles:
- exist = art_contr.read(feed_id=feed.id, **extract_id(article))
+ exist = art_contr.read(feed_id=feed.id,
+ **extract_id(article)).count() != 0
if exist:
logger.debug("Article %r (%r) already in the database.",
article.title, article.link)
@@ -128,7 +128,7 @@ def insert_database(user, feed):
new_articles.append(art_contr.create(**article))
logger.info("New article % (%r) added.",
article.title, article.link)
- except Exception:
+ except Exception as e:
logger.exception("Error when inserting article in database:")
continue
return new_articles
bgstack15