2010-04-23 03:47:41 +00:00
|
|
|
from util import hook, http
|
2010-01-17 04:24:36 +00:00
|
|
|
|
|
|
|
|
2010-04-23 03:47:41 +00:00
|
|
|
@hook.regex(r'(?i)http://(?:www\.)?tinyurl.com/([A-Za-z0-9\-]+)')
|
2010-03-12 00:19:36 +00:00
|
|
|
def tinyurl(match):
|
|
|
|
try:
|
2010-04-23 03:47:41 +00:00
|
|
|
return http.open(match.group()).url.strip()
|
|
|
|
except http.URLError, e:
|
2010-03-12 00:19:36 +00:00
|
|
|
pass
|