mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09: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
614e6c3f43
commit
a6b9d5fe5f
@ -172,14 +172,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