aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2013-12-26 15:00:09 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2013-12-26 15:00:09 +0100
commitdb3b0dbc41a814f9185eca81cddc7caf47b9f04e (patch)
treeff31d9ab801d3a22d87ecd62207bce8ca68d3ea2
parentGet the 'real' url. (diff)
downloadnewspipe-db3b0dbc41a814f9185eca81cddc7caf47b9f04e.tar.gz
newspipe-db3b0dbc41a814f9185eca81cddc7caf47b9f04e.tar.bz2
newspipe-db3b0dbc41a814f9185eca81cddc7caf47b9f04e.zip
If it is not possible to get the real URL, uses the URL provided by feedparser.
-rw-r--r--pyaggr3g470r/feedgetter.py9
1 files changed, 6 insertions, 3 deletions
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
bgstack15