Blane187 commited on
Commit
6049619
1 Parent(s): e8ecf5d

Update src/main.py

Browse files
Files changed (1) hide show
  1. src/main.py +3 -10
src/main.py CHANGED
@@ -64,19 +64,12 @@ def yt_download(link):
64
  ydl_opts = {
65
  'format': 'bestaudio/best',
66
  'outtmpl': 'ytdl/%(title)s.%(ext)s',
67
- 'postprocessors': [{
68
- 'key': 'FFmpegExtractAudio',
69
- 'preferredcodec': 'wav',
70
- 'preferredquality': '192',
71
- }],
72
  }
73
 
74
  with yt_dlp.YoutubeDL(ydl_opts) as ydl:
75
- info_dict = ydl.extract_info(url, download=True)
76
- download_path = ydl.prepare_filename(info_dict).rsplit('.', 1)[0] + '.wav'
77
- sample_rate, audio_data = read(file_path)
78
- audio_array = np.asarray(audio_data, dtype=np.int16)
79
-
80
  return download_path
81
 
82
 
 
64
  ydl_opts = {
65
  'format': 'bestaudio/best',
66
  'outtmpl': 'ytdl/%(title)s.%(ext)s',
67
+ 'postprocessors': [{'key': 'FFmpegExtractAudio', 'preferredcodec': 'mp3'}],
 
 
 
 
68
  }
69
 
70
  with yt_dlp.YoutubeDL(ydl_opts) as ydl:
71
+ result = ydl.extract_info(link, download=True)
72
+ download_path = ydl.prepare_filename(result, outtmpl='%(title)s.mp3')
 
 
 
73
  return download_path
74
 
75