leechcode
leechcode copied to clipboard
Python script to fetch details about leetcode questions for planning interview preparation
leechcode
Python script to fetch details about leetcode questions useful for planning interview preparation.
I have created a Google Sheet using this data, this might be useful for last moment preparation as well as revision. Hope you find it useful.
How to use this sheet?
- First of all
Make a copy
of the sheet from theFile
option. - I have sorted the values according to the Wilson Score [Source] which is a better metric to rate something compared to a simple ratio.
- All the best for your interviews!
The script
If you want to try this out on your own, keep reading.
How to use the script?
We basically need to send requests to the server as an authenticated user so we have to find those details.
- Login to leetcode and go to any problem.
- Open the Network panel ( Ctrl + Shift + E ) and reload.
- Search for a
graphql
request in the big list, a small window will open to the right. - Click the
Headers
and scroll to find theRequest Headers
. - Copy below 2 values from here and paste them in the code
-
Cookie
-
x-csrftoken
-
- Run the code
python3 leech.py
.
How to edit/clean the data?
Use the Pandas library to modify the data as it is very convenient.