SPACERUNNER99 commited on
Commit
6c575ba
·
verified ·
1 Parent(s): 91eff83

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pytubefix import YouTube
2
+ from pytubefix.cli import on_progress
3
+ import gradio as gr
4
+
5
+ def download(url):
6
+ try:
7
+ yt = YouTube(url)
8
+ video_title = yt.title
9
+ video_path = f"{video_title}.mp4"
10
+ ys = yt.streams.get_highest_resolution()
11
+ ys.download()
12
+ return f"Downloaded: {video_title}.mp4"
13
+ except Exception as e:
14
+ return f"Error: {str(e)}"
15
+
16
+ # Create Gradio Interface
17
+ iface = gr.Interface(
18
+ fn=download,
19
+ inputs=gr.Textbox(label="YouTube Video URL", placeholder="Enter YouTube video URL..."),
20
+ outputs=gr.Textbox(label="Download Status"),
21
+ title="YouTube Video Downloader",
22
+ description="Enter the URL of a YouTube video to download it in the highest resolution."
23
+ )
24
+
25
+ # Launch the web app
26
+ iface.launch()