Generate a nicely formatted leetcode solution of a developer from his profile and also fetch articles if he submitted in the solution.
git clone https://github.com/chapimenge3/leetcode-profiler
Before using it we need to provide LEETCODE SESSION.
-
Login to leetcode
-
Open developer tools(F12 or right click and inspect)
-
Go to Application tab(Chrome) or Storage tab(Firefox)
-
Click on Cookies > https://leetcode.com
-
Copy the value of
LEETCODE_SESSION
-
run this command in the current terminal
export LEETCODE_SESSION=<value>
-
Now you can use the script using
python3 main.py
NOTE: As of now the script only works if you provide the LEETCODE_SESSION
in the same terminal. If you close the terminal you need to provide the LEETCODE_SESSION
again.
You can also export the username and password as well.
export LEETCODE_USERNAME=<username>
export LEETCODE_PASSWORD=<password>
One last environment is logging. The default logging level is INFO
. You can change it to DEBUG
if you want to see the debug logs.
export LOG_LEVEL=DEBUG
You can find the demo Generated files in here or click chapi
folder in the root directory.
The folder structure is as follows
├── username
| ├── README.md
| ├── solutions
| | ├── question
| | | ├── solution.py
| | | ├── README.md
| | | ├── article.md(TODO)
- Login the user using username and password
- Fetching the articles and adding it to the solution
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.