From f4cb792c83b30680cbc1cdd34e314c77876c7958 Mon Sep 17 00:00:00 2001 From: Peter Dahlberg Date: Fri, 6 Feb 2015 14:27:35 +0100 Subject: [PATCH] wp: now with redirects --- plugins.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins.py b/plugins.py index 959553a..8caafed 100644 --- a/plugins.py +++ b/plugins.py @@ -533,15 +533,15 @@ def command_wp(argv,lang="de",**args): 'msg': args['reply_user'] + ": You must enter a query" } - api = { "action" : "query", "prop" : "extracts", "explaintext": "" , "redirect": "", - "exsentences" : 2, "rawcontinue" : 1, "format" : "json", "titles" : query } + api = { "action" : "query", "prop" : "extracts", "explaintext": "" , "redirects": "", + "exsentences" : 2, "continue" : "", "format" : "json", "titles" : query } apiurl = "https://%s.wikipedia.org/w/api.php?%s" % (lang, urllib.parse.urlencode(api)) try: response = urllib.request.urlopen(apiurl) buf = response.read(BUFSIZ) j = json.loads(buf.decode("unicode_escape")) - + page = next(iter(j['query']['pages'].values())) short = page.get("extract", None) linktitle = page.get("title", query).replace(" ","_")