File size: 584 Bytes
c6f2536
5b9992a
c6f2536
5b9992a
c6f2536
5b9992a
 
c6f2536
5b9992a
 
 
 
 
 
 
 
 
c6f2536
5b9992a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
from youtube_transcript_api import YouTubeTranscriptApi

def fetch_transcript(video_id):
    try:
        transcript = YouTubeTranscriptApi.get_transcript(video_id)
        return '\n'.join([f"{entry['text']}" for entry in transcript])
    except Exception as e:
        return f"Error: {str(e)}"

iface = gr.Interface(
    fn=fetch_transcript,
    inputs=gr.Textbox(label="YouTube Video ID"),
    outputs=gr.Textbox(label="Transcript"),
    title="YouTube Transcript Fetcher",
    description="Enter a YouTube video ID to fetch its transcript."
)

iface.launch()