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.54k stars 279 forks source link

Remove unused code for translation languages in TranscriptList constructor #240

Closed ahmedJaafari closed 6 months ago

ahmedJaafari commented 6 months ago

For videos without Translation (new YouTube version) it always raises an error.

jdepoix commented 6 months ago

Hi @ahmedJaafari, could you please elaborate on what exactly is failing? I don't know about a new YouTube version, could you share a link?

Either way, you can't simply remove the initialization and always initialize with an empty list, as this will break a lot of code (as well as the test suite) depending on this list being populated. If there actually is a problem caused by a new version of YouTube, we will have to find a different solution.

0xRaduan commented 6 months ago

hey, @jdepoix, there is an issue with what seems like a new format.

example video which results in KeyError on 'translationLanguages': https://www.youtube.com/watch?v=KUnclLt2RqQ

Could you please advise on how to hotfix it? I initially thought it's for non-english videos, but seems like it is failing more often, than I initially anticipated.

jdepoix commented 6 months ago

Hey @0xRaduan, could you please elaborate which code you are executing to cause this error? I cannot replicate this. If I run YouTubeTranscriptApi.get_transcript("KUnclLt2RqQ") I don't get an KeyError and I get the full list of translation languages.

0xRaduan commented 6 months ago

fair, @jdepoix – seems like a temporary problem on my side, I am not facing problems with KUnclLt2RqQ anymore.

jdepoix commented 6 months ago

Okay, I will close this PR then. If you encounter the problem again open an issue and then we can discuss a potential solution.