nx_video_get.nx
buildroot/runtime/nx_video_get.nx
about
nx_video_get.nx -- SOVEREIGN streaming video downloader (X-TORRENT-LIVE-002 video rung). The engine
both the Waterfox extension AND the future native nish browser feed: given a media URL (+ Referer/
cookie the sniffer captured), STREAM the body straight to a file (TLS record -> file fd, so multi-GB
videos never buffer in RAM), skipping the HTTP headers, following 30x redirects (CDNs redirect a lot).
Direct mp4/ts/webm = done here; HLS .m3u8 (fetch playlist -> per-segment) composes this = next rung.
Reuses nx_https_get's connect+handshake + the TLS record codec. Sends a real Firefox UA + Referer +
Cookie so CDNs that gate on those serve the bytes. argv[1]=url argv[2]=outpath argv[3]=referer argv[4]=cookie.
license_tier: ORIGINAL module: nishi-core.media.video_get
dependencies 10 imports · 1 importers
imports: nx_https_get.nxnx_tls13_record.nxnx_tls13_read_record_from_fd.nxnx_tls13_client_session.nxnx_http_client.nxnx_x509_trust_store.nxnx_pem_loader.nxnx_csprng.nxnx_url.nxnx_syscalls.nx
imported by: nx_hls_get.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 19 | const K_MAGIC_8192: i64 = 8192 |
| 20 | const K_MAGIC_131072: i64 = 131072 |
| 21 | const K_MAGIC_4096: i64 = 4096 |
functions
| 23 | func vg_w(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 } |
| 24 | func vg_wn(fd: i64, v: i64) -> i64 { let t: *u8=sys_mmap(28); var m: i64=v; var k: i64=0; if m==0 {t[0]=48 as u8;k=1} while m>0 {t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} let b: *u8=sys_mmap(28); var i: i64=0; while i<k {b[i]=t[k-1-i];i=i+1} sys_write(fd,b,k); return 0 } |
| 25 | func vg_puts(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){dst[off+i]=s[i];i=i+1} return off+i } called by 1: vg_build |
| 26 | func vg_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } called by 1: nx_video_fetch |
| 27 | func _vg_write_n(fd: i64, buf: *u8, n: i64) -> i64 { var o: i64=0; while o<n { let w: i64=sys_write(fd,(buf as i64+o) as *u8,n-o); if w<=0 { return 0-1 } o=o+w } return 0 } |
| 30 | func vg_build(path: *u8, plen: i64, host: *u8, hlen: i64, referer: *u8, rlen: i64, cookie: *u8, clen: i64, out: *u8) -> i64 |
| 42 | func vg_hdr_end(buf: *u8, n: i64) -> i64 { var i: i64=0; while i+4<=n { if buf[i]==(13 as u8){if buf[i+1]==(10 as u8){if buf[i+2]==(13 as u8){if buf[i+3]==(10 as u8){return i+4}}}} i=i+1 } return 0-1 } called by 1: vg_one |
| 44 | func vg_status(buf: *u8, n: i64) -> i64 { if n<12 { return 0 } return ((buf[9] as i64-48)*100)+((buf[10] as i64-48)*10)+(buf[11] as i64-48) } called by 1: vg_one |
| 46 | func vg_location(buf: *u8, n: i64, out: *u8, ocap: i64) -> i64 called by 1: vg_one |
| 64 | func vg_one(s: *Tls13ClientSession, fd: i64, path: *u8, plen: i64, host: *u8, hlen: i64, referer: *u8, rlen: i64, cookie: *u8, clen: i64, out_fd: i64, loc: *u8, loc_cap: i64) -> i64 |
| 107 | func nx_video_fetch(url0: *u8, referer: *u8, cookie: *u8, outpath: *u8, store: *TrustStore, now: i64) -> i64 called by 2: hg_fetchmain calls 9: vg_strlensys_openat_wrnx_url_newsys_mmapnx_https_url_for_fetchnx_https_url_connect+3 |
| 145 | func vg_gallery_refresh() -> i64 |
| 155 | func main(argc: i64, argv: *i64) -> i64 |