VIDEEOS / app.py
Xhaheen's picture
Update app.py
9eab490 verified
raw
history blame
1.01 kB
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}"
# Creating a pink theme
pink_theme = gr.themes.Default(
primary_hue="pink",
secondary_hue="rose",
)
with gr.Blocks(theme=pink_theme) as interface:
gr.Markdown(
"""
Downloads: YouTube Video Downloader πŸ’–
This app lets you download YouTube videos in the highest available resolution.
Just paste the video URL and click "Download"!
"""
)
with gr.Row():
url_textbox = gr.Textbox(label="Paste the YouTube Video URL Here")
download_button = gr.Button("Download πŸ“₯")
video_output = gr.Video(label="Downloaded Video πŸ“Ί")
download_button.click(download_video, inputs=url_textbox, outputs=video_output)
interface.launch()