How to share Youtube videos with a specific language subtitles turned on
Many Youtube videos have subtitles. How do you share a Youtube video that plays with a specific language subtitle turned on?
To do that, we need to build a special URL for that video:
https://www.youtube.com/embed/<id>?cc_lang_pref=<code>&cc_load_policy=1
where <id>
is ID of the video and <code>
is the language code of the subtitle 1.
The ID of the video comes from the video’s URL. For example, if you click share button on this video, you will see that its URL is:
https://youtu.be/qp0HIF3SfI4
The qp0HIF3SfI4
part of the URL is the ID of the video.
The language code of the subtitles can be found by using yt-dlp. yt-dlp is a command line tool:
yt-dlp --list-subs https://youtu.be/qp0HIF3SfI4
The command asks Youtube what subtitles are available for the video and returns:
[info] Available subtitles for qp0HIF3SfI4:
Language Name Formats
sq Albanian vtt, ttml, srv3, srv2, srv1, json3
ar Arabic vtt, ttml, srv3, srv2, srv1, json3
hy Armenian vtt, ttml, srv3, srv2, srv1, json3
bn Bangla vtt, ttml, srv3, srv2, srv1, json3
bg Bulgarian vtt, ttml, srv3, srv2, srv1, json3
ca Catalan vtt, ttml, srv3, srv2, srv1, json3
zh-CN Chinese (China) vtt, ttml, srv3, srv2, srv1, json3
zh-TW Chinese (Taiwan) vtt, ttml, srv3, srv2, srv1, json3
hr Croatian vtt, ttml, srv3, srv2, srv1, json3
cs Czech vtt, ttml, srv3, srv2, srv1, json3
da Danish vtt, ttml, srv3, srv2, srv1, json3
nl Dutch vtt, ttml, srv3, srv2, srv1, json3
en English vtt, ttml, srv3, srv2, srv1, json3
eo Esperanto vtt, ttml, srv3, srv2, srv1, json3
et Estonian vtt, ttml, srv3, srv2, srv1, json3
fr French vtt, ttml, srv3, srv2, srv1, json3
ka Georgian vtt, ttml, srv3, srv2, srv1, json3
de German vtt, ttml, srv3, srv2, srv1, json3
el Greek vtt, ttml, srv3, srv2, srv1, json3
iw Hebrew vtt, ttml, srv3, srv2, srv1, json3
hi Hindi vtt, ttml, srv3, srv2, srv1, json3
hu Hungarian vtt, ttml, srv3, srv2, srv1, json3
id Indonesian vtt, ttml, srv3, srv2, srv1, json3
it Italian vtt, ttml, srv3, srv2, srv1, json3
ja Japanese vtt, ttml, srv3, srv2, srv1, json3
ko Korean vtt, ttml, srv3, srv2, srv1, json3
ku Kurdish vtt, ttml, srv3, srv2, srv1, json3
lv Latvian vtt, ttml, srv3, srv2, srv1, json3
lt Lithuanian vtt, ttml, srv3, srv2, srv1, json3
mk Macedonian vtt, ttml, srv3, srv2, srv1, json3
mr Marathi vtt, ttml, srv3, srv2, srv1, json3
mn Mongolian vtt, ttml, srv3, srv2, srv1, json3
no Norwegian vtt, ttml, srv3, srv2, srv1, json3
fa Persian vtt, ttml, srv3, srv2, srv1, json3
pl Polish vtt, ttml, srv3, srv2, srv1, json3
pt-BR Portuguese (Brazil) vtt, ttml, srv3, srv2, srv1, json3
pt-PT Portuguese (Portugal) vtt, ttml, srv3, srv2, srv1, json3
ro Romanian vtt, ttml, srv3, srv2, srv1, json3
ru Russian vtt, ttml, srv3, srv2, srv1, json3
sr Serbian vtt, ttml, srv3, srv2, srv1, json3
sk Slovak vtt, ttml, srv3, srv2, srv1, json3
sl Slovenian vtt, ttml, srv3, srv2, srv1, json3
es Spanish vtt, ttml, srv3, srv2, srv1, json3
sv Swedish vtt, ttml, srv3, srv2, srv1, json3
ta Tamil vtt, ttml, srv3, srv2, srv1, json3
th Thai vtt, ttml, srv3, srv2, srv1, json3
tr Turkish vtt, ttml, srv3, srv2, srv1, json3
uk Ukrainian vtt, ttml, srv3, srv2, srv1, json3
vi Vietnamese vtt, ttml, srv3, srv2, srv1, json3
We can see that “zh-TW Chinese (Taiwan)” is available. zh-TW
is the language code for <code>
. So if I want to play the video with traditional Chinese subtitled turn on:
https://www.youtube.com/embed/qp0HIF3SfI4?cc_lang_pref=zh-TW&cc_load_policy=1