code wiki / (root) / nx_media_harvest.nx

nx_media_harvest.nx

buildroot/runtime/nx_media_harvest.nx

22625 B368 linesdepth 3pulls 3 transitivereach 7 importersview sourcekind librarytopic media
docsdependenciesstructsconstsfunctions

about

nx_media_harvest.nx -- SUPERSET media-URL harvester (operator 2026-07-08: "how do i get my nishi browser to see the source of gifs and vids and images on a page like this" -- an ad/popunder lander hides media in lazy attrs, <source>/<video>, HLS manifests, JSON blobs and CSS url()). This is nx_img_harvest's proven multi- strategy raw-byte scan EXTENDED past images: it also finds VIDEO (.mp4/.webm/.m4v/.mov/.mkv/.ogv), STREAM manifests (.m3u8/.mpd) and AUDIO (.mp3/.m4a/.ogg/.opus/.wav/.aac), and it adds a CSS url(...) pass so UNQUOTED backgrounds (background:url(/bg/hero.gif)) surface too -- the quoted-region scan alone misses those. Every hit is CLASSIFIED into a kind (0 image / 1 gif / 2 video / 3 stream / 4 audio) so the caller can label and preview it. Same offs/lens/url_buf interface as nx_img_harvest, plus a parallel kinds[] array. nx_media_harvest(html,hlen, base_url,base_len, url_buf,cap, offs,lens,kinds, max_n) -> count Mechanism (per token): unescape JSON "\/"->"/", classify by path extension (path = up to ?/#), resolve rel->abs (nx_url_resolve), dedup. Junk (data: URIs, .svg, favicon/sprite/logo) rejected for image kinds. license_tier: ORIGINAL

dependencies 2 imports · 5 importers

nx_syscalls.nx nx_url_resolve.nx nx_media_harvest.nx nx_browser.nx nx_media_deepcrawl.nx nx_media_grab.nx nx_media_harvest_gate.nx nx_media_inspect.nx

imports: nx_syscalls.nxnx_url_resolve.nx

imported by: nx_browser.nxnx_media_deepcrawl.nxnx_media_grab.nxnx_media_harvest_gate.nxnx_media_inspect.nx

structs

none

consts

16const MH_KIND_IMAGE: i64 = 0
17const MH_KIND_GIF: i64 = 1
18const MH_KIND_VIDEO: i64 = 2
19const MH_KIND_STREAM: i64 = 3
20const MH_KIND_AUDIO: i64 = 4

functions

23func mh_lc(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c }
24func mh_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: mh_classify
27func mh_has_ci(hay: *u8, hn: i64, needle: *u8) -> i64
called by 1: mh_classify calls 1: mh_lc
42func mh_classify(tok: *u8, tn: i64) -> i64
129func mh_unescape(tok: *u8, tn: i64, out: *u8, cap: i64) -> i64
called by 1: mh_consider
144func mh_seen(url_buf: *u8, offs: *i64, lens: *i64, count: i64, cand: *u8, cn: i64) -> i64
called by 1: mh_consider
160func mh_resolve(base: *u8, blen: i64, cand: *u8, cn: i64, out: *u8, cap: i64) -> i64
183func mh_consider(tok: *u8, tn: i64, base_url: *u8, base_url_len: i64,
207func nx_media_harvest(html: *u8, hlen: i64, base_url: *u8, base_url_len: i64,
281func nx_media_kind_label(kind: i64) -> *u8
called by 2: br_media_dumpmain
291func mh_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 }
292func mh_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 }
293func mh_apn(buf: *u8, off: i64, v0: i64) -> i64 { var v: i64=v0; var w: i64=off; if v<0 { buf[w]=45 as u8; w=w+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} var j: i64=k-1; while j>=0{ buf[w]=b[j]; w=w+1; j=j-1 } return w }
called by 1: nx_media_emit_panel calls 1: sys_mmap
295func mh_card_img(H: *u8, off: i64, p: *u8, ulen: i64) -> i64
called by 1: nx_media_emit_panel calls 2: mh_apmh_apr
301func mh_card_video(H: *u8, off: i64, p: *u8, ulen: i64) -> i64
called by 1: nx_media_emit_panel calls 2: mh_apmh_apr
307func mh_card_audio(H: *u8, off: i64, p: *u8, ulen: i64) -> i64
called by 1: nx_media_emit_panel calls 2: mh_apmh_apr
321func nx_media_emit_panel(H: *u8, srcurl: *u8, srclen: i64, ub: *u8, offs: *i64, lens: *i64, kinds: *i64, cnt: i64) -> i64