Live Danmaku
Playback responses in Java/Python/QuickJS keep using danmaku: [{name, url}]. For a live source, build the URL with getDanmakuUrl(id) (self.getDanmakuUrl(id) in Python); the App then calls the site's danmaku(id, emit). HTTP(S) sources are still loaded as danmaku files.
Danmaku item
emit(item)
Subscription state
State is also sent with emit and must not include text. state is ready (subscription available), retrying (recovering) or error (fatal); msg is optional, at most 512 characters, with no cookies, tokens or signed URLs. ready must mean the platform subscription works — never infer it from a WebSocket open alone.
emit(item)
The App sets connecting itself and coalesces identical state/msg; initialization errors become error. After error the subscription stops and later callbacks are ignored; a deliberate stop clears the state and needs no closed report. States go to the log and are never shown as danmaku or repeated toasts.
Stopping
emit accepts a Java JSONObject, a Python dict or a QuickJS object; Java calls emit.accept(item) and returns an AutoCloseable, while Python/QuickJS return a stop function. When the channel changes or playback closes, the App calls the stop function and the spider must cancel its own connection and heartbeat.
The spider owns the protocol, decoding and style conversion; the App owns display limits, so surplus or expired messages may be dropped. Full samples are in the CatVodSpider three-language demo.