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

@ -29,4 +29,13 @@ def shorten(inp, bot = None):
api_key = bot.config.get("api_keys", {}).get("bitly_api", None)
if api_key is None:
return "error: no api key set"
return bitly(inp, api_user, api_key)
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