From ec1f7824a50e3942507bc97ccd5e2b1f4b546225 Mon Sep 17 00:00:00 2001 From: Siddharth VP Date: Mon, 17 May 2021 00:13:14 +0530 Subject: [PATCH] page: encode title in pageViews() request --- src/page.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/page.ts b/src/page.ts index 521eac1..7cc5177 100644 --- a/src/page.ts +++ b/src/page.ts @@ -600,7 +600,22 @@ export default function (bot: mwn): MwnPageStatic { return bot .rawRequest({ - url: `https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/${project}/${access}/${agent}/${this.toString()}/${granularity}/${startString}/${endString}`, + url: + 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article' + + '/' + + project + + '/' + + access + + '/' + + agent + + '/' + + encodeURIComponent(this.toString()) + + '/' + + granularity + + '/' + + startString + + '/' + + endString, headers: { 'User-Agent': bot.options.userAgent, },