Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import yt_dlp as youtube_dl
|
|
|
3 |
|
4 |
def download_youtube_video(youtube_url):
|
5 |
"""Downloads a YouTube video using yt_dlp and returns the downloaded file path."""
|
@@ -22,13 +23,16 @@ def download_youtube_video(youtube_url):
|
|
22 |
|
23 |
def app(video_link):
|
24 |
video_path = download_youtube_video(video_link)
|
25 |
-
|
|
|
|
|
|
|
26 |
|
27 |
with gr.Blocks() as interface:
|
28 |
gr.Markdown("## YouTube Video Downloader")
|
29 |
video_link = gr.Textbox(label="Enter YouTube link 🔗 To Download Video⬇️")
|
30 |
download_button = gr.Button("Download")
|
31 |
-
output = gr.
|
32 |
|
33 |
download_button.click(fn=app, inputs=video_link, outputs=output)
|
34 |
|
|
|
1 |
import gradio as gr
|
2 |
import yt_dlp as youtube_dl
|
3 |
+
import os
|
4 |
|
5 |
def download_youtube_video(youtube_url):
|
6 |
"""Downloads a YouTube video using yt_dlp and returns the downloaded file path."""
|
|
|
23 |
|
24 |
def app(video_link):
|
25 |
video_path = download_youtube_video(video_link)
|
26 |
+
if video_path:
|
27 |
+
return video_path
|
28 |
+
else:
|
29 |
+
return "An error occurred during the download."
|
30 |
|
31 |
with gr.Blocks() as interface:
|
32 |
gr.Markdown("## YouTube Video Downloader")
|
33 |
video_link = gr.Textbox(label="Enter YouTube link 🔗 To Download Video⬇️")
|
34 |
download_button = gr.Button("Download")
|
35 |
+
output = gr.File(label="Downloaded Video Path")
|
36 |
|
37 |
download_button.click(fn=app, inputs=video_link, outputs=output)
|
38 |
|