Spaces:
Running
Running
File size: 668 Bytes
29ded09 281bdba 29ded09 eeb7f74 281bdba 863c552 29ded09 eeb7f74 29ded09 eeb7f74 29ded09 c247b16 eeb7f74 29ded09 eeb7f74 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import gradio as gr
import yt_dlp
def download_video(url):
ydl_opts = {
'format': 'best',
'outtmpl': 'downloads/%(title)s.%(ext)s',
}
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
info_dict = ydl.extract_info(url, download=True)
video_title = info_dict.get('title', None)
video_filename = ydl.prepare_filename(info_dict)
return video_filename
interface = gr.Interface(
fn=download_video,
inputs=gr.Textbox(lines=1, placeholder="Enter video URL here..."),
outputs="text",
title="Video Downloader",
description="Enter a video URL from a supported site to download the video."
)
interface.launch()
|