question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

subtitles seem enabled, but do not load

See original GitHub issue

Thank you very much for maintianing youtube-transcript-api!

I got stuck with subtutles that do not load, even though I enabled them in video, and switched of content under 18 flag for video and the channel. Maybe these changes take a while to take effect, but I do see subtitles in video.

I try the following code:

from youtube_transcript_api import YouTubeTranscriptApi as YT
video_id = "oUzcoYAwYyI"
YT.get_transcripts(video_id, languages=['ru'])

it fails with:

  File "tc.py", line 3, in <module>
    YT.get_transcripts(video_id, languages=['ru'])
  File "C:\Users\epogr\Anaconda3\lib\site-packages\youtube_transcript_api\_api.py", line 102, in get_transcripts

    raise exception
  File "C:\Users\epogr\Anaconda3\lib\site-packages\youtube_transcript_api\_api.py", line 99, in get_transcripts
    data[video_id] = cls.get_transcript(video_id, languages, proxies, cookies)
  File "C:\Users\epogr\Anaconda3\lib\site-packages\youtube_transcript_api\_api.py", line 128, in get_transcript
    return cls.list_transcripts(video_id, proxies, cookies).find_transcript(languages).fetch()
  File "C:\Users\epogr\Anaconda3\lib\site-packages\youtube_transcript_api\_api.py", line 70, in list_transcripts

    return TranscriptListFetcher(http_client).fetch(video_id)
  File "C:\Users\epogr\Anaconda3\lib\site-packages\youtube_transcript_api\_transcripts.py", line 36, in fetch
    self._extract_captions_json(self._fetch_video_html(video_id), video_id)
  File "C:\Users\epogr\Anaconda3\lib\site-packages\youtube_transcript_api\_transcripts.py", line 48, in _extract_captions_json
    raise TranscriptsDisabled(video_id)
youtube_transcript_api._errors.TranscriptsDisabled:
Could not retrieve a transcript for the video https://www.youtube.com/watch?v=o! This is most likely caused by:

Subtitles are disabled for this video

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!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jdepoixcommented, Jul 11, 2021

Hi @epogrebnyak, get_transcripts takes an Iterable of video IDs. So if you pass in a single string containing a video id it will iterate through each character of that string considering it a video id. You’ll have to either do

YT.get_transcripts([video_id], languages=['ru'])

or

YT.get_transcript(video_id, languages=['ru'])

I think a few people have stumble over this, as get_transcripts gets easily confused with get_transcript. I think I will add an assert to get_transcripts to make sure the passed in video id param is not a string, to make the mistake more obvious.

0reactions
jdepoixcommented, Jul 11, 2021

@epogrebnyak the static methods get_transcript and get_transcripts really only are convenience-wrappers around the TranscriptList object. Look at this example if you want to use TranscriptList objects instead, which give you more options.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Subtitles Not Working? Top Five Most Common Caption ...
But when you load up your video and display your captions, things don't look right. Apostrophes or foreign characters may appear as other ......
Read more >
I'm having trouble with closed captions/subtitles - Hulu Help
If captions/subtitles appear to be out of sync, an error may have occurred when first loading the video. If you restart the stream...
Read more >
How to fix no subtitles in VLC player on Windows 10
Open VLC player and play the video that is supposed to have subtitles. Right-click inside the player and go to Subtitle. The sub-menu...
Read more >
Videos/subtitles not displayed in some browsers (including ...
Confirmed on both Beta2 in Ubuntu & build 176 on Windows XP. Windows 8.1 displays video but do not load subtitles.
Read more >
Troubleshoot captions-related issues – Help Center - Vimeo
If your subtitles or captions don't appear during playback, make sure you've activated the caption file by toggling it on. You can toggle...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found