mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Google: Fix bad json format.
This commit is contained in:
parent
c310d74a19
commit
207f6ec2da
@ -347,11 +347,17 @@ class Google(callbacks.PluginRegexp):
|
||||
urlig = self._googleUrlIG(expr)
|
||||
js = utils.web.getUrl(urlig)
|
||||
# fix bad google json
|
||||
js = js.replace('lhs:','"lhs":').replace('rhs:','"rhs":').replace('error:','"error":').replace('icc:','"icc":')
|
||||
js = js \
|
||||
.replace('lhs:','"lhs":') \
|
||||
.replace('rhs:','"rhs":') \
|
||||
.replace('error:','"error":') \
|
||||
.replace('icc:','"icc":') \
|
||||
.replace('\\', '\\\\')
|
||||
js = simplejson.loads(js)
|
||||
|
||||
if js['error'] == '':
|
||||
irc.reply("%s = %s" % (js['lhs'].encode('utf8'), js['rhs'].encode('utf8'),))
|
||||
irc.reply("%s = %s" % (js['lhs'].encode('utf8').decode('string_escape'),
|
||||
js['rhs'].encode('utf8').decode('string_escape'),))
|
||||
return
|
||||
|
||||
url = self._googleUrl(expr)
|
||||
|
Loading…
Reference in New Issue
Block a user