yt-dlp / app.py
Blane187's picture
Update app.py
c247b16 verified
raw
history blame
668 Bytes
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()