neuralworm commited on
Commit
2dcac56
·
verified ·
1 Parent(s): f4bd310

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -10,13 +10,13 @@ def get_audio(url):
10
  try:
11
  ydl_opts = {
12
  'format': 'bestaudio/best',
13
- 'outtmpl': '%(id)s.%(ext)s',
14
  'noplaylist': True,
15
  'quiet': True
16
  }
17
  with yt_dlp.YoutubeDL(ydl_opts) as ydl:
18
  info = ydl.extract_info(url, download=True)
19
- audio_file = os.path.join(ydl.outtmpl % info)
 
20
  return audio_file
21
  except Exception as e:
22
  raise gr.Error(f"Exception: {e}")
 
10
  try:
11
  ydl_opts = {
12
  'format': 'bestaudio/best',
 
13
  'noplaylist': True,
14
  'quiet': True
15
  }
16
  with yt_dlp.YoutubeDL(ydl_opts) as ydl:
17
  info = ydl.extract_info(url, download=True)
18
+ # Get the output filename from the 'filepath' key of the info dictionary
19
+ audio_file = info['filepath']
20
  return audio_file
21
  except Exception as e:
22
  raise gr.Error(f"Exception: {e}")