Closed happysj2202 closed 4 years ago
The reason is that the graphql request query parameters on leetcode-cn.com have been changed. I created a PR to fix this, hoping to help you.
The reason is that the graphql request query parameters on leetcode-cn.com have been changed. I created a PR to fix this, hoping to help you.
Thanks too much. I modified it locally according to your submission, and it worked well.
The reason is that the graphql request query parameters on leetcode-cn.com have been changed. I created a PR to fix this, hoping to help you.
Thanks for your solution. Worked well too.
Thanks, it works for me.
➜ leetcode-cli-plugins leetcode version -v | | | | | | | | | |_ | | _ | |/ \/ \ |/ _|/ \ / ` |/ \ | | / / |_ (| () | (| | / ||\|_|_|\|_/ _,|_| CLI v2.7.0
[Environment] Node v8.10.0 OS linux 4.14.116 Cache /root/.lc/leetcode.cn/cache Config /root/.lc/config.json
[Configuration] autologin {"enable":false,"retry":2} code {"editor":"vim","lang":"cpp"} file {"show":"${fid}.${slug}","submission":"${fid}.${slug}.${sid}.${ac}"} color {"enable":true,"theme":"default"} icon {"theme":""} network {"concurrency":10,"delay":1} app "leetcode.cn"
[Themes] Colors blue,dark,default,molokai,orange,pink,solarized,solarized.light Icons ascii,default,win7
[Plugins] solution.discuss 2019.02.03 company 2017.12.18 cache default retry default leetcode.cn 2018.11.25 cookie.firefox 2018.11.19 leetcode default
➜ leetcode-cli-plugins leetcode plugin Active Name Version Desc ✘ solution.discuss 2019.02.03 Plugin to fetch most voted solution in discussions. ✘ company 2017.12.18 Plugin to query by company for free user. ✔ cache default Plugin to provide local cache. ✘ retry default Plugin to retry last failed request if autologin.enable is on. ✔ leetcode.cn 2018.11.25 Plugin to talk with leetcode-cn APIs. ✘ cookie.firefox 2018.11.19 Plugin to reuse firefox's leetcode cookie. ✔ leetcode default Plugin to talk with leetcode APIs.
➜ leetcode-cli-plugins leetcode user Premium User Host ✘ xhsj8125 https://leetcode-cn.com
➜ leetcode-cli-plugins leetcode list [ERROR] http error [code=400] ➜ leetcode-cli-plugins leetcode list -vv [TRACE] initializing all plugins [TRACE] found plugin: cache=default [TRACE] found plugin: company=2017.12.18 [TRACE] found plugin: cookie.firefox=2018.11.19 [TRACE] found plugin: leetcode.cn=2018.11.25 [TRACE] found plugin: leetcode=default [TRACE] found plugin: retry=default [TRACE] found plugin: solution.discuss=2019.02.03 [TRACE] inited plugin: leetcode [TRACE] skipped plugin: cookie.firefox [TRACE] inited plugin: leetcode.cn [TRACE] skipped plugin: retry [TRACE] inited plugin: cache [TRACE] skipped plugin: company [TRACE] skipped plugin: solution.discuss [DEBUG] running leetcode.getProblems ⠋ Downloading problems[DEBUG] running leetcode.getCategoryProblems: algorithms [TRACE] REQUEST %s { url: 'https://leetcode-cn.com/api/problems/algorithms/', headers: { Cookie:,
'X-CSRFToken': ,
'X-Requested-With': 'XMLHttpRequest' },
callback: [Function] }
[DEBUG] running leetcode.getCategoryProblems: database
[TRACE] REQUEST %s { url: 'https://leetcode-cn.com/api/problems/database/',
headers:
{ Cookie: ,
'X-CSRFToken': ,
'X-Requested-With': 'XMLHttpRequest' },
callback: [Function] }
[DEBUG] running leetcode.getCategoryProblems: shell
[TRACE] REQUEST %s { url: 'https://leetcode-cn.com/api/problems/shell/',
headers:
{ Cookie: ,
'X-CSRFToken': ,
'X-Requested-With': 'XMLHttpRequest' },
callback: [Function] }
[DEBUG] running leetcode.getCategoryProblems: concurrency
[TRACE] REQUEST %s { url: 'https://leetcode-cn.com/api/problems/concurrency/',
headers:
{ Cookie: ,
'X-CSRFToken': , 'X-Requested-With': 'XMLHttpRequest' }, callback: [Function] } [TRACE] REQUEST %s make request https://leetcode-cn.com/api/problems/algorithms/ [TRACE] REQUEST %s make request https://leetcode-cn.com/api/problems/database/ [TRACE] REQUEST %s make request https://leetcode-cn.com/api/problems/shell/ [TRACE] REQUEST %s make request https://leetcode-cn.com/api/problems/concurrency/ ⠸ Downloading category concurrency[TRACE] REQUEST %s onRequestResponse https://leetcode-cn.com/api/problems/concurrency/ 200 { server: 'nginx/1.17.8', date: 'Sun, 26 Jul 2020 00:56:57 GMT', 'content-type': 'text/html; charset=utf-8', 'content-length': '3496', connection: 'close', vary: 'Accept-Encoding, Authorization, Cookie, Origin', allow: 'GET, HEAD, OPTIONS', 'content-security-policy': 'frame-ancestors \'self\' https://*.leetcode.com https://leetcode.com https://*.leetcode-cn.com https://leetcode-cn.com https://*.lingkou.com https://lingkou.com https://tongji.baidu.com https://www.growingio.com https://*.leetcode.pro https://leetcode.pro',
'x-frame-options': 'DENY',
'strict-transport-security': 'max-age=15724800; includeSubDomains' }
[TRACE] REQUEST %s reading response's body
[TRACE] REQUEST %s finish init function https://leetcode-cn.com/api/problems/concurrency/
[TRACE] REQUEST %s response end https://leetcode-cn.com/api/problems/concurrency/ 200 { server: 'nginx/1.17.8',
date: 'Sun, 26 Jul 2020 00:56:57 GMT',
'content-type': 'text/html; charset=utf-8',
'content-length': '3496',
connection: 'close',
vary: 'Accept-Encoding, Authorization, Cookie, Origin',
allow: 'GET, HEAD, OPTIONS',
'content-security-policy': 'frame-ancestors \'self\' https://*.leetcode.com https://leetcode.com https://*.leetcode-cn.com https://leetcode-cn.com https://*.lingkou.com https://lingkou.com https://tongji.baidu.com https://www.growingio.com https://*.leetcode.pro https://leetcode.pro',
'x-frame-options': 'DENY',
'strict-transport-security': 'max-age=15724800; includeSubDomains' }
[TRACE] REQUEST %s end event https://leetcode-cn.com/api/problems/concurrency/
[TRACE] REQUEST %s has body https://leetcode-cn.com/api/problems/concurrency/ 3496
[TRACE] REQUEST %s emitting complete https://leetcode-cn.com/api/problems/concurrency/
[DEBUG] concurrency: getProblems got 9 problems
[TRACE] REQUEST %s onRequestResponse https://leetcode-cn.com/api/problems/algorithms/ 200 { server: 'nginx/1.17.8',
date: 'Sun, 26 Jul 2020 00:56:57 GMT',
'content-type': 'text/html; charset=utf-8',
'content-length': '526463',
connection: 'close',
vary: 'Accept-Encoding, Authorization, Cookie, Origin',
allow: 'GET, HEAD, OPTIONS',
'content-security-policy': 'frame-ancestors \'self\' https://*.leetcode.com https://leetcode.com https://*.leetcode-cn.com https://leetcode-cn.com https://*.lingkou.com https://lingkou.com https://tongji.baidu.com https://www.growingio.com https://*.leetcode.pro https://leetcode.pro',
'x-frame-options': 'DENY',
'strict-transport-security': 'max-age=15724800; includeSubDomains' }
[TRACE] REQUEST %s reading response's body
[TRACE] REQUEST %s finish init function https://leetcode-cn.com/api/problems/algorithms/
[TRACE] REQUEST %s onRequestResponse https://leetcode-cn.com/api/problems/shell/ 200 { server: 'nginx/1.17.8',
date: 'Sun, 26 Jul 2020 00:56:57 GMT',
'content-type': 'text/html; charset=utf-8',
'content-length': '1575',
connection: 'close',
vary: 'Accept-Encoding, Authorization, Cookie, Origin',
allow: 'GET, HEAD, OPTIONS',
'content-security-policy': 'frame-ancestors \'self\' https://*.leetcode.com https://leetcode.com https://*.leetcode-cn.com https://leetcode-cn.com https://*.lingkou.com https://lingkou.com https://tongji.baidu.com https://www.growingio.com https://*.leetcode.pro https://leetcode.pro',
'x-frame-options': 'DENY',
'strict-transport-security': 'max-age=15724800; includeSubDomains' }
[TRACE] REQUEST %s reading response's body
[TRACE] REQUEST %s finish init function https://leetcode-cn.com/api/problems/shell/
[TRACE] REQUEST %s response end https://leetcode-cn.com/api/problems/shell/ 200 { server: 'nginx/1.17.8',
date: 'Sun, 26 Jul 2020 00:56:57 GMT',
'content-type': 'text/html; charset=utf-8',
'content-length': '1575',
connection: 'close',
vary: 'Accept-Encoding, Authorization, Cookie, Origin',
allow: 'GET, HEAD, OPTIONS',
'content-security-policy': 'frame-ancestors \'self\' https://*.leetcode.com https://leetcode.com https://*.leetcode-cn.com https://leetcode-cn.com https://*.lingkou.com https://lingkou.com https://tongji.baidu.com https://www.growingio.com https://*.leetcode.pro https://leetcode.pro',
'x-frame-options': 'DENY',
'strict-transport-security': 'max-age=15724800; includeSubDomains' }
[TRACE] REQUEST %s end event https://leetcode-cn.com/api/problems/shell/
[TRACE] REQUEST %s has body https://leetcode-cn.com/api/problems/shell/ 1575
[TRACE] REQUEST %s emitting complete https://leetcode-cn.com/api/problems/shell/
[DEBUG] shell: getProblems got 4 problems
⠼ Downloading category concurrency[TRACE] REQUEST %s onRequestResponse https://leetcode-cn.com/api/problems/database/ 200 { server: 'nginx/1.17.8',
date: 'Sun, 26 Jul 2020 00:56:57 GMT',
'content-type': 'text/html; charset=utf-8',
'content-length': '44600',
connection: 'close',
vary: 'Accept-Encoding, Authorization, Cookie, Origin',
allow: 'GET, HEAD, OPTIONS',
'content-security-policy': 'frame-ancestors \'self\' https://*.leetcode.com https://leetcode.com https://*.leetcode-cn.com https://leetcode-cn.com https://*.lingkou.com https://lingkou.com https://tongji.baidu.com https://www.growingio.com https://*.leetcode.pro https://leetcode.pro',
'x-frame-options': 'DENY',
'strict-transport-security': 'max-age=15724800; includeSubDomains' }
[TRACE] REQUEST %s reading response's body
[TRACE] REQUEST %s finish init function https://leetcode-cn.com/api/problems/database/
[TRACE] REQUEST %s response end https://leetcode-cn.com/api/problems/database/ 200 { server: 'nginx/1.17.8',
date: 'Sun, 26 Jul 2020 00:56:57 GMT',
'content-type': 'text/html; charset=utf-8',
'content-length': '44600',
connection: 'close',
vary: 'Accept-Encoding, Authorization, Cookie, Origin',
allow: 'GET, HEAD, OPTIONS',
'content-security-policy': 'frame-ancestors \'self\' https://*.leetcode.com https://leetcode.com https://*.leetcode-cn.com https://leetcode-cn.com https://*.lingkou.com https://lingkou.com https://tongji.baidu.com https://www.growingio.com https://*.leetcode.pro https://leetcode.pro',
'x-frame-options': 'DENY',
'strict-transport-security': 'max-age=15724800; includeSubDomains' }
[TRACE] REQUEST %s end event https://leetcode-cn.com/api/problems/database/
[TRACE] REQUEST %s has body https://leetcode-cn.com/api/problems/database/ 44600
[TRACE] REQUEST %s emitting complete https://leetcode-cn.com/api/problems/database/
[DEBUG] database: getProblems got 120 problems
⠦ Downloading category concurrency[TRACE] REQUEST %s response end https://leetcode-cn.com/api/problems/algorithms/ 200 { server: 'nginx/1.17.8',
date: 'Sun, 26 Jul 2020 00:56:57 GMT',
'content-type': 'text/html; charset=utf-8',
'content-length': '526463',
connection: 'close',
vary: 'Accept-Encoding, Authorization, Cookie, Origin',
allow: 'GET, HEAD, OPTIONS',
'content-security-policy': 'frame-ancestors \'self\' https://*.leetcode.com https://leetcode.com https://*.leetcode-cn.com https://leetcode-cn.com https://*.lingkou.com https://lingkou.com https://tongji.baidu.com https://www.growingio.com https://*.leetcode.pro https://leetcode.pro',
'x-frame-options': 'DENY',
'strict-transport-security': 'max-age=15724800; includeSubDomains' }
[TRACE] REQUEST %s end event https://leetcode-cn.com/api/problems/algorithms/
[TRACE] REQUEST %s has body https://leetcode-cn.com/api/problems/algorithms/ 526463
[TRACE] REQUEST %s emitting complete https://leetcode-cn.com/api/problems/algorithms/
[DEBUG] algorithms: getProblems got 1410 problems
[DEBUG] running leetcode.cn.getProblemNames
⠋ Downloading questions titles[TRACE] REQUEST %s { url: 'https://leetcode-cn.com/graphql',
headers:
{ Cookie: ,
'X-CSRFToken': ,
'X-Requested-With': 'XMLHttpRequest',
Origin: 'https://leetcode-cn.com',
Referer: 'https://leetcode-cn.com/api/problems/algorithms/' },
json: true,
body:
{ query: 'query getQuestionTranslation($lang: String) {\n translations: allAppliedQuestionTranslations(lang: $lang) {\n title\n question {\n questionId\n }\n }\n}\n',
variables: {},
operationName: 'getQuestionTranslation' },
callback: [Function],
method: 'POST' }
[TRACE] REQUEST %s make request https://leetcode-cn.com/graphql
⠹ Downloading questions titles[TRACE] REQUEST %s onRequestResponse https://leetcode-cn.com/graphql 400 { server: 'nginx/1.17.8',
date: 'Sun, 26 Jul 2020 00:56:58 GMT',
'content-type': 'application/json',
'content-length': '159',
connection: 'close',
vary: 'Cookie, Authorization, Origin',
'content-security-policy': 'frame-ancestors \'self\' https://*.leetcode.com https://leetcode.com https://*.leetcode-cn.com https://leetcode-cn.com https://*.lingkou.com https://lingkou.com https://tongji.baidu.com https://www.growingio.com https://*.leetcode.pro https://leetcode.pro',
'x-frame-options': 'DENY',
'access-control-allow-credentials': 'true',
'set-cookie':