code wiki / _hdl_build / nx_media_state.nx

nx_media_state.nx

buildroot/runtime/_hdl_build/nx_media_state.nx

6091 B124 linesdepth 2pulls 2 transitivereach 12 importersview sourcekind librarytopic media
docsdependenciesstructsconstsfunctions

about

nx_media_state.nx -- EMBEDDED-STATE stream extraction (the yt-dlp / hanime-plugin technique): a modern SSR site bakes its initial state as a JSON blob in the HTML (window.__NUXT__, ytInitialPlayerResponse, __INITIAL_STATE__, __NEXT_DATA__, __APOLLO_STATE__), and that blob ALREADY contains the stream URLs -- so you extract it directly, NO bundle execution needed. This is the cheapest, most robust discovery layer (below JS-exec). Balanced-brace + string-aware (a `{` inside a JSON string doesn't break the scan). Learned from cynthia2006/hanime-plugin (deepwiki 2026-07-10): "__NUXT__ state / JSON APIs". license_tier: ORIGINAL

dependencies 1 imports · 10 importers

nx_syscalls.nx nx_media_state.nx nx_archive_capture.nx nx_archive_live.nx nx_media_adapt_gate.nx nx_media_extract.nx nx_media_extract_gate.nx nx_media_nuxt_manifest_gate.nx nx_media_state_gate.nx nx_vk_probe.nx nx_yt_innertube.nx nx_yt_probe.nx

imports: nx_syscalls.nx

imported by: nx_archive_capture.nxnx_archive_live.nxnx_media_adapt_gate.nxnx_media_extract.nxnx_media_extract_gate.nxnx_media_nuxt_manifest_gate.nxnx_media_state_gate.nxnx_vk_probe.nxnx_yt_innertube.nxnx_yt_probe.nx

structs

none

consts

none

functions

9func ms_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: ms_extract_state
10func ms_find(hay: *u8, hl: i64, needle: *u8, nl: i64, from: i64) -> i64
16func ms_contains(hay: *u8, hl: i64, needle: *u8, nl: i64) -> i64 { if ms_find(hay, hl, needle, nl, 0) >= 0 { return 1 } return 0 }
18func ms_is_media(u: *u8, ul: i64) -> i64
called by 1: ms_find_streams calls 1: ms_contains
32func ms_extract_json_value(html: *u8, start: i64, hlen: i64, out: *u8, cap: i64) -> i64
called by 1: ms_extract_state
62func ms_extract_state(html: *u8, hlen: i64, marker: *u8, out: *u8, cap: i64) -> i64
89func ms_find_streams(blob: *u8, blen: i64, out: *u8, cap: i64) -> i64