URL shortener now performs step by step expansion, so you possibly will have to expand an URL multiple times to reach the final destination

This commit is contained in:
Jose Manuel Delicado 2017-09-22 17:18:38 +02:00
parent a1381008d7
commit 11ca3a2190

View File

@ -21,7 +21,7 @@ class URLShortener (object):
def unshorten(self, url): def unshorten(self, url):
try: try:
r=requests.head(url, allow_redirects=True) r=requests.head(url)
return r.url return r.headers['location']
except: except:
return url #we cannot expand return url #we cannot expand