mirror of
https://github.com/iv-org/invidious.git
synced 2026-10-24 22:09:13 -05:00
YouTube now ships comment bodies (and video descriptions) as an `attributedDescription`: a plain `content` string plus interleaved `commandRuns`/`attachmentRuns`/`styleRuns` indexed in UTF-16 code units. `parse_description` only understood `commandRuns`, so it silently dropped every `attachmentRuns` entry. For custom channel emoji that is the only place the image lives: `content` merely contains a `:_EmojiName:` placeholder followed by U+25A1 padding, so comments rendered the raw placeholder instead of the emoji. Plain unicode emoji kept working because they are already present verbatim in `content`. Render `commandRuns` and `attachmentRuns` in a single ordered pass, and substitute a proxied `<img class="channel-emoji">` for custom channel emoji. Plain unicode emoji attachment runs are deliberately left alone: their image lives on `www.youtube.com/s/gaming/emoji/...`, which the `/ggpht` proxy cannot serve, and the characters are already correct. Overlapping runs are skipped so the codepoint iterator cannot be advanced past the text a run covers. Fixture data in the new spec was captured from live InnerTube `commentEntityPayload.properties.content` payloads.