Repository navigation
fix comments icon vanishing after yt music player bar update - #1
Closed
FahadBinHussain wants to merge 3 commits into
Closed
FahadBinHussain wants to merge 3 commits into
FahadBinHussain wants to merge 3 commits into
Conversation
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.
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. |
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
what
the comments icon stopped appearing after yt music's recent player bar update. this fixes that, plus two related stability issues:
.middle-controls-buttons > ytmusic-menu-rendererbroke in two ways: the menu renderer now only stamps when yt servescurrentItem.menu, andisMiniplayerEnabledcan swap the whole top bar for the new litytmusic-miniplayer, which has nomiddle-controlsat all (verified against the currentmusic_polymer_inlined_html.jsbundle).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 stampsdata-ytm-anchor-strategyon the host for inspection; if nothing matches it logs the observed DOM structure instead of failing silently.INNERTUBE_CONTEXTwas fetched from the www homepage, which is CORS-blocked from a music content script, leaving requests on the hardcoded2.20240101.00.00client 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), rewritingWEB_REMIXtoWEBsince only the WEB client receives comments.warnOnce()helper; a full browsing session now logs a handful of lines instead of hundreds while scrolling.also adds an
AGENTS.mdwith notes for future maintainers (anchor strategies, context harvest, windows build quirks).vue-tsc --noEmitandwxt buildare both clean. version bumped to 0.1.1.