Skip to content

fix comments icon vanishing after yt music player bar update - #1

Closed
FahadBinHussain wants to merge 3 commits into
andronedev:mainfrom
FahadBinHussain:fix-yt-music-player-bar-icon
Closed

FahadBinHussain wants to merge 3 commits into
andronedev:mainfrom
FahadBinHussain:fix-yt-music-player-bar-icon

Conversation

@FahadBinHussain

Copy link
Copy Markdown

what

the comments icon stopped appearing after yt music's recent player bar update. this fixes that, plus two related stability issues:

  • icon injection — the old single anchor .middle-controls-buttons > ytmusic-menu-renderer broke in two ways: the menu renderer now only stamps when yt serves currentItem.menu, and isMiniplayerEnabled can swap the whole top bar for the new lit ytmusic-miniplayer, which has no middle-controls at all (verified against the current music_polymer_inlined_html.js bundle). placeButton() now walks ordered anchors — menu renderer, like button (unconditional sibling), middle-controls-buttons, then the miniplayer action bar. a non-primary anchor warns once and stamps data-ytm-anchor-strategy on the host for inspection; if nothing matches it logs the observed DOM structure instead of failing silently.
  • client context — INNERTUBE_CONTEXT was fetched from the www homepage, which is CORS-blocked from a music content script, leaving requests on the hardcoded 2.20240101.00.00 client version. yt then returns comment pages without framework updates and threads come back empty. it is now harvested from the current origin's own page (same-origin, balanced-brace extraction instead of a truncating regex), rewriting WEB_REMIX to WEB since only the WEB client receives comments.
  • console noise — diagnostics go through a new warnOnce() helper; a full browsing session now logs a handful of lines instead of hundreds while scrolling.

also adds an AGENTS.md with notes for future maintainers (anchor strategies, context harvest, windows build quirks).

vue-tsc --noEmit and wxt build are both clean. version bumped to 0.1.1.

the icon stopped appearing after yt changed the player bar. the old single anchor (.middle-controls-buttons > ytmusic-menu-renderer) broke two ways: the menu renderer now only stamps when yt serves currentItem.menu, and isMiniplayerEnabled can swap the whole top bar for the lit ytmusic-miniplayer which has no middle-controls at all.

placeButton() now walks ordered anchors - menu renderer, like button (unconditional sibling), middle-controls-buttons, then the miniplayer action bar. a non-primary anchor warns once and stamps data-ytm-anchor-strategy on the host; if nothing matches it logs the observed dom structure instead of failing silently. App.vue also warns when /watch loses its ?v= param, since that hides the button with display:none.

all diagnostics go through the new warnOnce() helper so a full session logs a handful of lines instead of hundreds.
fetching the www.youtube.com homepage for INNERTUBE_CONTEXT is CORS-blocked from a music content script, which left the client version stuck on the hardcoded 2.20240101.00.00 fallback - a stale client makes yt return comment pages without the framework updates, so threads silently come back empty.

the current origin's own page embeds a fresh context and is same-origin, so harvest from there instead. extraction walks balanced braces (a non-greedy regex stops at the first nested brace and truncates the object). the music page serves WEB_REMIX, which gets no comments at all, so the harvest rewrites it to WEB keeping the date with the canonical .00.00 build. each harvest failure warns once instead of on every refresh.
@andronedev

Copy link
Copy Markdown
Owner

Thanks a lot for digging into this! v0.2.0 (and the v0.2.1 follow-up) ended up reworking the button injection for both the new miniplayer and the legacy player bar, and dropped the client context harvest entirely, so this PR is now superseded and conflicts with main. Really appreciate the investigation though, it confirmed the root cause.

@andronedev andronedev closed this Oct 19, 2026
@FahadBinHussain

Copy link
Copy Markdown
Author

makes sense, the v0.2.0 rework already covers this and the icon work landed on main. thanks for the detailed writeup — much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants