As of 4 days ago, you were able to send a GET request to or visit https://video.google.com/timedtext?lang=en&v={youtubeVideoId} and receive an xml response containing the caption track of a given youtube video. Does anyone know if this support has been removed, because as of tonight, it no longer provides the xml response with the captions, the page is simply empty for every video. There were numerous videos this worked for 4 days ago that no longer work. Thanks in advance
If your video doesn't generate automatic captions, it could be due to one or more of the following reasons: The captions aren't available yet due to processing complex audio in the video. Automatic captions don't support the language in the video. The video is too long.
Click your profile picture at the top right corner. Switch to the Playback and performance section at the left. Uncheck the option named Always show captions. Refresh the page and then re-check the option.
Click your profile picture . Click Settings . From the left-hand menu, click Playback and performance. Check or uncheck Always show captions.
On your computer, sign in to drive.google.com. Click the video you want to add captions to. Click More Manage caption tracks. Click Add new caption tracks. Click Select file and choose a caption or transcript file. Choose the language for the captions and a name for the track.
You can make your video content available to a larger audience when you add captions. If you want to reach deaf, hard-of-hearing viewers, or speakers of different languages, captions help these groups understand your videos. You can use two types of caption files:
Caption file (recommended): This file contains the text and other information to time your captions with your video. Transcript file: This file only contains the text. If you upload a transcript, the video player will have to determine when the words should be displayed.
Click Add new caption tracks. Click Select file and choose a caption or transcript file. Choose the language for the captions and a name for the track. Click Upload. Edit caption tracks
Captions in default language (single available or English it seems):
To get captions of a YouTube video just use this Linux command (using curl and base64):
curl -s 'https://www.youtube.com/youtubei/v1/get_transcript?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8' -H 'Content-Type: application/json' --data-raw "{\"context\":{\"client\":{\"clientName\":\"WEB\",\"clientVersion\":\"2.2021111\"}},\"params\":\"$(printf '\n\x0bVIDEO_ID' | base64)\"}"
Change the VIDEO_ID
parameter with the one interesting you.
Note: the key isn't a YouTube Data API v3 one, it is the first public (tested on some computers in different countries) one coming if you curl https://www.youtube.com/ | grep AIzaSy
Note: If interested in how I reverse-engineered this YouTube feature, say it in the comments and I would write a paragraph to explain
Captions in desired language if available:
YouTube made things tricky maybe to lose you at this step, so follow me: the only thing we have to change is the params
value which is base64 encoded data which is in addition to weird characters also containing base64 data which also contains weird characters.
\n\x00\x12\x02LANGUAGE_INITIALS\x1a\x00
in base64 with for instance A=$(printf '\n\x00\x12\x02LANGUAGE_INITIALS\x1a\x00' | base64)
(don't forget to change LANGUAGE_INITIALS
to your language initials wanted ru
for instance). The result for ru
is CgASAnJ1GgA=
=
to %3D
with for instance B=$(printf %s $A | jq -sRr @uri)
. The result for ru
is CgASAnJ1GgA%3D
%
to two %
with for instance C=$(echo $B | sed 's/%/%%/')
. The result for ru
is CgASAnJ1GgA%%3D
\n\x0bVIDEO_ID\x12\x0e$C
(don't forget to change VIDEO_ID
to your video id, with $C
the result of the previous step) with for instance D=$(printf "\n\x0bVIDEO_ID\x12\x0e$C" | base64)
. The result for ru
and lo0X2ZdElQ4
is CgtsbzBYMlpkRWxRNBIOQ2dBU0FuSjFHZ0ElM0Q=
params
value from the Captions in default language section: curl -s 'https://www.youtube.com/youtubei/v1/get_transcript?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8' -H 'Content-Type: application/json' --data-raw "{\"context\":{\"client\":{\"clientName\":\"WEB\",\"clientVersion\":\"2.2021111\"}},\"params\":\"$D\"}"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With