code wiki / (root) / nx_media_deepcrawl.nx

nx_media_deepcrawl.nx

buildroot/runtime/nx_media_deepcrawl.nx

10999 B190 linesdepth 21pulls 149 transitivereach 5 importersview sourcekind librarytopic media
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_x509_trust_store.nx nx_https_fetch_follow.nx nx_media_harvest.nx nx_js_urlfold.nx nx_url_resolve.nx nx_media_deepcrawl.nx nx_browser.nx nx_media_grab.nx nx_media_inspect.nx

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

21struct MediaSet { buf: *u8, off: *i64, len: *i64, kind: *i64, cnt: i64, used: i64 }
22struct Frontier { buf: *u8, off: *i64, len: *i64, depth: *i64, cnt: i64, head: i64, used: i64 }

consts

14const MDC_CAP: i64 = 4194304
15const MDC_MAXN: i64 = 512
16const MDC_MAXFR: i64 = 192
17const MDC_MBUF: i64 = 1048576
18const MDC_FBUF: i64 = 262144
19const MDC_IFRAMES: i64 = 0 // iframe-following (temp-gated while debugging a hang)
23const MSET_BYTES: i64 = 48
24const FRNT_BYTES: i64 = 56

functions

26func 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 }
called by 1: nx_media_deepcrawl calls 1: sys_write
27func 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 }
28func mdc_lc(c: i64) -> i64 { if c>=65 { if c<=90 { return c+32 } } return c }
31func nx_mediaset_new() -> *MediaSet
called by 1: br_media_dump calls 1: sys_mmap
38func 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 }
called by 1: mdc_follow_ext calls 1: mdc_lc
40func mdc_follow_ext(u: *u8, ulen: i64) -> i64
49func mdc_resolve(base: *u8, blen: i64, cand: *u8, clen: i64, out: *u8, cap: i64) -> i64
55func mdc_add_media(M: *MediaSet, src: *u8, soff: i64, slen: i64, kind: i64) -> i64
called by 1: nx_media_deepcrawl
69func mdc_add_frontier(F: *Frontier, u: *u8, ulen0: i64, depth: i64) -> i64
87func mdc_scan_iframes(text: *u8, n: i64, base: *u8, blen: i64, F: *Frontier, depth: i64) -> i64
116func mdc_scan_follow(text: *u8, n: i64, base: *u8, blen: i64, F: *Frontier, depth: i64) -> i64
141func nx_media_deepcrawl(start: *u8, ulen: i64, store: *TrustStore, M: *MediaSet, maxfetch: i64, maxdepth: i64, verbose: i64, raw_path: *u8) -> i64