Update app.py
Browse files52 unmodified lines535455565758595657606162636452 unmodified lines Returns: - The captions of the video in SRT format, or a message if captions are not available. """ # Extract video ID from YouTube URL (for both regular videos and Shorts) if "shorts" in youtube_url: video_id = youtube_url.split("shorts/")[-1].split("?")[0] else: video_id = youtube_url.split("v=")[-1].split("&")[0] video_id = youtube_url.split("v=")[-1].split("&")[0]
try: # Fetch transcript for the video transcript = YouTubeTranscriptApi.get_transcript(video_id)app.py+6-2