Spaces:
Running
Running
Daniel Amendoeira
commited on
Update tools.py
Browse files
tools.py
CHANGED
@@ -77,11 +77,11 @@ def transcribe_youtube(youtube_url: str) -> str:
|
|
77 |
"""
|
78 |
try:
|
79 |
video_id = extract.video_id(youtube_url)
|
80 |
-
|
81 |
-
transcript = youtube_api.fetch(video_id)
|
82 |
|
83 |
# keep only text
|
84 |
-
text = '\n'.join([s
|
85 |
return text
|
|
|
86 |
except Exception as e:
|
87 |
return f"transcribe_youtube failed: {e}"
|
|
|
77 |
"""
|
78 |
try:
|
79 |
video_id = extract.video_id(youtube_url)
|
80 |
+
transcript = YouTubeTranscriptApi.get_transcript(video_id)
|
|
|
81 |
|
82 |
# keep only text
|
83 |
+
text = '\n'.join([s['text'] for s in transcript])
|
84 |
return text
|
85 |
+
|
86 |
except Exception as e:
|
87 |
return f"transcribe_youtube failed: {e}"
|