yt-dlp / app.py
Blane187's picture
Update app.py
d837a6a verified
raw
history blame
742 Bytes
import gradio as gr
import yt_dlp
import os
def download_youtube_wav(url, custom_name):
ydl_opts = {
'format': 'bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'wav',
'preferredquality': '192',
}],
'outtmpl': custom_name + '.%(ext)s',
}
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
ydl.download([url])
return f'File "{custom_name}.wav" telah di-download!'
iface = gr.Interface(
fn=download_youtube_wav,
inputs=['text', 'text'],
outputs='text',
title='YouTube to WAV Downloader',
description='Enter the YouTube URL and custom name for the WAV file you want to download.'
)
iface.launch()