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)
|
urlig = self._googleUrlIG(expr)
|
||||||
js = utils.web.getUrl(urlig)
|
js = utils.web.getUrl(urlig)
|
||||||
# fix bad google json
|
# 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)
|
js = simplejson.loads(js)
|
||||||
|
|
||||||
if js['error'] == '':
|
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
|
return
|
||||||
|
|
||||||
url = self._googleUrl(expr)
|
url = self._googleUrl(expr)
|
||||||
|
Loading…
Reference in New Issue
Block a user