Repository navigation
feat(transcript): Transcript section in Player, Show / Hide button; fix "always expanded" and the shortcut - #4440
OolaaPleur wants to merge 8 commits into
Conversation
|
hi and thank you! @OolaaPleur we also have appearance : sidebar : transcript (always expanded) (outdated. can you update it?)
|
327c66a to
6aa1dc4
Compare
|
Hi, thanks! Yes, tested in Firefox: switching the options on and off on different kinds of videos — with and without a transcript, with and without chapters (where the transcript is a tab of the "In this video" panel), plus navigating between videos without a page reload. Changes in this update:
I'd also like to do your idea of one "Transcript" section, but this PR is already bigger than its title, so I'd rather send it as a separate PR — after #4432, since both touch the menu. Something like: Existing setting keys would stay, so nobody loses their settings; the shortcut would also stay in Shortcuts → YouTube. Two questions: where should the section live — Player or Appearance → Sidebar? And for the shortcut: should it run every checked action (toggle + copy + download), or have its own checkboxes, separate from the buttons? |
|
ohh thank you! @OolaaPleur |
|
What? - Transcript (Now) (="Expanded captions". So When? - Always? - Only when you pause the video? And/Or only manually? (What key? Button where?) What? - Discovery / Memory yes #4432 (@ajin-varghese-chandy) adds searchable history on the front screen 👍 More: Copy one transcript: Why? To prompt LLM immediately? |
A new "Extra buttons below the player" switch (off by default) adds a button that opens YouTube's transcript panel in the sidebar and closes it on the next click. The existing transcript buttons only copy or download the text, so the panel opens and closes again right away. Opening uses the description's "Show transcript" button (expanding the description first when needed). YouTube shows the transcript either in its own panel or as a tab of the "In this video" panel (engagement-panel-macro-markers-auto-chapters), so an expanded panel counts as the transcript when its target-id contains "transcript" or it holds transcript lines. Closing clicks the X through the panel's #visibility-button wrapper, so it works in any UI language. The option is named toggle_transcript_button so core.js does not call the panel function itself on every settings change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…act spacing and the shortcut - player.js: findOpenTranscriptPanel / isTranscriptOpen / findTranscriptButton / openTranscriptPanel / closeTranscriptPanel / toggleTranscriptPanel, used by the Show / Hide, Copy and Download buttons, the shortcut and "Transcript (always expanded)". Closing also works when the transcript is a tab of "In this video". - "Transcript (always expanded)": opens the "In this video" tab too; after SPA navigation waits until the description belongs to the new video (it used to click the previous video's "Show transcript" button); skips videos without captions; keeps waiting in background tabs; uses only the description's own button. Chapters (always expanded) no longer switches away from it. - Switching the option off closes the transcript wherever it is (core.js). - shortcutTranscript: fixed a ReferenceError on every call; toggles like the button. - Compact spacing: also targets YouTube's current transcript-segment-view-model lines. - Error tooltips: "No transcript" / "Transcript didn't load" instead of the raw "TranscriptError" key. - Tests: tests/unit/transcript-panel.test.js. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Moves the transcript settings into one card (Player > Transcript): Always expanded, Compact spacing and the Show / Hide, Copy and Download buttons. Setting keys are unchanged; the shortcut stays in Shortcuts. Always expanded and "To the side! (No page margin)" still exclude each other. They used to flip each other through nextSibling clicks, which only worked while both switches sat next to each other; they now write the other setting through satus.storage. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Compact spacing already works on any open transcript, including one opened with the Show / Hide button; the menu only hid it until "Always expanded" was on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Compact spacing also set margin-top: 40px and max-height: 69vh on the transcript panel, so the panel started below the top of the video. It only tightens the lines now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
en_US overrides en, so English menus showed "compact spacing" next to "Always expanded". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6aa1dc4 to
e201d05
Compare
…'t double the text On videos with chapters YouTube keeps a hidden copy of the old transcript panel (engagement-panel-searchable-transcript) next to the open one, with the same lines. Copy and Download read every transcript line on the page, so the whole text came out twice. They now read the lines of the open transcript panel (or, with none open, the first panel that holds lines) through transcriptSegmentElements(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A sub-option under Copy Transcript: when on, Copy puts one line per transcript line on the clipboard, each with its time, the same format Download writes. Off by default, so Copy still gives one paragraph. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Found while testing: on videos with chapters YouTube keeps a hidden copy of e022d52 adds a sub-option under Copy Transcript, "With timestamps, one line each": Copy then gives the same |
this also is how our playlist buttons still arent reliably afaik. and appears in a few PRs
...so that it will often be easier to have a shortcut for a query like https://myAI/transcript or https://www.google.com/search?q=transcript and an input to add a question. Results could appear as a popup on the side not overlapping the video. ( Or optionally in the same tab to via API or in a browser sidebar. I think there are several extensions doing that.) Nice. So this could currently have a subsubheading "Buttons below player"
while ultimaely the last 3 items could offer button position/s and shortcut/s all at once. (
This meant to kept the currrent line and the bottom line at a similar position near the center of the window height. Also not sure perfectly sure if the new sidebar.css selecor already work for everybody yet or soon enough but probably (and we would know perfectly if we kept track of the flags automatically #4143 ). hope you like some of the insights and or plan to contribute again. Else of course we need not protract merging one thing at a time and could first generalize these at https://github.com/code-charity/youtube/wiki/Contributing#adding-a-feature |



Adds a button below the player that opens the transcript in the sidebar and closes it on the next click. Copy / Download Transcript only grab the text, so the panel just flashes open and closed.
ImprovedTube.toggleTranscriptPanel()(player.js): if the transcript is open, clicks the panel's X via#visibility-button(works in any UI language); otherwise clicks the description's "Show transcript" button, expanding the description first. No transcript → tooltip shows "Error".engagement-panel-macro-markers-auto-chapters), so an expanded panel counts as the transcript if itstarget-idcontainstranscriptor it holds transcript lines.toggle_transcript_button, not after the function, becausecore.jscallsImprovedTube[camelizedKey]()on every setting change.Tested in Firefox 159 with all three panel variants;
npx jestpasses.Written with help from Claude Code, reviewed and tested by me.