File size: 549 Bytes
4f67e8c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
from pytube import YouTube

def download_video(url):
  try:
    yt = YouTube(url)
    highest_res_stream = yt.streams.get_highest_resolution()
    video_path = highest_res_stream.download()
    return video_path
  except Exception as e:
    return f"Error: {e}"

iface = gr.Interface(
    fn=download_video,
    inputs=gr.Textbox(label="YouTube Video URL"),
    outputs=gr.Video(label="Downloaded Video"),
    title="YouTube Video Downloader",
    description="Enter the URL of a YouTube video to download it.",
)

iface.launch()