Skip to content

Python code snippet – How to download the captions of a youtube video?

# pip install youtube_transcript_api

from youtube_transcript_api import YouTubeTranscriptApi

video_link = ''

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:
See also  How to check whole number in Python?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.