diff --git a/plugins/urls.py b/plugins/urls.py index c2eb2dc..da935bf 100644 --- a/plugins/urls.py +++ b/plugins/urls.py @@ -2,11 +2,11 @@ from util import hook, urlnorm, http ignore = ['buttbot'] -is_gd = 'http://is.gd/create.php?format=simple&url=%s' @hook.regex(r'([a-zA-Z]+://|www\.)[^ ]+') def show_title(match, nick='', chan='', say=None): - url = urlnorm.normalize(match.group().encode('utf-8')) + matched = match.group().encode('utf-8') + url = urlnorm.normalize(matched) if not url in ignore and not nick in ignore: page, response = http.get_html_and_response(url) @@ -30,8 +30,10 @@ def show_title(match, nick='', chan='', say=None): message = 'URL title: %s' % (''.join(titleList)) if len(url) >= 80: - # Get the short URL. - short_url = http.get(is_gd % (url)) + short_url = http.get( + 'http://is.gd/create.php', + query_params = {'format': 'simple', 'url': matched} + ) # Cheap error checking if 'error: please' not in short_url.lower():