From d6881d4ece6521ac1a4e102ead60b67dd15597c7 Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Thu, 19 Apr 2012 13:37:46 +1200 Subject: [PATCH] Pulled fixed version of suggest.py from upstream (fixed by stoneLeaf) --- disabled_plugins/suggest.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/disabled_plugins/suggest.py b/disabled_plugins/suggest.py index a60efce..75cdaa8 100755 --- a/disabled_plugins/suggest.py +++ b/disabled_plugins/suggest.py @@ -15,19 +15,19 @@ def suggest(inp, inp_unstripped=''): num, inp = m.groups() num = int(num) if num > 10: - return 'I can only get the first ten suggestions.' + return 'can only get first ten suggestions' else: num = 0 - page = http.get('http://google.com/complete/search', q=inp) + page = http.get('http://google.com/complete/search', output='json', client='hp', q=inp) page_json = page.split('(', 1)[1][:-1] suggestions = json.loads(page_json)[1] if not suggestions: - return 'No suggestions found :(' + return 'no suggestions found' if num: if len(suggestions) + 1 <= num: - return 'I only got %d suggestions.' % len(suggestions) + return 'only got %d suggestions' % len(suggestions) out = suggestions[num - 1] else: out = random.choice(suggestions) - return '#%d: %s' % (int(out[2][0]) + 1, out[0]) + return '#%d: %s' % (int(out[2][0]) + 1, out[0].replace('', '').replace('', '')) \ No newline at end of file