Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugins.nicolive: Niconico login broken (404) #4539

Closed
3 of 4 tasks
cddb222 opened this issue May 22, 2022 · 15 comments · Fixed by #4553
Closed
3 of 4 tasks

plugins.nicolive: Niconico login broken (404) #4539

cddb222 opened this issue May 22, 2022 · 15 comments · Fixed by #4553
Labels
plugin issue A Plugin does not work correctly

Comments

@cddb222
Copy link

cddb222 commented May 22, 2022

Checklist

Streamlink version

Latest build from the master branch

Description

The niconico function using login is broken. This error is shown:
404 Client Error: Not Found for url: https://account.nicovideo.jp/

The plugin seems to be pointing to https://account.nicovideo.jp/login/redirector which does not work anymore.
Pointing to https://account.nicovideo.jp/login instead should solve the issue.

Debug log

Used syntax:
streamlink -o "output.ts" https://live.nicovideo.jp/watch/[video-ID] best --niconico-email [mailaddress] --niconico-password [PW]
@cddb222 cddb222 added the plugin issue A Plugin does not work correctly label May 22, 2022
@bastimeyer
Copy link
Member

Post the entire output when setting the --loglevel=debug parameter.

The nicolive email logins were fixed recently in #4380. This looks like you're not using the latest version.

@bastimeyer bastimeyer changed the title Niconico login broken (404) plugins.nicolive: Niconico login broken (404) May 22, 2022
@cddb222
Copy link
Author

cddb222 commented May 22, 2022

Post the entire output when setting the --loglevel=debug parameter.

The nicolive email logins were fixed recently in #4380. This looks like you're not using the latest version.

Full log:

[cli][debug] OS:         Windows 10
[cli][debug] Python:     3.8.10
[cli][debug] Streamlink: 4.0.1
[cli][debug] Requests(2.27.1), Socks(1.7.1), Websocket(1.3.2)
[cli][debug] Arguments:
[cli][debug]  url=https://live.nicovideo.jp/watch/lv336832924
[cli][debug]  stream=['best']
[cli][debug]  --loglevel=debug
[cli][debug]  --output=output.ts
[cli][debug]  --ffmpeg-ffmpeg=C:\Users\xxx\AppData\Local\Streamlink\ffmpeg\ffmpeg.exe
[cli][debug]  --niconico-email=********
[cli][debug]  --niconico-password=********
[cli][info] Found matching plugin nicolive for URL https://live.nicovideo.jp/watch/lv336832924
[plugins.nicolive][info] Logging in via provided email and password
[plugins.nicolive][debug] unknown input: None
[plugins.nicolive][debug] unknown input: None
error: Unable to open URL: https://account.nicovideo.jp (404 Client Error: Not Found for url: https://account.nicovideo.jp/)

The video itself will only be available for a couple more hours, you might have to test with a different one on live.nicovideo.jp

I tested with both, latest stable, as well as latest nightly.

@bastimeyer
Copy link
Member

I can't reproduce this.

Invalid logins get caught, valid logins via email that require a confirmation code are working fine, and so are cached session cookies after a successful login.

Apart from that, the stream URL doesn't seem to require a login.

[plugins.nicolive][info] Logging in via provided email and password
[plugins.nicolive][debug] unknown input: None
[plugins.nicolive][debug] unknown input: None
error: Unable to open URL: https://account.nicovideo.jp/ (404 Client Error: Not Found for url: https://account.nicovideo.jp/)

This looks like you're seeing a different page after trying to logging in which the plugin can't handle. This might be caused by regional differences.

@cddb222
Copy link
Author

cddb222 commented May 22, 2022

I can't reproduce this.

Invalid logins get caught, valid logins via email that require a confirmation code are working fine, and so are cached session cookies after a successful login.

Apart from that, the stream URL doesn't seem to require a login.

[plugins.nicolive][info] Logging in via provided email and password
[plugins.nicolive][debug] unknown input: None
[plugins.nicolive][debug] unknown input: None
error: Unable to open URL: https://account.nicovideo.jp/ (404 Client Error: Not Found for url: https://account.nicovideo.jp/)

This looks like you're seeing a different page after trying to logging in which the plugin can't handle. This might be caused by regional differences.

The video has a "members-only" part in the second half that is not shown if you are a guest/non-member user. This is a "timeshift" archive video of a live-stream.
Regional should not be an issue, since I am accessing from Japan.

Please see line 161 in this file:
https://github.com/streamlink/streamlink/blob/master/src/streamlink/plugins/nicolive.py
The link "https://account.nicovideo.jp/login/redirector" when accessed from browser is giving the error straight away. Like mentioned in OP, changing this to https://account.nicovideo.jp/login might solve the issue. (I cannot do commits, sorry)

@bastimeyer
Copy link
Member

https://account.nicovideo.jp/login/redirector is the target of the login form of https://account.nicovideo.jp/login, and it requires a POST request with the mail_tel and password parameters. The plugin is doing this correctly, as you can see here:

root = self.session.http.post(
self.LOGIN_URL,
data={"mail_tel": email, "password": password},
params=self.LOGIN_URL_PARAMS,
schema=validate.Schema(validate.parse_html()))

As said, the issue is caused by the response of this request, which looks to be different in certain cases.

@back-to
Copy link
Collaborator

back-to commented May 22, 2022

works with an IP from Europe,
does not work with an IP from Japan.

Plugin needs some changes.

@cddb222
Copy link
Author

cddb222 commented May 30, 2022

@bastimeyer
Is this already part of the nightly build? Still getting the same issue with nightly #69 from here: https://github.com/streamlink/windows-installer/actions?query=event%3Aschedule+is%3Asuccess+branch%3Amaster

@bastimeyer
Copy link
Member

@cddb222
Post the entire debug log output (--loglevel=debug) and set --niconico-purge-credentials.

@cddb222
Copy link
Author

cddb222 commented May 30, 2022

@bastimeyer

Used syntax:
streamlink -o "output.ts" https://live.nicovideo.jp/watch/lv337000198 best --niconico-purge-credentials --niconico-email a@b.com --niconico-password abc --loglevel=debug

Debug output:

[cli][debug] OS:         Windows 10
[cli][debug] Python:     3.8.10
[cli][debug] Streamlink: 4.0.1
[cli][debug] Requests(2.27.1), Socks(1.7.1), Websocket(1.3.2)
[cli][debug] Arguments:
[cli][debug]  url=https://live.nicovideo.jp/watch/lv337000198
[cli][debug]  stream=['best']
[cli][debug]  --loglevel=debug
[cli][debug]  --output=output.ts
[cli][debug]  --ffmpeg-ffmpeg=C:\Users\xxx\AppData\Local\Streamlink\ffmpeg\ffmpeg.exe
[cli][debug]  --niconico-email=********
[cli][debug]  --niconico-password=********
[cli][debug]  --niconico-purge-credentials=True
[plugins.nicolive][debug] Restored cookies: mfa_session, nicosid, user_session, user_session_secure, mfa_trusted_device_token
[cli][info] Found matching plugin nicolive for URL https://live.nicovideo.jp/watch/lv337000198
[plugins.nicolive][info] All credentials were successfully removed
[plugins.nicolive][info] Logging in via provided email and password
[plugins.nicolive][debug] unknown input: None
[plugins.nicolive][debug] unknown input: None
error: Unable to open URL: https://account.nicovideo.jp (404 Client Error: Not Found for url: https://account.nicovideo.jp/)

@bastimeyer
Copy link
Member

[cli][debug] Streamlink: 4.0.1

You are not using the latest version.

@cddb222
Copy link
Author

cddb222 commented May 30, 2022

@bastimeyer
Copy link
Member

It is not, as you can clearly see in the debug log. If you're having trouble with this, and it seems like you're having two parallel installs on your Windows system, then uninstall everything first before you install the nightly build.
https://streamlink.github.io/latest/install.html

The version must look similar to this

[cli][debug] OS:         Linux-5.18.0-1-git-x86_64-with-glibc2.35
[cli][debug] Python:     3.10.4
[cli][debug] Streamlink: 4.0.1+56.g57640d3a
[cli][debug] Requests(2.27.1), Socks(1.7.1), Websocket(1.3.2)

Or wait for the 4.1.0 release, which has been queued and will be released soon.

@cddb222
Copy link
Author

cddb222 commented May 30, 2022

@bastimeyer
It's not a parallel install, this is the default installation on Windows:
grafik

And this is the actual nightly version, for some reason the debug output does not show the latest build number on Windows, just uninstalled, rebooted and re-installed and tested again, it still says [cli][debug] Streamlink: 4.0.1

@bastimeyer
Copy link
Member

Whenever you execute a program name without an absolute or relative path, like streamlink instead of C:\path\to\streamlink.exe for exampe, your shell first needs to resolve the full path before it can execute it. This is done via the PATH environment variable. Depending on the contents of the PATH env var, a different streamlink.exe can get resolved first. Check your PATH env var by executing echo %PATH% or echo $env:PATH (depending on whether you're using cmd or powershell) to see which paths are defined. where streamlink or (get-command streamlink).Path will also show you the resolved path.
https://github.com/streamlink/windows-installer#notes

If the debug log is showing version 4.0.1 and not 4.0.1+N.gXXXXXXX, then you are not using a nightly build and a stable release instead. Simple as that. This is deterministic and not "for some reason" an unknown issue. You must have installed the stable release. As I already told you, you should uninstall everything (both versions) if you're having trouble running the right version.

Since your streamlink install path is in your home directory, this suggests that there may be a system-wide streamlink install in parallel on your system (C:\Program Files\ or C:\Program Files (x86)\) which gets resolved first, because its path is registered first in the PATH env var.

The latest nightly build shows the following debug output, which I have just checked in my Windows VM:

$ streamlink -l debug
[cli][debug] OS:         Windows 10
[cli][debug] Python:     3.10.3
[cli][debug] Streamlink: 4.0.1+55.g42f1112

In the pull request where I pinged you and asked if you could verify the plugin changes, I also suggested sideloading the updated plugin, so you don't need to install a separate nightly build. This is another option you have for running the latest version of the plugin.

This is all I can do for you to help you resolve your setup issues and I have given you enough hints on how to solve them. I don't want to spend more time on some user's setup issues. Good luck.

@cddb222
Copy link
Author

cddb222 commented May 30, 2022

@bastimeyer
Thank you for the extensive reply, and my apologies for causing confusion.

Thanks to your advice I found an additional version of Streamlink within the Python folder, which also was part of the system path and took priority over the nightly regular install.
I wiped all Python and Streamlink files and made a completely fresh installation.

I can confirm the bug is fixed with the latest nightly, login is working as expected. Verified with a video that has a members-only part in the second half and was able to get the full video via Streamlink.

Again, my apologies for making you provide additional support, much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin issue A Plugin does not work correctly
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants