From db3b0dbc41a814f9185eca81cddc7caf47b9f04e Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Thu, 26 Dec 2013 15:00:09 +0100 Subject: If it is not possible to get the real URL, uses the URL provided by feedparser. --- pyaggr3g470r/feedgetter.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'pyaggr3g470r') diff --git a/pyaggr3g470r/feedgetter.py b/pyaggr3g470r/feedgetter.py index c0d93c50..d3195fb0 100644 --- a/pyaggr3g470r/feedgetter.py +++ b/pyaggr3g470r/feedgetter.py @@ -95,9 +95,12 @@ class FeedGetter(object): articles = [] for article in a_feed['entries']: - r = requests.get(article.link) - parsed_url = urlparse(r.url) - real_url = parsed_url.scheme + '://' + parsed_url.netloc + parsed_url.path + try: + r = requests.get(article.link) + parsed_url = urlparse(r.url) + real_url = parsed_url.scheme + '://' + parsed_url.netloc + parsed_url.path + except: + real_url = article.link if models.Article.objects(link=real_url).first() != None: # if article already in the database continue with the next article -- cgit