Spaces:
Running
Running
from pytubefix import YouTube | |
from pytubefix.cli import on_progress | |
import gradio as gr | |
def download(url): | |
try: | |
yt = YouTube(url) | |
video_title = yt.title | |
video_path = f"{video_title}.mp4" | |
ys = yt.streams.get_highest_resolution() | |
ys.download() | |
return f"Downloaded: {video_title}.mp4" | |
except Exception as e: | |
return f"Error: {str(e)}" | |
# Create Gradio Interface | |
iface = gr.Interface( | |
fn=download, | |
inputs=gr.Textbox(label="YouTube Video URL", placeholder="Enter YouTube video URL..."), | |
outputs=gr.Textbox(label="Download Status"), | |
title="YouTube Video Downloader", | |
description="Enter the URL of a YouTube video to download it in the highest resolution." | |
) | |
# Launch the web app | |
iface.launch() |