j178 / leetgo

Best LeetCode friend for geek. :snowboarder:
MIT License
540 stars 32 forks source link

[Bug] #314

Open YZBPXX opened 1 week ago

YZBPXX commented 1 week ago

leetgo debug

Leetgo version info :

1.4.7
commit: e3526393204f8e1f76d5bca163708b89b4e96220
built at: 2024-05-09T11:21:13Z
goos: darwin
goarch: amd64

Home dir : /Users/yzb/.config/leetgo Project root : /Users/yzb/.config/python Working dir : /Users/yzb/.config/python Project config file : /Users/yzb/.config/python/leetgo.yaml Project configuration:

# Leetgo configuration file, see more at https://github.com/j178/leetgo

# Your name
author: yzbpxx
# Language of the question description: 'zh' (Simplified Chinese) or 'en' (English).
language: zh
code:
  # Language of code generated for questions: go, cpp, python, java...
  # (will be overridden by command line flag -l/--lang).
  lang: go
  # The default template to generate filename (without extension), e.g. {{.Id}}.{{.Slug}}
  # Available attributes: Id, Slug, Title, Difficulty, Lang, SlugIsMeaningful
  # (Most questions have descriptive slugs, but some consist of random characters. The SlugIsMeaningful boolean indicates whether a slug is meaningful.)
  # Available functions: lower, upper, trim, padWithZero, toUnderscore, group.
  filename_template: '{{ .Id | padWithZero 4 }}{{ if .SlugIsMeaningful }}.{{ .Slug }}{{ end }}'
  # Generate question description into a separate question.md file, otherwise it will be embed in the code file.
  separate_description_file: true
  # Default modifiers for all languages.
  modifiers:
    - name: removeUselessComments
  go:
    # Base directory to put generated questions, defaults to the language slug, e.g. go, python, cpp.
    out_dir: go
    # Functions that modify the generated code.
    modifiers:
      - name: removeUselessComments
      - name: changeReceiverName
      - name: addNamedReturn
      - name: addMod
  python3:
    # Base directory to put generated questions, defaults to the language slug, e.g. go, python, cpp.
    out_dir: python
    # Path to the python executable that creates the venv.
    executable: python3
  cpp:
    # Base directory to put generated questions, defaults to the language slug, e.g. go, python, cpp.
    out_dir: cpp
    # C++ compiler
    cxx: g++
    # C++ compiler flags (our Leetcode I/O library implementation requires C++17).
    cxxflags: -O2 -std=c++17
  rust:
    # Base directory to put generated questions, defaults to the language slug, e.g. go, python, cpp.
    out_dir: rust
  java:
    # Base directory to put generated questions, defaults to the language slug, e.g. go, python, cpp.
    out_dir: java
leetcode:
  # LeetCode site, https://leetcode.com or https://leetcode.cn
  site: https://leetcode.cn
  # Credentials to access LeetCode.
  credentials:
    # How to provide credentials: browser, cookies, password or none.
    from: browser
    # Browsers to get cookies from: chrome, safari, edge or firefox. If empty, all browsers will be tried. Only used when 'from' is 'browser'.
    browsers: []
contest:
  # Base directory to put generated contest questions.
  out_dir: contest
  # Template to generate filename of the question.
  filename_template: '{{ .ContestShortSlug }}/{{ .Id }}{{ if .SlugIsMeaningful }}.{{ .Slug }}{{ end }}'
  # Open the contest page in browser after generating.
  open_in_browser: true
# Editor settings to open generated files.
editor:
  # Use a predefined editor: vim, vscode, goland
  # Set to 'none' to disable, set to 'custom' to provide your own command and args.
  use: none
  # Custom command to open files.
  command: ""
  # Arguments to your custom command.
  # String contains {{.CodeFile}}, {{.TestFile}}, {{.DescriptionFile}}, {{.TestCasesFile}} will be replaced with corresponding file path.
  # {{.Folder}} will be substituted with the output directory.
  # {{.Files}} will be substituted with the list of all file paths.
  args: ""

Full configuration :

author: yzbpxx
language: zh
code:
  lang: go
  filename_template: '{{ .Id | padWithZero 4 }}{{ if .SlugIsMeaningful }}.{{ .Slug }}{{ end }}'
  separate_description_file: true
  modifiers:
    - name: removeUselessComments
  go:
    out_dir: go
    modifiers:
      - name: removeUselessComments
      - name: changeReceiverName
      - name: addNamedReturn
      - name: addMod
  python3:
    out_dir: python
    executable: python3
  cpp:
    out_dir: cpp
    cxx: g++
    cxxflags: -O2 -std=c++17
  rust:
    out_dir: rust
  java:
    out_dir: java
leetcode:
  site: https://leetcode.cn
  credentials:
    from: browser
    browsers: []
contest:
  out_dir: contest
  filename_template: '{{ .ContestShortSlug }}/{{ .Id }}{{ if .SlugIsMeaningful }}.{{ .Slug }}{{ end }}'
  open_in_browser: true
editor:
  use: none
  command: ""
  args: ""

Debug log

2024/11/19 10:11:49 INFO config file created file=leetgo.yaml
2024/11/19 10:11:49 DEBU reading cookies browser=safari file=/Users/yzb/Library/Containers/com.apple.Safari/Data/Library/Cookies/Cookies.binarycookies
2024/11/19 10:11:49 DEBU reading cookies browser=chrome file="/Users/yzb/Library/Application Support/Google/Chrome/Default/Network/Cookies"
2024/11/19 10:11:49 DEBU reading cookies browser=chrome file="/Users/yzb/Library/Application Support/Google/Chrome/Default/Cookies"
2024/11/19 10:11:49 INFO read LeetCode cookies browser=chrome domain=leetcode.cn
2024/11/19 10:11:49 net/http: invalid byte '¹' in Cookie.Value; dropping invalid bytes
2024/11/19 10:11:49 net/http: invalid byte '¹' in Cookie.Value; dropping invalid bytes
2024/11/19 10:11:49 DEBU finished reading cookies elapsed=49.163992ms
2024/11/19 10:11:49 DEBU request method=POST url=https://leetcode.cn/graphql
  body=
  │ {"operationName":"AllQuestionUrls","query":"\n\tquery AllQuestionUrls {\n\t\tallQuestionUrls {\n\t\t\tquestionUrl\n\t\t}\n\t}\n\t","variables":{}}

2024/11/19 10:11:49 WARN retry url=https://leetcode.cn/graphql attempt=0 error="Post \"https://leetcode.cn/graphql\": net/http: invalid header field value for \"X-Csrftoken\""
2024/11/19 10:11:49 WARN retry url=https://leetcode.cn/graphql attempt=1 error="Post \"https://leetcode.cn/graphql\": net/http: invalid header field value for \"X-Csrftoken\""
2024/11/19 10:11:49 WARN retry url=https://leetcode.cn/graphql attempt=2 error="Post \"https://leetcode.cn/graphql\": net/http: invalid header field value for \"X-Csrftoken\""
2024/11/19 10:11:49 FATA Post "https://leetcode.cn/graphql": net/http: invalid header field value for "X-Csrftoken"

Description

above