Rivalcoder commited on
Commit
3befc55
·
1 Parent(s): 898f1d6
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -10,14 +10,14 @@ ytt_api = YouTubeTranscriptApi(
10
  )
11
  )
12
 
13
- # Function to fetch YouTube transcript using the video ID
14
  def fetch_transcript(video_id: str):
15
  try:
16
  # Fetch transcript
17
  transcript = ytt_api.fetch(video_id)
18
- print(transcript)
19
- # Format the transcript into a readable text
20
- return transcript
21
  except Exception as e:
22
  return f"Error fetching transcript: {str(e)}"
23
 
 
10
  )
11
  )
12
 
13
+ # Function to fetch and format YouTube transcript using the video ID
14
  def fetch_transcript(video_id: str):
15
  try:
16
  # Fetch transcript
17
  transcript = ytt_api.fetch(video_id)
18
+ # Extract and join only the text fields
19
+ full_text = " ".join([entry['text'] for entry in transcript])
20
+ return full_text
21
  except Exception as e:
22
  return f"Error fetching transcript: {str(e)}"
23