nx_media_deepcrawl.nx
buildroot/runtime/nx_media_deepcrawl.nx
about
nx_media_deepcrawl.nx -- the DEEP media harvester as a REUSABLE capability (operator 2026-07-08: "harvest the
media as part of the browser capabilities -- no manual network capture"). Crawls a page's resource graph over
sovereign TLS, following the CSS/JS it pulls in (incl. URLs the JS CONSTRUCTS from constants, reconstructed by
nx_js_urlfold WITHOUT executing anything), harvesting media from every hop into a MediaSet. Used by BOTH the
nx_media_inspect CLI and the in-browser 'm' key. Budget-bounded (maxfetch, maxdepth). Never runs page JS ->
robust on the minified ad bundles that segfault a tree-walker. license_tier: ORIGINAL
dependencies 6 imports · 3 importers
imports: nx_syscalls.nxnx_x509_trust_store.nxnx_https_fetch_follow.nxnx_media_harvest.nxnx_js_urlfold.nxnx_url_resolve.nx
imported by: nx_browser.nxnx_media_grab.nxnx_media_inspect.nx
structs
| 21 | struct MediaSet { buf: *u8, off: *i64, len: *i64, kind: *i64, cnt: i64, used: i64 } |
| 22 | struct Frontier { buf: *u8, off: *i64, len: *i64, depth: *i64, cnt: i64, head: i64, used: i64 } |
consts
| 14 | const MDC_CAP: i64 = 4194304 |
| 15 | const MDC_MAXN: i64 = 512 |
| 16 | const MDC_MAXFR: i64 = 192 |
| 17 | const MDC_MBUF: i64 = 1048576 |
| 18 | const MDC_FBUF: i64 = 262144 |
| 19 | const MDC_IFRAMES: i64 = 0 // iframe-following (temp-gated while debugging a hang) |
| 23 | const MSET_BYTES: i64 = 48 |
| 24 | const FRNT_BYTES: i64 = 56 |
functions
| 26 | func mdc_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 } |
| 27 | func mdc_n(fd: i64, v0: i64) -> i64 { var v: i64=v0; if v<0 { sys_write(fd,"-" as *u8,1); v=0-v } let b: *u8=sys_mmap(24); var k: i64=0; if v==0{b[0]=48 as u8;k=1} while v>0{b[k]=(48+(v%10)) as u8;v=v/10;k=k+1} let o: *u8=sys_mmap(24); var j: i64=0; while j<k{o[j]=b[k-1-j];j=j+1} sys_write(fd,o,k); return 0 } |
| 28 | func mdc_lc(c: i64) -> i64 { if c>=65 { if c<=90 { return c+32 } } return c } |
| 31 | func nx_mediaset_new() -> *MediaSet |
| 38 | func mdc_suf(u: *u8, end: i64, ext: *u8, el: i64) -> i64 { if end < el { return 0 } var i: i64=0; while i<el { if mdc_lc(u[end-el+i] as i64) != mdc_lc(ext[i] as i64) { return 0 } i=i+1 } return 1 } |
| 40 | func mdc_follow_ext(u: *u8, ulen: i64) -> i64 |
| 49 | func mdc_resolve(base: *u8, blen: i64, cand: *u8, clen: i64, out: *u8, cap: i64) -> i64 |
| 55 | func mdc_add_media(M: *MediaSet, src: *u8, soff: i64, slen: i64, kind: i64) -> i64 called by 1: nx_media_deepcrawl |
| 69 | func mdc_add_frontier(F: *Frontier, u: *u8, ulen0: i64, depth: i64) -> i64 |
| 87 | func mdc_scan_iframes(text: *u8, n: i64, base: *u8, blen: i64, F: *Frontier, depth: i64) -> i64 |
| 116 | func mdc_scan_follow(text: *u8, n: i64, base: *u8, blen: i64, F: *Frontier, depth: i64) -> i64 |
| 141 | func nx_media_deepcrawl(start: *u8, ulen: i64, store: *TrustStore, M: *MediaSet, maxfetch: i64, maxdepth: i64, verbose: i64, raw_path: *u8) -> i64 |