Spaces:
Build error
Build error
| import gradio as gr | |
| import yt_dlp | |
| def download_video(link): | |
| try: | |
| ydl_opts = { | |
| 'format': 'best', | |
| 'outtmpl': '%(title)s.%(ext)s', | |
| } | |
| with yt_dlp.YoutubeDL(ydl_opts) as ydl: | |
| info_dict = ydl.extract_info(link, download=True) | |
| title = info_dict.get('title', 'Video') | |
| return f"{title} başarıyla indirildi!" | |
| except Exception as e: | |
| return f"Hata oluştu: {str(e)}" | |
| # Gradio arayüzü | |
| interface = gr.Interface( | |
| fn=download_video, | |
| inputs=gr.Textbox(label="YouTube Video Linki"), | |
| outputs="text", | |
| title="YouTube Video İndirici", | |
| description="YouTube linkini girin ve videoyu MP4 formatında indirin.", | |
| ) | |
| #başlat | |
| interface.launch(share=True) | |