Added .expand to get original URL from shortened URL

This commit is contained in:
Luke Rogers 2012-02-26 22:36:26 +13:00
parent d5c81f6079
commit f178ed33b6

View file

@ -30,3 +30,12 @@ def shorten(inp, bot = None):
if api_key is None:
return "error: no api key set"
return bitly(inp, api_user, api_key)
@hook.command
def expand(inp, bot = None):
".expand <url> - gets the original URL from a shortened link"
try:
url = http.get_url(inp)
except HTTPError, e:
return "Failed to expand URL."
return url