jdepoix / youtube-transcript-api

This is a python API which allows you to get the transcript/subtitles for a given YouTube video. It also works for automatically generated subtitles and it does not require an API key nor a headless browser, like other selenium based solutions do!
MIT License
2.55k stars 280 forks source link

Does not detect variants of English subtitle like English-India, English-UK, etc. #197

Closed sshenoy03 closed 1 year ago

sshenoy03 commented 1 year ago

To Reproduce

Steps to reproduce the behavior: https://youtu.be/WngejdXGvnU Try running the api on this video , its subtitles are in English-India , it wont work properly

Which Python version are you using?

Which version of youtube-transcript-api are you using?

What code / cli command are you executing?

Expected behavior

Should have displayed the transcript just like ordinary English subtitle but fails to do so

Actual behaviour

Declares subtitle not available

jdepoix commented 1 year ago

I am not sure what you are executing, since you didn't provide any code or error messages. Therefore, I can only assume that you are trying to retrieve the transcript without specifying which language you want. The default is en, however, English-India is en-IN, so the module is correct in saying that there is no English subtitle.

You have to run youtube_transcript_api WngejdXGvnU --languages en-IN or YouTubeTranscriptApi.get_transcript("WngejdXGvnU", languages=["en-IN"])