Daniel Amendoeira commited on
Commit
e14587f
·
verified ·
1 Parent(s): 38a896e

Update tools.py

Browse files
Files changed (1) hide show
  1. tools.py +3 -3
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
- youtube_api = YouTubeTranscriptApi()
81
- transcript = youtube_api.fetch(video_id)
82
 
83
  # keep only text
84
- text = '\n'.join([s.text for s in transcript.snippets])
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}"