bale_clean / app.py
SPACERUNNER99's picture
Update app.py
4724b71 verified
raw
history blame
845 Bytes
from pytubefix import YouTube
from pytubefix.cli import on_progress
import gradio as gr
def download(url):
try:
yt = YouTube(url, on_progress_callback = on_progress)
print(yt.title)
video_path = f"{yt.title}.mp4"
ys = yt.streams.get_highest_resolution()
print(ys)
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()