leetgo: [Bug] FATA failed to get question data: no cookie found in browser
Verification steps
- 我已经在 Issue Tracker 和 Discussion 中找过我要提出的问题 I have searched on the issue tracker and Discussion for a related issue.
leetgo config
language: zh
code:
lang: go
leetcode:
site: https://leetcode.cn
# credentials:
# from: browser
#editor:
# use: none
Debug log
2023/06/08 09:39:49 DEBU cache loaded path=/Users/ding/.config/leetgo/cache/leetcode-questions.db time="962.899µs"
2023/06/08 09:39:49 INFO reading cookies from browser domain=leetcode.cn
2023/06/08 09:39:49 DEBU finished read cookies from browser elapsed=9.75268ms
2023/06/08 09:39:49 FATA failed to get question data: no cookie found in browser
Description
I have already login in browser, but the cli cannot get cookie.
The bug both appears on leetcode.cn and leetcode.com
Steps
go install github.com/j178/leetgo@latest
mkdir demo
cd demo
leetgo init -t cn -l go
leetgo pick 1
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 15 (8 by maintainers)
The root cause is that Chrome open its Cookie file in the exclusive mode (set
dwShareMode
to 0 inCreateFileW
), so Windows prevents any process to access the file again.This problem is specific to Windows and cannot be addressed directly by
leetgo
.But I have a workaround. I log into LeetCode using an alertnate browser such as Edge, but I mainly use Chrome, so when I use leetgo, it can read cookies from Edge since it is not running.