bonfy/leetcode

self._load_solution_language() error

Closed this issue · 4 comments

Leetcode login
Traceback (most recent call last):
line 461, in
main()
line 441, in main
leetcode.load()
line 247, in load
self._load_solution_language()
line 200, in _load_solution_language
assert r.status_code == 200
AssertionError

the py script is not work?

bonfy commented

@fancymax I'm fixing it now.Almost done, maybe this weekend can release the new version(can't promise).

the reason was leetcode change his website:

  1. the way to login. the csrftoken encrypt
  2. submissions change from HTML to JSON

@bonfy thank you very much,👍

bonfy commented

@fancymax

It can work now.But should install two more things

PhantomJS and selenium

Mac can Install PhantomJS by Homebrew, selenium can pip install

I use selenium and PhantomJS to login first and save the cookies to a local file. Then pass the cookies to requests.

It's not the best way I think, but I can't find the algorithm Leetcode encrypt the csrftoken...

@bonfy thanks very much,it works right.