Manasa1 commited on
Commit
0ce9a88
·
verified ·
1 Parent(s): 470bc98

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -14,9 +14,9 @@ def get_youtube_captions(youtube_url):
14
  - The captions of the video in SRT format, or a message if captions are not available.
15
  """
16
  # Extract video ID from YouTube URL (for both regular videos and Shorts)
17
- if "shorts" in youtube_url:
18
- # For YouTube Shorts, extract the video ID after "shorts/"
19
- video_id = youtube_url.split("shorts/")[-1].split("?")[0]
20
  else:
21
  # For regular YouTube videos, extract the video ID after "v="
22
  video_id = youtube_url.split("v=")[-1].split("&")[0]
 
14
  - The captions of the video in SRT format, or a message if captions are not available.
15
  """
16
  # Extract video ID from YouTube URL (for both regular videos and Shorts)
17
+ if "si=" in youtube_url:
18
+ # For YouTube Shorts or URLs with "si=", extract the video ID after "si="
19
+ video_id = youtube_url.split("si=")[-1].split("?")[0]
20
  else:
21
  # For regular YouTube videos, extract the video ID after "v="
22
  video_id = youtube_url.split("v=")[-1].split("&")[0]