acortame.py: if we try to expand an URL not shortened by the service, use generic URL unshortener in the base class

This commit is contained in:
Jose Manuel Delicado 2017-08-12 21:07:02 +02:00
parent 24756e73d3
commit f18a03d4a1

View File

@ -18,7 +18,9 @@ class AcortameShortener (URLShortener):
return 'acorta.me' in url return 'acorta.me' in url
def unshorten (self, url): def unshorten (self, url):
if not 'acorta.me' in url:
#use generic expand method
return super(AcortameShortener, self).unshorten(url)
answer = url answer = url
api = requests.get ("https://acorta.me/api.php?action=expand&format=simple&shorturl=" + urllib.quote(url)) api = requests.get ("https://acorta.me/api.php?action=expand&format=simple&shorturl=" + urllib.quote(url))
if api.status_code == 200: if api.status_code == 200: