Answers for "how to download the captions of a youtube video"

1

how to download the captions of a youtube video

# pip install youtube_transcript_api

from youtube_transcript_api import YouTubeTranscriptApi

video_link = 'https://www.youtube.com/watch?v=Vdj1TNWJAZ4&t=8s'

video_id = video_link.split('watch?v=')[1]

subtitle = YouTubeTranscriptApi.get_transcript(video_id=video_id, languages=['en'])

# you can do anything with downloaded caption.
# for example:
print(subtitle)
Posted by: Guest on September-24-2021

Code answers related to "how to download the captions of a youtube video"

Python Answers by Framework

Browse Popular Code Answers by Language