Update run.py
Browse files
run.py
CHANGED
@@ -3,14 +3,13 @@ import yt_dlp
|
|
3 |
import os
|
4 |
|
5 |
def downloader(video_url, audio_format, audio_name):
|
6 |
-
save_path = os.path.join(audio_name.audio_format)
|
7 |
ydl_opts = {
|
8 |
'format': 'bestaudio/best',
|
9 |
'postprocessors': [{
|
10 |
'key': 'FFmpegExtractAudio',
|
11 |
'preferredcodec': audio_format,
|
12 |
}],
|
13 |
-
'outtmpl':
|
14 |
}
|
15 |
|
16 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
@@ -18,7 +17,7 @@ def downloader(video_url, audio_format, audio_name):
|
|
18 |
return save_path
|
19 |
|
20 |
with gr.Blocks() as demo:
|
21 |
-
gr.Markdown("# YouTube
|
22 |
|
23 |
video_url = gr.Textbox(label="YouTube video link")
|
24 |
audio_name = gr.Textbox(label="Audio name of YouTube audio")
|
|
|
3 |
import os
|
4 |
|
5 |
def downloader(video_url, audio_format, audio_name):
|
|
|
6 |
ydl_opts = {
|
7 |
'format': 'bestaudio/best',
|
8 |
'postprocessors': [{
|
9 |
'key': 'FFmpegExtractAudio',
|
10 |
'preferredcodec': audio_format,
|
11 |
}],
|
12 |
+
'outtmpl': f"audios/{audio_name}",
|
13 |
}
|
14 |
|
15 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
|
|
17 |
return save_path
|
18 |
|
19 |
with gr.Blocks() as demo:
|
20 |
+
gr.Markdown("# YouTube Downloader 2.0")
|
21 |
|
22 |
video_url = gr.Textbox(label="YouTube video link")
|
23 |
audio_name = gr.Textbox(label="Audio name of YouTube audio")
|