TaiYouWeb commited on
Commit
6180705
1 Parent(s): a6a3470

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -206,10 +206,10 @@ def _download_yt_audio(yt_url, filename):
206
  raise gr.Error(f"Requested format not available. Available formats: {available_formats}", duration=20)
207
 
208
  def _return_yt_video_id(yt_url):
209
- if "https://www.youtube.com/watch?v=" in yt_url:
210
- video_id = yt_url.split("?v=")[-1]
211
- elif "https://youtu.be/" in yt_url:
212
- video_id = yt_url.split("be/")[1]
213
  return video_id
214
 
215
  def _return_yt_html_embed(yt_url):
 
206
  raise gr.Error(f"Requested format not available. Available formats: {available_formats}", duration=20)
207
 
208
  def _return_yt_video_id(yt_url):
209
+ if "youtube.com/watch?v=" in yt_url:
210
+ video_id = yt_url.split("?v=")[1].split("&")[0]
211
+ elif "youtu.be/" in yt_url:
212
+ video_id = yt_url.split("youtu.be/")[1]
213
  return video_id
214
 
215
  def _return_yt_html_embed(yt_url):