Repository navigation
add like support for comments and replies - #2
FahadBinHussain wants to merge 15 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.
logging was flooding the console while scrolling - buildAuthHeaders warned on every /next fetch (dozens per scroll), deriveLikeMeta dumped a 3KB surface payload per comment, and every comment currently being gated meant that fired for all ~20 comments on every page. the real signals were buried. - new lib/log.ts warnOnce(): each key logs once per page load - removed the chrome.storage.local debug stash entirely (ytmDebugParse / ytmDebugLike) - edge's leveldb never flushed 000003.log, the transport was already dead and only added noise - parseComments: dropped fingerprintPaths + stashParseDebug, condensed the per-thread debug block into one map-sizes line - youtubeApi: auth header booleans, performCommentAction payload and fallback per-variant failures all one-shot - clientContext: harvest failure warns one-shot (refreshClientContext re-harvests on every implausible response) - auth: prefer __Secure-3PAPISID over legacy SAPISID for the hash
the auth probe concluded authed=false from a regex that only matched protojson 1/0 form. youtube can also serialize bools as true/false, in which case every probe was a false negative and the entire auth-is-broken investigation was built on nothing. probe now logs the raw ~50 chars around the occurrence plus whether the visitor-id header was present on that probe. also one-shot logs when visitorData gets captured from an api response - if that never fires, x-goog-visitor-id stays absent forever and youtube gates the engagement surface even with valid auth.
ground truth from the raw probe: youtube serializes logged_in as a key/value pair with value 0, and every probe - including same-origin music where cookies are guaranteed first-party - reports logged out. so the sapisidhash and visitor-id were never the gate. probe D strips the authorization and visitor headers entirely on a same-origin fetch. youtube authenticates account_menu on the session cookies alone in first-party context, so D=1 means our own header is downgrading auth and D=0 means the cookie session itself is dead or absent. also logs which session cookies the page can see at all (names only - values are session secrets).
…(0.2.6) - sapisidhash was computed over the hardcoded https://www.youtube.com origin, but youtube validates it against the real origin header, so calls from music.youtube.com came back logged out and the like command was just a sign-in gate. hash location.origin now and warn loudly when the page origin is not youtube. - unwrap innertubeCommand in the like payload: the endpoint-wrapped body was answered 400 invalid argument. canonical body is actions[] plus clickTrackingParams, confirmed end to end in the browser; when a non-primary body shape has to be used the loop warns perform-comment-variant instead of hiding it. - move the click listener from the inner button to the button shape. a click landing on the shape padding had no listener, bubbled into yt action bar host and bounced the page off /watch within a millisecond. - e2e verified in a real browser: like flips to unlike with a 200 yt_li=1, persists across a full page reload, unlike restores it, account left clean at 20/0.
…he stacked pr the like line carried its own agent notes, which dropped three sections the icon branch had added. this puts them back so this branch is a strict superset: icon anchor strategies, same-origin client context harvest, and warnOnce logging rules.
package.json and AGENTS.md conflict on every cross-branch pick; take the incoming file and let cherry-pick keep the original message.
the read-only paragraph and the www-scrape fallback description predated both fixes; they contradicted what the extension actually does now.
|
Thanks a lot for this, really solid investigation (the origin-based SAPISIDHASH and the Since v0.2.0 reworked a lot (new player bar, no more
If that scope works for you, a fresh PR against |
the upstream dead note aged out in three weeks: v0.2.0 and v0.2.1 landed, the icon pr got superseded and closed, and the like pr carries a scope offer parked for later.
adds like and unlike for comments and replies.
what changed:
verified in a real browser: like flips to unlike comment on a single 200 with yt_li=1, survives a full page reload, unlike restores it, account left clean. probes come back logged in, drawer opens and the page stays on /watch.
stacked on #1 (the comments icon fix) — this branch contains those commits, merge that one first.