Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import yt_dlp
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
-
def download_youtube_wav(url, custom_name
|
| 5 |
ydl_opts = {
|
| 6 |
'format': 'bestaudio/best',
|
| 7 |
'postprocessors': [{
|
|
@@ -9,21 +9,20 @@ def download_youtube_wav(url, custom_name, custom_directory):
|
|
| 9 |
'preferredcodec': 'wav',
|
| 10 |
'preferredquality': '192',
|
| 11 |
}],
|
| 12 |
-
'outtmpl': f'{
|
| 13 |
}
|
| 14 |
|
| 15 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
| 16 |
ydl.download([url])
|
| 17 |
-
|
| 18 |
-
return f'Download complete! File saved as {custom_name}.wav
|
| 19 |
|
| 20 |
iface = gr.Interface(
|
| 21 |
fn=download_youtube_wav,
|
| 22 |
-
inputs=['text', 'text'
|
| 23 |
-
outputs=
|
| 24 |
title='YouTube WAV Downloader',
|
| 25 |
-
description='Enter the YouTube URL
|
| 26 |
)
|
| 27 |
|
| 28 |
-
|
| 29 |
-
iface.launch()
|
|
|
|
| 1 |
import yt_dlp
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
+
def download_youtube_wav(url, custom_name):
|
| 5 |
ydl_opts = {
|
| 6 |
'format': 'bestaudio/best',
|
| 7 |
'postprocessors': [{
|
|
|
|
| 9 |
'preferredcodec': 'wav',
|
| 10 |
'preferredquality': '192',
|
| 11 |
}],
|
| 12 |
+
'outtmpl': f'{custom_name}.%(ext)s',
|
| 13 |
}
|
| 14 |
|
| 15 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
| 16 |
ydl.download([url])
|
| 17 |
+
|
| 18 |
+
return f'Download complete! File saved as: {custom_name}.wav'
|
| 19 |
|
| 20 |
iface = gr.Interface(
|
| 21 |
fn=download_youtube_wav,
|
| 22 |
+
inputs=['text', 'text'],
|
| 23 |
+
outputs=gr.Audio,
|
| 24 |
title='YouTube WAV Downloader',
|
| 25 |
+
description='Enter the YouTube URL and a custom name for your .wav file.'
|
| 26 |
)
|
| 27 |
|
| 28 |
+
iface.launch()
|
|
|