mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-08 03:59:23 +01:00
Google: fix encoding bug in lucky --snippet; need to pass encoded string to utils.web.htmlToText
This commit is contained in:
parent
d469108054
commit
3a181b6dd2
@ -168,14 +168,14 @@ class Google(callbacks.PluginRegexp):
|
|||||||
opts = dict(opts)
|
opts = dict(opts)
|
||||||
data = self.search(text, msg.args[0], {'smallsearch': True})
|
data = self.search(text, msg.args[0], {'smallsearch': True})
|
||||||
if data['responseData']['results']:
|
if data['responseData']['results']:
|
||||||
url = data['responseData']['results'][0]['unescapedUrl']
|
url = data['responseData']['results'][0]['unescapedUrl'].encode('utf-8')
|
||||||
if opts.has_key('snippet'):
|
if opts.has_key('snippet'):
|
||||||
snippet = data['responseData']['results'][0]['content']
|
snippet = data['responseData']['results'][0]['content'].encode('utf-8')
|
||||||
snippet = " | " + utils.web.htmlToText(snippet, tagReplace='')
|
snippet = " | " + utils.web.htmlToText(snippet, tagReplace='')
|
||||||
else:
|
else:
|
||||||
snippet = ""
|
snippet = ""
|
||||||
result = url + snippet
|
result = url + snippet
|
||||||
irc.reply(result.encode('utf-8'))
|
irc.reply(result)
|
||||||
else:
|
else:
|
||||||
irc.reply('Google found nothing.')
|
irc.reply('Google found nothing.')
|
||||||
lucky = wrap(lucky, [getopts({'snippet':'',}), 'text'])
|
lucky = wrap(lucky, [getopts({'snippet':'',}), 'text'])
|
||||||
|
Loading…
Reference in New Issue
Block a user