fix "wp" json decoding

This commit is contained in:
urlbot
2015-02-18 00:40:18 +01:00
parent 45cc3935b5
commit ea1343b0e3

View File

@@ -581,10 +581,12 @@ def command_wp(argv, lang='de', **args):
lang, urllib.parse.urlencode(api)
)
logger('plugin', 'wp: fetching %s' % apiurl)
try:
response = urllib.request.urlopen(apiurl)
buf = response.read(BUFSIZ)
j = json.loads(buf.decode('unicode_escape'))
j = json.loads(buf.decode('utf8'))
page = next(iter(j['query']['pages'].values()))
short = page.get('extract', None)