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

the video upload in english language it will summarize but other language video is not summarizing #300

Closed sophiaj19 closed 3 days ago

sophiaj19 commented 6 days ago

Is your feature request related to a problem? Please describe.

can u give any solution to fix this error 2024-06-28 17:40:29.745 Uncaught app exception Traceback (most recent call last): File "C:\Users\James Prajwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 589, in _run_script exec(code, module.dict) File "C:\Users\James Prajwal\youtube_transcript_summarizer\app.py", line 49, in transcript_text=extract_transcript_details(youtube_link) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\James Prajwal\youtube_transcript_summarizer\app.py", line 31, in extract_transcript_details raise e File "C:\Users\James Prajwal\youtube_transcript_summarizer\app.py", line 22, in extract_transcript_details transcript_text=YouTubeTranscriptApi.get_transcript(video_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\James Prajwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\youtube_transcript_api_api.py", line 137, in get_transcript return cls.list_transcripts(video_id, proxies, cookies).find_transcript(languages).fetch(preserve_formatting=preserve_formatting)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\James Prajwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\youtube_transcript_api_transcripts.py", line 183, in find_transcript return self._find_transcript(language_codes, [self._manually_created_transcripts, self._generated_transcripts]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\James Prajwal\AppData\Local\Programs\Python\Python311\Lib\site-packages\youtube_transcript_api_transcripts.py", line 219, in _find_transcript raise NoTranscriptFound( youtube_transcript_api._errors.NoTranscriptFound: Could not retrieve a transcript for the video https://www.youtube.com/watch?v=rJ1Qao09CFI&t! This is most likely caused by:

No transcripts were found for any of the requested language codes: ('en',)

For this video (rJ1Qao09CFI&t) transcripts are available in the following languages:

(MANUALLY CREATED) None

(GENERATED)

(TRANSLATION LANGUAGES)

If you are sure that the described cause is not responsible for this error and that a transcript should be retrievable, please create an issue at https://github.com/jdepoix/youtube-transcript-api/issues. Please add which version of youtube_transcript_api you are using and provide the information needed to replicate the error. Also make sure that there are no open issues which already describe your problem!

jdepoix commented 3 days ago

Hi @sophiaj19, as the error message indicates, there is no english subtitles available for this video. The method get_transcript will always use en if no language is specified, so make sure to specify the language you want to retrieve the transcript in, if you want a non english language.