skygragon / leetcode-cli

A cli tool to enjoy leetcode!
MIT License
3.65k stars 458 forks source link

faild to show problem #105

Closed z1shiki closed 6 years ago

z1shiki commented 6 years ago

Problem Summary

I can't show any question.I used nvm to update my node.js from v8.9.3 to v8.11.2. I had reinstall leetcode-cli and tried to switch node version but failed.

How to reproduce

PS C:\workplace\leetcode> leetcode show 42 -g -x -vv
[TRACE] initializing all plugins
[TRACE] found plugin: cache=default
[TRACE] inited plugin: cache
[TRACE] found plugin: leetcode=default
[TRACE] inited plugin: leetcode
[TRACE] found plugin: retry=default
[TRACE] inited plugin: retry
[TRACE] missing plugins: 0
[DEBUG] cache hit: problems.json
[DEBUG] running leetcode.getProblem
- Downloading trapping-rain-water[TRACE] REQUEST %s { url: 'https://leetcode.com/graphql',
  headers:
   { Cookie: <hidden>,
     'X-CSRFToken': <hidden>,
     'X-Requested-With': 'XMLHttpRequest',
     Origin: 'https://leetcode.com',
     Referer: 'https://leetcode.com/problems/trapping-rain-water/description/' },
  json: true,
  body:
   { query: 'query getQuestionDetail($titleSlug: String!) {\n  question(titleSlug: $titleSlug) {\n    content\n    stats\n    codeDefinition\n    sampleTestCase\n    enableRunCode\n    metaData\n    discussCategoryId\n  }\n}',
     variables: { titleSlug: 'trapping-rain-water' },
     operationName: 'getQuestionDetail' },
  callback: [Function],
  method: 'POST' }
[TRACE] REQUEST %s make request https://leetcode.com/graphql
- Downloading trapping-rain-water[TRACE] REQUEST %s onRequestResponse https://leetcode.com/graphql 400 { date: 'Tue, 29 May 2018 05:16:20 GMT',
  'content-type': 'application/json',
  'content-length': '129',
  connection: 'close',
  'set-cookie':
   [cookie ],

[TRACE] REQUEST %s reading response's body
[TRACE] REQUEST %s finish init function https://leetcode.com/graphql
[TRACE] REQUEST %s response end https://leetcode.com/graphql 400 { date: 'Tue, 29 May 2018 05:16:20 GMT',
  'content-type': 'application/json',
  'content-length': '129',
  connection: 'close',
  'set-cookie':
   [ cookie],

[TRACE] REQUEST %s end event https://leetcode.com/graphql
[TRACE] REQUEST %s has body https://leetcode.com/graphql 129
[TRACE] REQUEST %s emitting complete https://leetcode.com/graphql
[DEBUG] http error: 400
[ERROR] http error [400]

Environment

skygragon commented 6 years ago

please update to the latest leetcode-cli 2.5.2

npm install -g leetcode-cli
skygragon commented 6 years ago

duplicated to #100

z1shiki commented 6 years ago

The latest version slove this problem