code wiki / _hdl_build / nx_img_harvest.nx
nx_img_harvest.nx
buildroot/runtime/_hdl_build/nx_img_harvest.nx
about
nx_img_harvest.nx -- S-CLASS-EXCEED image-URL harvester (operator 2026-07-03: "no we want to get s class
exceed" -- the generic <img src>-only extractor missed LAZY-LOADED + JS/JSON-embedded pages, which is how
modern manga readers actually ship their page lists; gallery-dl's edge is exactly this). MULTI-STRATEGY, raw
scan of the page bytes so it is agnostic to WHERE the URL lives:
* <img src=..> (the old floor)
* lazy attrs data-src / data-original / data-lazy-src / data-url (quoted values are just strings)
* srcset="a 1x, b 2x" (each comma/space token checked -> highest set of candidates)
* JS / JSON page arrays "pages":["https:\/\/cdn\/01.jpg", ...] window.__data / __NEXT_DATA__ / chapter.images
Mechanism: scan for every QUOTED region (" or '), tokenize its content on space/comma, UNESCAPE JSON "\/"->"/",
and if a token LOOKS like an image URL (path ends .jpg/.jpeg/.png/.webp/.gif/.avif before ?/#; NOT data:/.svg/
sprite/favicon UI-junk) resolve it (absolute passes through; relative via the proven nx_url_resolve) + DEDUP.
Order = appearance order (matches reading order for HTML galleries + JSON arrays). Returns the count; fills the
same offs/lens/url_buf interface nx_html_extract_imgs uses, so nx_manga_get swaps it in with no other change.
The completeness magic-guard in nx_manga_get still fetch-verifies each (valid FULL file), so a stray non-page
URL that slips the heuristic simply fails the fetch -- never a blank/false page. license_tier: ORIGINAL
dependencies 2 imports · 2 importers
imports: nx_syscalls.nxnx_html_extract_imgs.nx
imported by: nx_img_harvest_gate.nxnx_manga_get.nx
structs
| none |
consts
| 18 | const K_MAGIC_8192: i64 = 8192 |
functions
| 21 | func ih_lc(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c } |
| 25 | func ih_looks_img(tok: *u8, tn: i64) -> i64 |
| 60 | func ih_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: ih_looks_img |
| 62 | func ih_has_ci(hay: *u8, hn: i64, needle: *u8) -> i64 |
| 76 | func ih_unescape(tok: *u8, tn: i64, out: *u8, cap: i64) -> i64 called by 1: ih_consider |
| 91 | func ih_seen(url_buf: *u8, offs: *i64, lens: *i64, count: i64, cand: *u8, cn: i64) -> i64 called by 1: ih_consider |
| 107 | func ih_resolve(base: *u8, blen: i64, cand: *u8, cn: i64, out: *u8, cap: i64) -> i64 |
| 132 | func ih_consider(tok: *u8, tn: i64, base_url: *u8, base_url_len: i64, |
| 152 | func nx_img_harvest(html: *u8, hlen: i64, base_url: *u8, base_url_len: i64, |