xbmcbackup/resources/lib/tinyurl.py

12 lines
364 B
Python
Raw Normal View History

2019-08-27 22:03:43 +02:00
from future.moves.urllib.request import urlopen
2017-01-30 19:51:36 +01:00
#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='
2019-08-27 22:03:43 +02:00
req = urlopen(tinyurl + aUrl)
2017-01-30 19:51:36 +01:00
data = req.read()
#should be a tiny url
return str(data)