From e231f7d7c6e30cb8575cc27dbbb1819d3cd57180 Mon Sep 17 00:00:00 2001 From: Kada Liao Date: Fri, 27 Dec 2019 15:04:02 +0800 Subject: [PATCH] fixes #31: [leetcode.cn] http error 400 --- plugins/leetcode.cn.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/leetcode.cn.js b/plugins/leetcode.cn.js index 07d5d2d..50dfdc4 100644 --- a/plugins/leetcode.cn.js +++ b/plugins/leetcode.cn.js @@ -77,6 +77,7 @@ plugin.getProblems = function(cb) { const title = titles[problem.fid]; if (title) problem.name = title; + problem.fid = Number(problem.fid) || problem.fid }); return cb(null, problems); @@ -97,12 +98,11 @@ plugin.getProblemsTitle = function(cb) { 'query getQuestionTranslation($lang: String) {', ' translations: allAppliedQuestionTranslations(lang: $lang) {', ' title', - ' question {', - ' questionId', - ' }', + ' questionId', + ' __typename', ' }', '}', - '' + '', ].join('\n'), variables: {}, operationName: 'getQuestionTranslation' @@ -116,7 +116,7 @@ plugin.getProblemsTitle = function(cb) { const titles = []; body.data.translations.forEach(function(x) { - titles[x.question.questionId] = x.title; + titles[x.questionId] = x.title; }); return cb(null, titles);