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.
- 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!
If you want to try this out on your own, keep reading.
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
.
Use the Pandas library to modify the data as it is very convenient.