resources/lib/blaze.py — Blaze TV live resolver
Role
Resolves Blaze TV's live channel. Blaze is a free-to-air reality-TV channel — no DRM, no auth, just two HTML scrapes on the way to the manifest URL.
Constants
Blaze's public-facing live page. item_id maps to Blaze's
internal uvid; there's a small known set of fallbacks — line 11-12:
("1227", "1228", "1229", "1235", "1236") are the recognized
"live" stream ids; anything else falls back to "553" (the
default national feed).
The actual stream-info API endpoint. %s is the
stream_base scraped out of the live page (it varies). The
key is per-page per-uvid, scraped out of the same page.
Resolver
Steps:
- Fetch the live HTML page.
- Regex-match the
"streams": "<…blaze.tv/streams/…"config in the HTML — this is the stream-base URL with escape backslashes that the JSON in HTML uses. - Regex-match all
data-key="<…>"anddata-uvid="<…>"entries on the page. - Pair them up via
zip(keys, uvids)and pick the pair whose uvid equalsitem_id. Fall back to the first pair if no exact match (line 28). - Fetch the stream-info API; it returns JSON with
response.stream— the actual m3u8/mpd URL, with a query string we strip off via.split("?", 1)[0](Blaze appends auth tokens that aren't required for playback from a UK IP). - Inspect the URL: HLS if
.m3u8in the URL, otherwise DASH. - Hand to
setup_dash_itemwith the rightmanifest_type. No license URL — Blaze is unprotected.
If Blaze's static-HTML team changes the "streams":"…" JSON
config shape, this resolver breaks instantly. There's no JSON-RPC API
Blaze exposes for the live stream. They've been stable for ~2 years as
of writing, which is the only reason the addon still ships this. Worth
fixing with a JSON-parser fallback to a
block if one's ever shipped.