Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,29 +1,31 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
|
3 |
-
|
4 |
-
def download_video(link):
|
5 |
-
try:
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
return "
|
15 |
-
except Exception as e:
|
16 |
-
return f"Hata oluştu: {str(e)}"
|
17 |
-
|
18 |
-
# Gradio arayüzü oluştur
|
19 |
-
interface = gr.Interface(
|
20 |
-
fn=download_video,
|
21 |
-
inputs=gr.Textbox(label="YouTube Video Linki"),
|
22 |
-
outputs="text",
|
23 |
-
title="YouTube Video İndirici",
|
24 |
-
description="YouTube linkini girin ve MP4 formatında indirin.",
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import yt_dlp
|
3 |
+
|
4 |
+
def download_video(link):
|
5 |
+
try:
|
6 |
+
ydl_opts = {
|
7 |
+
'format': 'best',
|
8 |
+
'outtmpl': '%(title)s.%(ext)s',
|
9 |
+
}
|
10 |
+
|
11 |
+
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
12 |
+
info_dict = ydl.extract_info(link, download=True)
|
13 |
+
title = info_dict.get('title', 'Video')
|
14 |
+
return f"{title} başarıyla indirildi!"
|
15 |
+
except Exception as e:
|
16 |
+
return f"Hata oluştu: {str(e)}"
|
17 |
+
|
18 |
+
# Gradio arayüzü oluştur
|
19 |
+
interface = gr.Interface(
|
20 |
+
fn=download_video,
|
21 |
+
inputs=gr.Textbox(label="YouTube Video Linki"),
|
22 |
+
outputs="text",
|
23 |
+
title="YouTube Video İndirici",
|
24 |
+
description="YouTube linkini girin ve videoyu MP4 formatında indirin.",
|
25 |
+
examples=[
|
26 |
+
["https://www.youtube.com/watch?v=dQw4w9WgXcQ"]
|
27 |
+
]
|
28 |
+
)
|
29 |
+
|
30 |
+
# Arayüzü başlat
|
31 |
+
interface.launch(share=True)
|