AlexAplin / nndownload

Download and process links from Niconico (nicovideo.jp)
MIT License
213 stars 28 forks source link

Nico new (forced) 2-factor login #118

Closed fireattack closed 2 years ago

fireattack commented 2 years ago

When I tried to login today, Niconico asked me to input the verification code sent to my email (it did send), which obviously nndownload didn't handle well.

This is probably something new, as I've never seen it before.

Logging in...
Failed to login.
Traceback (most recent call last):
  File "G:\_temp\nndownload\nndownload\nndownload.py", line 1757, in main
    session = login(account_username, account_password, session_cookie)
  File "G:\_temp\nndownload\nndownload\nndownload.py", line 1647, in login
    raise AuthenticationException("Failed to login. Please verify your account email/telephone and password")
nndownload.nndownload.AuthenticationException: Failed to login. Please verify your account email/telephone and password
fireattack commented 2 years ago

The webpage looks like this:

image

AlexAplin commented 2 years ago

Flow:

Trusting the device seems to do nothing for me, I'm prompted for a code each time. Maybe related to browser privacy fingerprinting.

AlexAplin commented 2 years ago

Basic scaffolding for this is done. Further detail:

AlexAplin commented 2 years ago

@fireattack Can you try with the branch and tell me how it works for you?

fireattack commented 2 years ago

Looks good to me!

Given the circumstance, should we start considering saving session or session cookie (even by default, but at least having option) so we can re-use it without re-entering the code every time?

AlexAplin commented 2 years ago

Great! That also seems like a good idea -- probably a dedicated file similar to how we do --netrc but likely user-specified. I'll consider how to approach that.