Spaces:
Build error
Build error
import gradio as gr | |
import yt_dlp as youtube_dl | |
def download_youtube_videos(urls): | |
ydl_opts = { | |
'format': 'best', | |
'outtmpl': '%(title)s.%(ext)s', | |
} | |
with youtube_dl.YoutubeDL(ydl_opts) as ydl: | |
ydl.download(urls) | |
return "다운로드 완료!" | |
def start_download(urls): | |
url_list = urls.split('\n') | |
download_youtube_videos(url_list) | |
return "모든 비디오가 다운로드 되었습니다." | |
iface = gr.Interface( | |
fn=start_download, | |
inputs=gr.inputs.Textbox(lines=10, placeholder="여기에 YouTube 링크를 입력하세요 (각 링크를 줄바꿈으로 구분)"), | |
outputs="text", | |
title="YouTube 비디오 다운로드", | |
description="여러 YouTube 비디오 링크를 입력하고 다운로드 버튼을 눌러 비디오를 다운로드하세요." | |
) | |
if __name__ == "__main__": | |
iface.launch() | |