xbmcbackup/resources/lib/tinyurl.py
2019-08-27 15:03:43 -05:00

12 lines
364 B
Python

from future.moves.urllib.request import urlopen
#this is duplicated in snipppets of code from all over the web, credit to no one
#in particular - to all those that have gone before me!
def shorten(aUrl):
tinyurl = 'http://tinyurl.com/api-create.php?url='
req = urlopen(tinyurl + aUrl)
data = req.read()
#should be a tiny url
return str(data)