leetcode-cli
Installing
# Required dependencies:
#
# gcc
# libssl-dev
# libdbus-1-dev
# libsqlite3-dev
Usage
Make sure you have logged in to leetcode.com
with Chrome
. See Cookies for why you need to do this first.
)
Example
For example, given this config (could be found at ~/.leetcode/leetcode.toml
):
[]
= 'emacs'
# Optional parameter
= ['-nw']
= 'rust'
[]
= '<your-leetcode-csrf-token>'
= '<your-leetcode-session-key>'
[]
= 'Problems'
= 'code'
= '~/.leetcode'
= 'scripts'
1. pick
2. edit
# ;
3. test
4. exec
Cookies
The cookie plugin of leetcode-cli can work on OSX and Linux. If you are on a different platform, there are problems with caching the cookies, you can manually input your LeetCode Cookies to the configuration file.
[]
= "..."
= "..."
For Example, using Chrome (after logging in to LeetCode):
Step 1
Open Chrome and navigate to the link below:
chrome://settings/cookies/detail?site=leetcode.com
Step 2
Copy Content
from LEETCODE_SESSION
and csrftoken
to session
and csrf
in your configuration file, respectively:
[]
= "${csrftoken}"
= "${LEETCODE_SESSION}"
Programmable
If you want to filter LeetCode questions using custom Python scripts, add the following to your the configuration file:
[]
= "scripts"
Then write the script:
# ~/.leetcode/scripts/plan1.py
;
##
# `print` in python is supported,
# if you want to know the data structures of these two args,
# just print them
##
=
=
=
=
= ;
# return is `List[string]`
return
Then run list
with the filter that you just wrote:
That's it! Enjoy!
Contributions
Feel free to add your names and emails in the authors
field of Cargo.toml
!
LICENSE
MIT