From e8ce0a178203fbe13608c33bc7af73706d448838 Mon Sep 17 00:00:00 2001 From: mutantmonkey Date: Thu, 22 Sep 2011 18:19:25 -0400 Subject: [PATCH] actually fix search this time --- modules/search.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/search.py b/modules/search.py index ef280ca..47b5c85 100755 --- a/modules/search.py +++ b/modules/search.py @@ -21,11 +21,11 @@ class Grab(web.urllib.request.URLopener): def google_ajax(query): """Search using AjaxSearch, and return its JSON.""" uri = 'http://ajax.googleapis.com/ajax/services/search/web' - args = '?v=1.0&safe=off&q=' + web.urllib.quote(query) - handler = web.urllib._urlopener - web.urllib._urlopener = Grab() + args = '?v=1.0&safe=off&q=' + web.quote(query) + handler = web.urllib.request._urlopener + web.urllib.request._urlopener = Grab() bytes = web.get(uri + args) - web.urllib._urlopener = handler + web.urllib.request._urlopener = handler return web.json(bytes) def google_search(query): @@ -106,7 +106,7 @@ gcs.commands = ['gcs', 'comp'] r_bing = re.compile(r'

') def duck_search(query): query = query.replace('!', '') - query = web.urllib.quote(query) + query = web.quote(query) uri = 'http://duckduckgo.com/html/?q=%s&kl=uk-en' % query bytes = web.get(uri) m = r_duck.search(bytes) @@ -185,7 +185,7 @@ def suggest(phenny, input): return phenny.reply("No query term.") query = input.group(2) uri = 'http://websitedev.de/temp-bin/suggest.pl?q=' - answer = web.get(uri + web.urllib.quote(query).replace('+', '%2B')) + answer = web.get(uri + web.quote(query).replace('+', '%2B')) if answer: phenny.say(answer) else: phenny.reply('Sorry, no result.')