Update app.py
Browse files
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 "
|
18 |
-
# For YouTube Shorts, extract the video ID after "
|
19 |
-
video_id = youtube_url.split("
|
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]
|