PierreHanna commited on
Commit
77e0e67
1 Parent(s): 5b1ec57

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -12,7 +12,8 @@ embed_html1 = '<iframe width="560" height="315" src="https://www.youtube.com/emb
12
  embed_html2 = '" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'
13
 
14
  def download_audio_(link):
15
- with yt_dlp.YoutubeDL({'extract_audio': True, 'format': 'bestaudio', 'outtmpl': '%(title)s.mp3'}) as video:
 
16
  info_dict = video.extract_info(link, download = True)
17
  video_title = info_dict['title']
18
  video.download(link)
@@ -22,6 +23,7 @@ def download_audio(id_video):
22
  id = id_video.split("?v=")[-1][:11]
23
  audio_file = download_audio_(id_video)
24
  audio_file = audio_file+'.mp3'
 
25
  embed_html_all = embed_html1 + id +embed_html2
26
  return audio_file, audio_file, embed_html_all
27
 
 
12
  embed_html2 = '" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'
13
 
14
  def download_audio_(link):
15
+ #with yt_dlp.YoutubeDL({'extract_audio': True, 'format': 'bestaudio', 'outtmpl': '%(title)s.mp3'}) as video:
16
+ with yt_dlp.YoutubeDL({'extract_audio': True, 'format': 'bestaudio', 'outtmpl': 'audio.mp3'}) as video:
17
  info_dict = video.extract_info(link, download = True)
18
  video_title = info_dict['title']
19
  video.download(link)
 
23
  id = id_video.split("?v=")[-1][:11]
24
  audio_file = download_audio_(id_video)
25
  audio_file = audio_file+'.mp3'
26
+ audio_file = 'audio.mp3'
27
  embed_html_all = embed_html1 + id +embed_html2
28
  return audio_file, audio_file, embed_html_all
29