import gradio as gr import youtube_download import time def download_video(url): ydl_opts = { 'format': 'best', 'outtmpl': '%(title)s.%(ext)s', 'postprocessors': [{ 'key': 'FFmpegVideoConvertor', 'preferedformat': 'mp4', }], } with youtube_dl.YoutubeDL(ydl_opts) as ydl: ydl.download([url]) time.sleep(10) # Simulate delay for downloading return f"Video downloaded from {url}" iface = gr.Interface(fn=download_video, inputs=gr.Textbox(label="Enter YouTube Video URL"), outputs=gr.Textbox(label="Download Status"), title="YouTube Video Downloader", description="Paste the link to the YouTube video and click the button to download it. The video will be available for download after 10 seconds.", theme="default") iface.launch()