code wiki / (root) / nx_yt_nsolve.nx

nx_yt_nsolve.nx

buildroot/runtime/nx_yt_nsolve.nx

5535 B111 linesdepth 7pulls 23 transitivereach 28 importersview sourcekind librarytopic yt
docsdependenciesstructsconstsfunctions

about

nx_yt_nsolve.nx -- the YouTube n-THROTTLE SOLVER. Modern googlevideo URLs carry an &n=<token> param; if you fetch with the RAW n, the CDN throttles you to ~50KB/s (broken/slow downloads). base.js ships a JS function that transforms n -> n' ; requesting with n' gives full speed. That function is JS (array/char scrambling), exactly the class our engine already runs (see nx_js_ytsig_gate: split->transform->join). So the solver is: (1) EXTRACT the named function from base.js text -- brace-balanced + STRING-AWARE so literals with { } " ' in the body don't truncate it; (2) BUILD a self-contained runnable script (def + call); (3) RUN it via js_run_source and read the string result. This turns an extracted throttled URL into a FAST one, sovereignly (our own JS engine -- no Node, no remote). The function NAME + its helper-array location are themselves site-shape patterns -> feed the self-healing table (nx_extract_heal) when YouTube reshapes base.js. license_tier: ORIGINAL

dependencies 3 imports · 3 importers

nx_syscalls.nx nx_media_signal.nx nx_js_eval.nx nx_yt_nsolve.nx nx_video_sniff.nx nx_yt_basejs_gate.nx nx_yt_nsolve_gate.nx

imports: nx_syscalls.nxnx_media_signal.nxnx_js_eval.nx

imported by: nx_video_sniff.nxnx_yt_basejs_gate.nxnx_yt_nsolve_gate.nx

structs

none

consts

none

functions

14func ns_apps(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8) { dst[off]=s[i]; off=off+1; i=i+1 } return off }
15func ns_appb(dst: *u8, off: i64, src: *u8, from: i64, n: i64) -> i64 { var i: i64=0; while i<n { dst[off]=src[from+i]; off=off+1; i=i+1 } return off }
19func ns_skip_str(js: *u8, jl: i64, start: i64, q: i64) -> i64
called by 1: ns_body_end
33func ns_find_fn_start(js: *u8, jl: i64, name: *u8, namelen: i64, isdecl: *i64) -> i64
49func ns_body_end(js: *u8, jl: i64, from: i64) -> i64
called by 1: ns_build_script calls 1: ns_skip_str
78func ns_build_script(js: *u8, jl: i64, name: *u8, namelen: i64, arg: *u8, arglen: i64, out: *u8, cap: i64) -> i64
98func ns_solve(js: *u8, jl: i64, name: *u8, namelen: i64, arg: *u8, arglen: i64, out: *u8, cap: i64) -> i64