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

Fails to find nsig function #36

Closed
fpletz opened this issue Dec 9, 2024 · 23 comments
Closed

Fails to find nsig function #36

fpletz opened this issue Dec 9, 2024 · 23 comments
Labels
bug Something isn't working

Comments

@fpletz
Copy link

fpletz commented Dec 9, 2024

Bug fixed upstream. Update your containers.


Tried with different source IPs (residential, data center, VPN) and environments (NixOS, official Docker image).

Log:

[2024-12-09T18:16:24Z INFO  inv_sig_helper_rust] Fetching player
[2024-12-09T18:16:25Z INFO  inv_sig_helper_rust::player] Fetching player JS URL: https://www.youtube.com/s/player/3bb1f723/player_ias.vflset/en_US/base.js
[2024-12-09T18:16:25Z WARN  inv_sig_helper_rust::player] nsig function ending did not work: =\s*function(\([\w]+\)\{\s*var\s+[\w\s]+=[\w\.\s]+?\.call\s*\([\w\s$]+?,[\(\)\",\s]+\)[\S\s]*?\}\s*return [\w\.\s$]+?\.call\s*\([\w\s$]+?\s*,[\(\)\",\s]+\)\s*\}\s*;)
thread 'main' panicked at src/player.rs:150:10:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@MrLego8-9
Copy link

Complete trace

inv_sig_helper-1  | [2024-12-09T18:15:58Z INFO  inv_sig_helper_rust] Fetching player
inv_sig_helper-1  | [2024-12-09T18:15:59Z INFO  inv_sig_helper_rust::player] Fetching player JS URL: https://www.youtube.com/s/player/3bb1f723/player_ias.vflset/en_US/base.js
inv_sig_helper-1  | [2024-12-09T18:15:59Z WARN  inv_sig_helper_rust::player] nsig function ending did not work: =\s*function(\([\w]+\)\{\s*var\s+[\w\s]+=[\w\.\s]+?\.call\s*\([\w\s$]+?,[\(\)\",\s]+\)[\S\s]*?\}\s*return [\w\.\s$]+?\.call\s*\([\w\s$]+?\s*,[\(\)\",\s]+\)\s*\}\s*;)
inv_sig_helper-1  | thread 'main' panicked at src/player.rs:150:10:
inv_sig_helper-1  | called `Option::unwrap()` on a `None` value
inv_sig_helper-1  | stack backtrace:
inv_sig_helper-1  |    0:     0x768bf86ea0f1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h706c9783aace6373
inv_sig_helper-1  |    1:     0x768bf85467fb - core::fmt::write::h7221bf2763310748
inv_sig_helper-1  |    2:     0x768bf86c3ce2 - std::io::Write::write_fmt::h5f543a3ea7d45c3d
inv_sig_helper-1  |    3:     0x768bf86ef269 - std::sys_common::backtrace::print::hf2079bcf21b5d607
inv_sig_helper-1  |    4:     0x768bf86eea56 - std::panicking::default_hook::{{closure}}::hd6a41ed4ba4d9cdd
inv_sig_helper-1  |    5:     0x768bf86efe61 - std::panicking::rust_panic_with_hook::he62aa99a29ab1fe6
inv_sig_helper-1  |    6:     0x768bf86ef59a - std::panicking::begin_panic_handler::{{closure}}::h4295830cbed5c147
inv_sig_helper-1  |    7:     0x768bf86ef529 - std::sys_common::backtrace::__rust_end_short_backtrace::h29724adceafc0e2c
inv_sig_helper-1  |    8:     0x768bf86ef516 - rust_begin_unwind
inv_sig_helper-1  |    9:     0x768bf84c0192 - core::panicking::panic_fmt::h5822797b7c57c9a6
inv_sig_helper-1  |   10:     0x768bf84c032b - core::panicking::panic::h576d2b304e82d017
inv_sig_helper-1  |   11:     0x768bf84c06e8 - core::option::unwrap_failed::hf12f69fdafb5c188
inv_sig_helper-1  |   12:     0x768bf84fdc7e - inv_sig_helper_rust::player::fetch_update::{{closure}}::h61359dd4904a6910
inv_sig_helper-1  |   13:     0x768bf8516c18 - inv_sig_helper_rust::main::{{closure}}::h92460df08abff2f1
inv_sig_helper-1  |   14:     0x768bf850ddca - inv_sig_helper_rust::main::h4c6ed7911b8effb7
inv_sig_helper-1  |   15:     0x768bf84d58c3 - std::sys_common::backtrace::__rust_begin_short_backtrace::h65fca62ed9181c86
inv_sig_helper-1  |   16:     0x768bf851a154 - main

@rudism
Copy link

rudism commented Dec 9, 2024

Looks like YT changed something that breaks the regex that extracts the nsig function. youtube-dl and yt-dlp facing/faced similar issues in the past few days:

@unixfox
Copy link
Member

unixfox commented Dec 9, 2024

YouTube.js seems affected too: LuanRT/YouTube.js#831

@shatrix

This comment was marked as duplicate.

@gabe4278

This comment was marked as duplicate.

@unixfox
Copy link
Member

unixfox commented Dec 9, 2024

Like with every bug report. Please comment only if you have new things to bring on. Thank you.

@lifo9
Copy link
Contributor

lifo9 commented Dec 9, 2024

I've tried to create a patch using yt-dlp fixes(1, 2).
It seems that signature helper is now working:

...
[2024-12-09T23:43:20Z DEBUG inv_sig_helper_rust::player] got nsig fn code: function decrypt_nsig(J){var R=J.split(J.slice(0,0)),...
[2024-12-09T23:43:20Z INFO  inv_sig_helper_rust::player] sig code: var pen;var Gw={s9:function(J,R){J.splice(0,R)},Az:function(J,R){var N=J[0];J[0]=J[R%J.length];J[R%J.length]=N},hp:function(J){J.reverse()}};pen=function(J){J=J.split("");Gw.Az(J,29);Gw.s9(J,3);Gw.Az(J,43);Gw.Az(J,11);Gw.s9(J,3);Gw.Az(J,3);Gw.Az(J,34);return J.join("")}
[2024-12-09T23:43:20Z INFO  inv_sig_helper_rust] Successfully fetched player
...

But on the video page I get the following error:

The media could not be loaded, either because the server or network failed or because the format is not supported.

and the request to /videoplayback fails with 403 error...

@lifo9
Copy link
Contributor

lifo9 commented Dec 10, 2024

I think I've got a fix 🎉
Disclaimer: I don't know Rust, it was hacked together with a help from LLMs.

https://0x0.st/XhpM.patch

@rockerBOO

This comment was marked as resolved.

@ggtylerr
Copy link

Confirmed working - Have it on both of my servers, CAL-1 and POL-1, and videos seem to work fine. Thank you @lifo9 and @rockerBOO !

@iGerman00

This comment was marked as resolved.

@johnpc

This comment was marked as resolved.

@rockerBOO

This comment was marked as resolved.

@johnpc

This comment was marked as resolved.

@unixfox
Copy link
Member

unixfox commented Dec 10, 2024

@lifo9 feel free to send a PR even if it's not that clean.

@rockerBOO

This comment was marked as resolved.

@unixfox
Copy link
Member

unixfox commented Dec 10, 2024

Fixed in ac0269f. Docker image of inv_sig_helper has been rebuilt.

@unixfox unixfox closed this as completed Dec 10, 2024
@CDSWambo

This comment has been minimized.

@rudism

This comment has been minimized.

@Wyrrrd
Copy link

Wyrrrd commented Dec 16, 2024

Being on latest, it worked for last week, but the bug (or a similar one) returned around 5min ago...

[2024-12-16T17:37:55Z INFO  inv_sig_helper_rust] Fetching player
[2024-12-16T17:37:56Z INFO  inv_sig_helper_rust::player] Fetching player JS URL: https://www.youtube.com/s/player/2f1832d2/player_ias.vflset/en_US/base.js
[2024-12-16T17:37:56Z WARN  inv_sig_helper_rust::player] nsig function ending did not work: =\s*function(\([\w]+\)\{\s*var\s+[\w\s]+=[\w\.\s]+?\.call\s*\([\w\s$]+?,[\(\)\",\s]+\)[\S\s]*?\}\s*return [\w\.\s$]+?\.call\s*\([\w\s$]+?\s*,[\(\)\",\s]+\)\s*\}\s*;)
thread 'main' panicked at src/player.rs:185:10:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@predecker
Copy link

same here.

@RobinBoers
Copy link

Same issue here, also on latest

@uncaney
Copy link

uncaney commented Dec 16, 2024

same

@iv-org iv-org locked as resolved and limited conversation to collaborators Dec 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests