Identify original language in YouTube metadata
I want to be able to identify the original language of a YouTube video via the API (e.g., in the /v1/youtube/video metadata endpoint). Currently, I have to provide a 'lang' parameter to get consistent results, but I don't know which language is the original one from the 'transcriptLanguages' list. This would help ensure I always get the correct original transcript.
Log in to comment and vote
Comments2
Rafal
Jul 20
The transcript endpoint now returns a default language if the
langparameter is not provided.liam.c.murray
May 1
I am struggling with this as well. This video is in Spanish and if I pass no language parameter it returns back an Arabic transcript.
https://www.youtube.com/watch?v=VqX0PLZy2jI
Claude tells be that the kind=ASR is the most reliable signal:
The most authoritative signal is the ASR (auto-speech-recognition) caption track's language code. ASR is generated by YouTube running speech recognition on the actual audio, so its language_code is whatever the audio sounds like — the producer's metadata claims don't enter into it. YouTube's Show transcript UI uses this same caption track metadata.
Each caption track in YouTube's player config has:
language_code ("es", "en", …)
kind — "asr" for auto, empty/absent for manually uploaded
name — display label
For this video, you'd see something like:
[ { lang: "es", kind: "asr", name: "Spanish (auto-generated)" }, { lang: "en", kind: undefined, name: "English" } // manually published by María ]
The kind: "asr" track tells us the spoken language is es.
snippet.defaultAudioLanguage (and snippet.defaultLanguage) from the Data API v3 videos.list is unreliable
For seeing ASR annotation Claude recommended youtubei.js
Innertube.getInfo(videoId) returns info.captions.caption_tracks[] with kind and language_code (youtubei.js) and
metadata endpoint (/youtubei/v1/player) is a separate request and is generally not blocked