code wiki / _hdl_build / nx_manga_sites.nx
nx_manga_sites.nx
buildroot/runtime/_hdl_build/nx_manga_sites.nx
about
nx_manga_sites.nx -- R2b PER-SITE ADAPTERS (operator 2026-07-03: "make sure nhentai and mangadex and the others
each work as endpoints that we had working before along with all the new ones"). nhentai + MangaDex ship their
PAGE LIST in a JSON API (not the chapter HTML), so the generic harvester can't reach them -- each needs a real
adapter: detect the site from the URL, build its API URL, and parse the API JSON into the exact ORDERED page-URL
list. Everything else (batoto/manhwaread/new sites) falls back to nx_img_harvest (the generic multi-strategy).
Patterns GROUNDED from the working Python mm (verified, not assumed):
nhentai: /g/<id>/ -> GET https://nhentai.net/api/gallery/<id>
JSON media_id + images.pages[].t (j/p/g/w) -> https://i1.nhentai.net/galleries/<media_id>/<i>.<ext>
mangadex: /chapter/<uuid> -> GET https://api.mangadex.org/at-home/server/<uuid>
JSON baseUrl + chapter.hash + chapter.data[] -> <baseUrl>/data/<hash>/<filename>
PURE parsers (na_*_build) are gated deterministically on FIXTURE JSON (legal posture: build the general
capability, gate on fixtures, the operator points it where they like). Referer: the shared fetch already sends a
full browser UA which both CDNs accept; a referer-capable fetch is the fallback if a CDN 403s (R2d). license_tier: ORIGINAL
dependencies 1 imports · 5 importers
imports: nx_syscalls.nx
imported by: nx_ereader_sota_fetch.nxnx_manga_browser_research_fetch.nxnx_manga_get.nxnx_manga_search.nxnx_manga_sites_gate.nx
structs
| none |
consts
| none |
functions
| 16 | func na_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 17 | func na_apps(dst: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[o + i] = s[i]; i = i + 1 } return o + i } |
| 18 | func na_lc(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c } |
| 20 | func na_find_ci(hay: *u8, hn: i64, needle: *u8) -> i64 |
| 33 | func na_find_from(hay: *u8, hn: i64, needle: *u8, from: i64) -> i64 |
| 48 | func na_detect(url: *u8, n: i64) -> i64 |
| 55 | func na_nhentai_api(url: *u8, n: i64, out: *u8) -> i64 |
| 67 | func na_mangadex_api(url: *u8, n: i64, out: *u8) -> i64 |
| 87 | func na_mangadex_meta_api(url: *u8, n: i64, out: *u8) -> i64 |
| 110 | func na_mangadex_title(json: *u8, jn: i64, out: *u8, cap: i64) -> i64 |
| 132 | func na_key_end(buf: *u8, n: i64, key: *u8) -> i64 |
| 142 | func na_ws(c: i64) -> i64 { if c==32 { return 1 } if c==9 { return 1 } if c==10 { return 1 } if c==13 { return 1 } return 0 } |
| 144 | func na_char_from(buf: *u8, limit: i64, ch: i64, from: i64) -> i64 |
| 150 | func na_json_str(buf: *u8, n: i64, key: *u8, out: *u8, cap: i64) -> i64 |
| 173 | func na_num(dst: *u8, o: i64, v: i64) -> i64 { let t: *u8=sys_mmap(24); var m: i64=v; var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var w: i64=o; var i: i64=0; while i<k{dst[w]=t[k-1-i]; w=w+1; i=i+1} return w } |
| 174 | func na_ext_for(t: i64) -> *u8 |
| 184 | func na_html_title(html: *u8, hlen: i64, out: *u8, cap: i64) -> i64 |
| 216 | func na_ent_is(html: *u8, e: i64, i: i64, ent: *u8) -> i64 { var k: i64=0; while ent[k]!=(0 as u8) { if i+k>=e { return 0 } if html[i+k]!=ent[k] { return 0 } k=k+1 } return 1 } |
| 218 | func na_ent_byte(html: *u8, e: i64, i: i64) -> i64 |
| 227 | func na_ent_len(html: *u8, e: i64, i: i64) -> i64 |
| 239 | func na_isdig(c: i64) -> i64 { if c>=48 { if c<=57 { return 1 } } return 0 } |
| 240 | func na_islet(c: i64) -> i64 { let l: i64 = na_lc(c); if l>=97 { if l<=122 { return 1 } } return 0 } |
| 242 | func na_end_digits(buf: *u8, limit: i64, from: i64) -> i64 { var i: i64 = from; while i < limit { if na_isdig(buf[i] as i64)==1 { i = i + 1 } else { return i } } return i } |
| 243 | func na_end_letters(buf: *u8, limit: i64, from: i64) -> i64 { var i: i64 = from; while i < limit { if na_islet(buf[i] as i64)==1 { i = i + 1 } else { return i } } return i } |
| 244 | func na_nhentai_from_page(html: *u8, hlen: i64, url_buf: *u8, cap: i64, offs: *i64, lens: *i64, max: i64) -> i64 |
| 300 | func na_seen(url_buf: *u8, offs: *i64, lens: *i64, count: i64, start: i64, cn: i64) -> i64 |
| 314 | func na_nhentai_build(json: *u8, jn: i64, url_buf: *u8, cap: i64, offs: *i64, lens: *i64, max: i64) -> i64 |
| 361 | func na_mangadex_build(json: *u8, jn: i64, url_buf: *u8, cap: i64, offs: *i64, lens: *i64, max: i64) -> i64 |