Hev832 commited on
Commit
4b1708b
1 Parent(s): 9d38abe

Update run.py

Browse files
Files changed (1) hide show
  1. run.py +3 -1
run.py CHANGED
@@ -3,6 +3,7 @@ import yt_dlp
3
  import os
4
 
5
  def downloader(video_url, audio_format, audio_name):
 
6
  ydl_opts = {
7
  'format': 'bestaudio/best',
8
  'postprocessors': [{
@@ -11,10 +12,11 @@ def downloader(video_url, audio_format, audio_name):
11
  }],
12
  'outtmpl': f"audios/{audio_name}",
13
  }
 
14
 
15
  with yt_dlp.YoutubeDL(ydl_opts) as ydl:
16
  ydl.download([video_url])
17
- return save_path
18
 
19
  with gr.Blocks() as demo:
20
  gr.Markdown("# YouTube Downloader 2.0")
 
3
  import os
4
 
5
  def downloader(video_url, audio_format, audio_name):
6
+ os.makedirs('audios', exist_ok=True)
7
  ydl_opts = {
8
  'format': 'bestaudio/best',
9
  'postprocessors': [{
 
12
  }],
13
  'outtmpl': f"audios/{audio_name}",
14
  }
15
+ output_path = f"audios/{audio_name}.%(ext)s"
16
 
17
  with yt_dlp.YoutubeDL(ydl_opts) as ydl:
18
  ydl.download([video_url])
19
+ return output_path
20
 
21
  with gr.Blocks() as demo:
22
  gr.Markdown("# YouTube Downloader 2.0")