3

Until today I was using this URL to get captions from YouTube videos:

https://video.google.com/timedtext?lang=${lang}&v=${id}

For example https://video.google.com/timedtext?lang=zh&v=rIZNQwCfeig.

This was always working before, but as of today it started returning a blank response.

Did the API change recently? Is there a new way to get captions from YouTube videos?

Peter Olson
  • 139,199
  • 49
  • 202
  • 242
  • Same https://stackoverflow.com/questions/69937867/google-video-no-longer-able-to-retrieve-captions – Kos Nov 13 '21 at 13:36

1 Answers1

2

Unfortunately, there are no signs that this API will get back to life.

I ended up using youtube-dl instead:

youtube-dl --write-sub --sub-lang $LANG_CODE --skip-download --sub-format ttml \
  https://www.youtube.com/watch?v=$YOUTUBE_ID

This will save captions in ttml format to a file, you'll need to read its content and delete that file manually. It is a bit more complicated than before, but still much easier than using the official YouTube Captions API.

Limon Monte
  • 52,539
  • 45
  • 182
  • 213