Spaces:
Sleeping
Sleeping
httpdaniel commited on
Commit ·
fd2d49f
1
Parent(s): b13d50e
Adding exception handling
Browse files
app.py
CHANGED
|
@@ -42,10 +42,12 @@ def get_video_metadata(video_id):
|
|
| 42 |
|
| 43 |
|
| 44 |
def get_transcript_content(video_id):
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
|
|
|
|
|
|
| 49 |
|
| 50 |
|
| 51 |
def parse_transcript(transcript):
|
|
|
|
| 42 |
|
| 43 |
|
| 44 |
def get_transcript_content(video_id):
|
| 45 |
+
try:
|
| 46 |
+
transcript = YouTubeTranscriptApi.get_transcript(video_id)
|
| 47 |
+
transcript_content = parse_transcript(transcript)
|
| 48 |
+
return transcript_content
|
| 49 |
+
except Exception as e:
|
| 50 |
+
raise e
|
| 51 |
|
| 52 |
|
| 53 |
def parse_transcript(transcript):
|