code wiki / (root) / nx_entity_media.nx

nx_entity_media.nx

buildroot/runtime/nx_entity_media.nx

20030 B481 linesdepth 21pulls 137 transitivereach 0 importersview sourcekind tooltopic entity
docsdependenciesstructsconstsfunctions

about

nx_entity_media.nx -- MULTI-IMAGE entity media gather. Supersedes the 1-image demo in nx_media_gather.nx, which fetched exactly ONE image and only if its URL contained a hardcoded "upload.wikimedia.org". Here: fetch an entity page over sovereign validated HTTPS, extract ALL image URLs, fetch each (polite pacing), sniff + sha256 + content-address into knowledge/media/<entity>/, dedupe by digest within the run, and append a provenance row per stored asset. No host allowlist: any http(s) image URL is eligible. Bounds are PARAMETERS, not literals -- the intended limits are hardware and politeness, nothing else. A hit cap is REPORTED (capped=1), never silent. usage: nx_entity_media <page-url> <entity-slug> [max_imgs] [pace_ms]

dependencies 11 imports · 0 importers

nx_str.nx nx_syscalls.nx nx_csprng.nx nx_x509_trust_store.nx nx_pem_loader.nx nx_https_get.nx nx_html_extract_imgs.nx nx_media_sniff.nx nx_sha256.nx nx_inflate.nx nx_entity_media.nx

diagram shows first 10 each side; +1 more imports, +0 more importers in the complete lists below.

imports: nx_str.nxnx_syscalls.nxnx_csprng.nxnx_x509_trust_store.nxnx_pem_loader.nxnx_https_get.nxnx_html_extract_imgs.nxnx_media_sniff.nxnx_sha256.nxnx_inflate.nxnx_http_dechunk.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main em_puts sys_write nx_str_len em_pi sys_mmap em_num sys_mmap ↻ sys_write ↻ sys_exit

structs

none

consts

24const EM_MAGIC_2048: i64 = 2048
26const EM_PAGE_CAP: i64 = 4194304
27const EM_IMG_CAP: i64 = 8388608
30const EM_URLBUF: i64 = 2097152
31const EM_MAX_IMGS: i64 = 4096
32const EM_PATHBUF: i64 = 4096
33const EM_DEF_PACE_MS: i64 = 800

functions

35func em_puts(s: *u8) -> i64 { sys_write(1, s, nx_str_len(s)); return 0 }
called by 1: main calls 2: sys_writenx_str_len
36func em_w(fd: i64, s: *u8) -> i64 { sys_write(fd, s, nx_str_len(s)); return 0 }
38func em_num(v: i64, o: *u8) -> i64
called by 2: em_piem_wn calls 1: sys_mmap
51func em_pi(v: i64) -> i64 { let o: *u8 = sys_mmap(32); let n: i64 = em_num(v, o); sys_write(1, o, n); return 0 }
called by 1: main calls 3: sys_mmapem_numsys_write
52func em_wn(fd: i64, v: i64) -> i64 { let o: *u8 = sys_mmap(32); let n: i64 = em_num(v, o); sys_write(fd, o, n); return 0 }
54func em_cat(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: em_upsize
56func em_mkdir(path: *u8) -> i64 { return __syscall(258, -100, path, 0x1ed, 0, 0, 0) }
58func em_atoi(s: *u8) -> i64
69func em_hex(d: *u8, out: *u8) -> i64
82func em_body_off(resp: *u8, n: i64) -> i64
91func em_write_file(path: *u8, buf: *u8, n: i64) -> i64
105func em_is_http(u: *u8, n: i64) -> i64
115func em_seen(seen: *u8, nseen: i64, dg: *u8) -> i64
127func em_ledger(lg: i64, entity: *u8, page: *u8, iurl: *u8, n: i64, hex: *u8, kind: *u8) -> i64
calls 2: em_wem_wn
138func em_doss(df: i64, entity: *u8, iurl: *u8, hex: *u8, kind: *u8, n: i64) -> i64
calls 2: em_wem_wn
159func em_ends(u: *u8, n: i64, s: *u8) -> i64
called by 1: em_raster_ext calls 1: nx_str_len
167func em_raster_ext(u: *u8, n: i64) -> i64
called by 1: em_upsize calls 1: em_ends
179func em_upsize(u: *u8, n: i64, out: *u8) -> i64
240func em_inflate_if_gzip(src: *u8, n: i64, dst: *u8, cap: i64) -> i64
calls 1: inf_gunzip
249func main(argc: i64, argv: *i64) -> i64