divython commited on
Commit
5b69f95
·
verified ·
1 Parent(s): d580fae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -6,7 +6,7 @@ import tempfile
6
  import os
7
  import yt_dlp
8
 
9
- def download_audio(url):
10
  ydl_opts = {
11
  'format': 'bestaudio/best',
12
  'outtmpl': 'audio.%(ext)s',
@@ -15,13 +15,14 @@ def download_audio(url):
15
  'preferredcodec': 'wav',
16
  'preferredquality': '192',
17
  }],
18
- 'cookiefile': 'cookies.txt'
19
  }
20
  with yt_dlp.YoutubeDL(ydl_opts) as ydl:
21
  ydl.download([url])
22
 
23
 
24
 
 
25
  def process_video(url, cookies_path):
26
  audio_file = download_audio(url, cookies_path)
27
  model = whisper.load_model("base")
 
6
  import os
7
  import yt_dlp
8
 
9
+ def download_audio(url, cookies_path=None):
10
  ydl_opts = {
11
  'format': 'bestaudio/best',
12
  'outtmpl': 'audio.%(ext)s',
 
15
  'preferredcodec': 'wav',
16
  'preferredquality': '192',
17
  }],
18
+ 'cookiefile': cookies_path if cookies_path else 'cookies.txt'
19
  }
20
  with yt_dlp.YoutubeDL(ydl_opts) as ydl:
21
  ydl.download([url])
22
 
23
 
24
 
25
+
26
  def process_video(url, cookies_path):
27
  audio_file = download_audio(url, cookies_path)
28
  model = whisper.load_model("base")