code wiki / _hdl_build / nx_kvs.nx
nx_kvs.nx
buildroot/runtime/_hdl_build/nx_kvs.nx
about
nx_kvs.nx -- KVS / kt_player URL de-obfuscator. A huge share of "legal personal download" tube sites run the
Kernel Video Sharing CMS, which hides the real .mp4 behind an obfuscated flashvars field:
video_url: 'function/0/https://host/get_file/3/<SCRAMBLED-32-hex>/aaa/bbb/name_1080p.mp4/'
license_code: '$<digits>'
The player's kt_player JS un-scrambles the 32-char hash at runtime using license_code -- which is why the real
URL only appears in the browser Network tab and our static harvester correctly skips the invalid string. This
module reproduces that de-obfuscation EXACTLY (ported verbatim from yt-dlp GenericIE._kvs_get_real_url /
_kvs_get_license_token) so we recover the direct URL ourselves. Faithful port -- verified by nx_kvs_gate against
a hand-computed token vector + the real bitchesgirls page. license_tier: ORIGINAL
dependencies 1 imports · 3 importers
imports: nx_syscalls.nx
imported by: nx_archive_daemon.nxnx_clean_serve_daemon.nxnx_kvs_gate.nx
structs
| none |
consts
| 11 | const K_MAGIC_10000: i64 = 10000 |
| 12 | const K_MAGIC_4096: i64 = 4096 |
functions
| 14 | func kvs_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 15 | func kvs_find(hay: *u8, hl: i64, needle: *u8, nl: i64, from: i64) -> i64 called by 1: kvs_real_url |
| 21 | func kvs_starts(s: *u8, slen: i64, pre: *u8, prelen: i64) -> i64 called by 1: kvs_real_url |
| 25 | func kvs_next_slash(s: *u8, slen: i64, from: i64) -> i64 |
| 32 | func kvs_license_token(lic: *u8, llen: i64, tok: *i64) -> i64 |
| 88 | func kvs_real_url(vurl: *u8, vlen: i64, lic: *u8, llen: i64, out: *u8, cap: i64) -> i64 |
| 133 | func kvs_qval(html: *u8, hlen: i64, key: *u8, out: *u8, cap: i64) -> i64 |
| 152 | func kvs_res_score(s: *u8, slen: i64) -> i64 |
| 181 | func kvs_try_field(html: *u8, hlen: i64, field: *u8, lic: *u8, llen: i64, out: *u8, cap: i64) -> i64 |
| 189 | func kvs_label_score(html: *u8, hlen: i64, field: *u8) -> i64 |
| 203 | func kvs_is_prog(u: *u8, ul: i64) -> i64 |
| 212 | func kvs_extract(html: *u8, hlen: i64, out: *u8, cap: i64) -> i64 |