Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pytube import YouTube
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
def download_video(video_url):
|
5 |
+
try:
|
6 |
+
yt = YouTube(video_url)
|
7 |
+
video_title = yt.title
|
8 |
+
yt.streams.get_highest_resolution().download()
|
9 |
+
return f"✅ Downloaded: {video_title}"
|
10 |
+
except Exception as e:
|
11 |
+
return f"❌ Error: {str(e)}"
|
12 |
+
|
13 |
+
# Create Gradio interface
|
14 |
+
interface = gr.Interface(
|
15 |
+
fn=download_video,
|
16 |
+
inputs=gr.Textbox(label="Enter YouTube Video URL"),
|
17 |
+
outputs=gr.Textbox(label="Status"),
|
18 |
+
title="YouTube Video Downloader",
|
19 |
+
description="Enter a YouTube URL to download the video."
|
20 |
+
)
|
21 |
+
|
22 |
+
interface.launch()
|