Unless you fetch directly from your browser. It works by getting the YouTube json including the captions track. And then you get the baseUrl to download the xml.
I wrote this webapp that uses this method: it calls Gemini in the background to polish the raw transcript and produce a much better version with punctuation and paragraphs.
https://www.appblit.com/scribe
Open source with code to see how to fetch from YouTube servers from the browser https://ldenoue.github.io/readabletranscripts/