Skip to content

feat(transcript): Transcript section in Player, Show / Hide button; fix "always expanded" and the shortcut - #4440

Open
OolaaPleur wants to merge 8 commits into
code-charity:masterfrom
OolaaPleur:feat/toggle-transcript-button
Open

OolaaPleur wants to merge 8 commits into
code-charity:masterfrom
OolaaPleur:feat/toggle-transcript-button

Conversation

@OolaaPleur

@OolaaPleur OolaaPleur commented Nov 1, 2026 •

Copy link
Copy Markdown

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.

  • New switch in Player → Extra buttons below the player: 📜 Show / Hide Transcript (off by default).
  • 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".
  • 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 if its target-id contains transcript or it holds transcript lines.
  • The option is named toggle_transcript_button, not after the function, because core.js calls ImprovedTube[camelizedKey]() on every setting change.
  • English and Russian labels, 11 unit tests.

Tested in Firefox 159 with all three panel variants; npx jest passes.

Written with help from Claude Code, reviewed and tested by me.

@ImprovedTube2

ImprovedTube2 commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

hi and thank you! @OolaaPleur
tested?

we also have appearance : sidebar : transcript (always expanded) (outdated. can you update it?)
another settings structure can be

@OolaaPleur
OolaaPleur force-pushed the feat/toggle-transcript-button branch from 327c66a to 6aa1dc4 Compare November 3, 2026 18:36
@OolaaPleur OolaaPleur changed the title feat: add a Show / Hide Transcript button below the player feat(transcript): Show / Hide Transcript button; update "always expanded" and the shortcut Nov 3, 2026
@OolaaPleur

Copy link
Copy Markdown
Author

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:

  • The transcript logic is now shared helpers in player.js (find / open / close / toggle), used by the new button, Copy, Download, the shortcut and "Transcript (always expanded)". Closing now also works when the transcript is a tab of "In this video".
  • Always expanded works with the "In this video" tab too, no longer shows the previous video's transcript after SPA navigation, does nothing on videos without captions, and waits in background tabs.
  • Compact spacing works with YouTube's current transcript markup.
  • Shortcut: fixed a ReferenceError it threw on every use; it now toggles the transcript like the button.
  • Switching "Transcript" off in the menu closes the panel.
  • Error tooltips read "No transcript" / "Transcript didn't load" instead of TranscriptError.

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:

Transcript
  [ ] Always expand
      [ ] Compact spacing
  [ ] Always archive (#4432)
  Buttons below the player: [x] Show / Hide  [x] Copy  [ ] Download
      [ ] Copy with timestamps (new)
  Shortcut: [ … ]

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?

@ImprovedTube2

Copy link
Copy Markdown
Member

ohh thank you! @OolaaPleur

@ImprovedTube2

Copy link
Copy Markdown
Member

What? - Transcript (Now) (="Expanded captions". So Player: Suptitles intersects in practice. ) ( compact spacing can be enabled without sidebar: transcript, was just visually hidden, assuming most people interested will see when trying out the transcript toggle. )

When? - Always? - Only when you pause the video? And/Or only manually? (What key? Button where?)


What? - Discovery / Memory
Transcripts History & Search

#4432

yes #4432 (@ajin-varghese-chandy) adds searchable history on the front screen 👍
(can merge with analyzer, intersects, times watches, video metadata)


More:

Copy one transcript: Why? To prompt LLM immediately?
Download .txt? Why not always / automatically? @casi-dancasy

@ImprovedTube2

Copy link
Copy Markdown
Member

short-cut / button
already bigger than its title

yes, sorry I was exhausted.

Generally Shortcuts and Buttons are 2ndary categories. For example:
What? - Video Frame (download and/or copy?)
When? - Always At pause? At Keyscene? And manual shortcut and/or Button/s where?

- So our searchresults may not be optimal yet..

where should the section live — Player or Appearance → Sidebar?

👍 good question. Search and popularity can help faster than menus. Tree menus might actually be interlinked maps Like ( Apperance: Buttons = Player: Extra Buttons below the player + Hide Buttons below the Player )

OolaaPleur and others added 6 commits November 4, 2026 08:54
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>
@OolaaPleur
OolaaPleur force-pushed the feat/toggle-transcript-button branch from 6aa1dc4 to e201d05 Compare November 4, 2026 17:21
@OolaaPleur OolaaPleur changed the title feat(transcript): Show / Hide Transcript button; update "always expanded" and the shortcut feat(transcript): Transcript section in Player, Show / Hide button; fix "always expanded" and the shortcut Nov 4, 2026
@OolaaPleur

Copy link
Copy Markdown
Author

Thanks! Answers:

  • When: manually, with the button or the shortcut.
  • Copy: mostly to paste into an LLM.
  • Download: manual on purpose, an automatic file for every video would be clutter.

Added a Transcript section under Player: Always expanded, Compact spacing and the Show / Hide, Copy and Download buttons. Setting keys are unchanged. Shortcuts stay in Shortcuts, like the rest of the app.

7

Compact spacing is now independent of Always expanded, so it also works on a transcript opened with the button. It no longer adds a 40px top margin to the panel, which pushed it below the top of the video.

OolaaPleur and others added 2 commits November 10, 2026 23:03
…'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>
@OolaaPleur

OolaaPleur commented Nov 10, 2026 •

Copy link
Copy Markdown
Author

Found while testing: on videos with chapters YouTube keeps a hidden copy of 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. 993332c reads the lines of the open panel only (or the first panel that has lines). Smart Speed's transcript source reads the rows the same page-wide way (around player.js:3966), so it probably sees them twice too; I left it alone here. ( @AryaXDG )

e022d52 adds a sub-option under Copy Transcript, "With timestamps, one line each": Copy then gives the same [time] text lines as Download. Off by default, so Copy still gives one paragraph. Tests added for both.

@ImprovedTube2 ImprovedTube2 added the Knowledge Base / Documentation for contributors We should repurpose this for future reference / Wiki / Education / Introduction label Nov 16, 2026
@ImprovedTube2

Copy link
Copy Markdown
Member

keeps a hidden copy

this also is how our playlist buttons still arent reliably afaik. and appears in a few PRs


Copy one transcript: Why? To prompt LLM immediately?

...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.)


7

Nice. So this could currently have a subsubheading "Buttons below player"
(

Shortcuts and Buttons are 2ndary categories
)

while ultimaely the last 3 items could offer button position/s and shortcut/s all at once.
At the same time, a copy of the two buttons two levels down the tree (appearance > sidebar) might bother less than some people will already look for them there now. (Static menus need not change)

(

Tree menus might actually be interlinked maps Like ( Apperance: Buttons = Player: Extra Buttons below the player + Hide Buttons below the Player )


It no longer adds a 40px top margin to the panel

This meant to kept the currrent line and the bottom line at a similar position near the center of the window height.
Reducing pixels means more fits into the center / focus and looking at edges ( top ) is not required anymore.


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 ).
The old selector probably works for part of the users still, so we could hoard fallbacks where free and compatible.
Generally we may move (back) expensive CSS to be injected conditionally from JS (We can also allow complete low code rule syntax report like uBlock origin in future including JS variables. Both can coexist.)


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

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

Labels

Knowledge Base / Documentation for contributors We should repurpose this for future reference / Wiki / Education / Introduction

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants