nx_media_grab.nx
buildroot/runtime/nx_media_grab.nx
about
nx_media_grab.nx -- "nishi grab -> gallery" (operator 2026-07-08). Deep-harvests a page's media (nx_media_
deepcrawl: follows css/js/iframes + reconstructs JS-built URLs, no page-JS execution), DOWNLOADS each file
over sovereign TLS, content-addresses it (sha256), dedups, and adds it to an ISOLATED grabs gallery -- a
growing masonry of everything you've grabbed, kept SEPARATE from the gen-img/LoRA corpus on the NAS so web
grabs never pollute the training-favorite set. Regenerates a self-contained gallery page you can open.
usage: nx_media_grab <url>
files: knowledge/media/grabs/<sha16>.<ext> manifest: knowledge/status/grabs_manifest.tsv
gallery: knowledge/status/grabs_gallery.html (open in any browser; local previews render)
license_tier: ORIGINAL
dependencies 7 imports · 0 importers
imports: nx_syscalls.nxnx_x509_trust_store.nxnx_trust_store_load_from_certdata.nxnx_https_fetch_follow.nxnx_media_harvest.nxnx_media_deepcrawl.nxnx_sha256.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 17 | const GR_MAGIC_1089: i64 = 1089 |
| 18 | const GR_MAGIC_8388608: i64 = 8388608 |
| 19 | const GR_MAGIC_16777216: i64 = 16777216 |
| 20 | const GR_MAGIC_1024: i64 = 1024 |
| 21 | const GR_MAGIC_4096: i64 = 4096 |
| 22 | const GR_MAGIC_4194304: i64 = 4194304 |
| 23 | const GR_MAGIC_5120: i64 = 5120 |
| 25 | const GR_DLBUF: i64 = 67108864 // 64MB per-file |
| 26 | const GR_MAN: *u8 = "knowledge/status/grabs_manifest.tsv" as *u8 |
| 27 | const GR_DIR: *u8 = "knowledge/media/grabs" as *u8 |
| 28 | const GR_GAL: *u8 = "knowledge/status/grabs_gallery.html" as *u8 |
functions
| 30 | func gr_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 } |
| 31 | func gr_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 } |
| 32 | func gr_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 33 | func gr_mkdir(path: *u8) -> i64 { return __syscall(258, 0-100, path as i64, 0x1ff, 0, 0, 0) } |
| 34 | func gr_ap(buf: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; var w: i64=off; while s[i]!=(0 as u8){ buf[w]=s[i]; w=w+1; i=i+1 } return w } |
| 35 | func gr_apr(buf: *u8, off: i64, ptr: *u8, len: i64) -> i64 { var i: i64=0; var w: i64=off; while i<len { buf[w]=ptr[i]; w=w+1; i=i+1 } return w } |
| 37 | func gr_write_file(path: *u8, buf: *u8, n: i64) -> i64 |
| 45 | func gr_append(path: *u8, buf: *u8, n: i64) -> i64 calls 1: sys_write |
| 54 | func gr_read_file(path: *u8, buf: *u8, cap: i64) -> i64 |
| 62 | func gr_hex(d: *u8, out: *u8) -> i64 { let hx: *u8="0123456789abcdef" as *u8; var i: i64=0; while i<32 { let b: i64=d[i] as i64; out[i*2]=hx[(b>>4)&15]; out[i*2+1]=hx[b&15]; i=i+1 } out[64]=0 as u8; return 64 } |
| 64 | func gr_ext(url: *u8, ulen: i64, out: *u8) -> i64 |
| 75 | func gr_seen(man: *u8, mlen: i64, hex: *u8) -> i64 |
| 91 | func gr_field(man: *u8, ls: i64, le: i64, idx: i64, out: *u8) -> i64 called by 1: gr_emit_gallery |
| 102 | func gr_streq(a: *u8, b: *u8) -> i64 { var i: i64=0; while a[i]!=(0 as u8){ if a[i]!=b[i]{return 0} i=i+1 } if b[i]==(0 as u8){return 1} return 0 } called by 1: gr_emit_gallery |
| 104 | func gr_emit_gallery() -> i64 |
| 149 | func main(argc: i64, argv: *i64) -> i64 |