vumichien commited on
Commit
0ddc202
1 Parent(s): 8fb2799

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -179,7 +179,10 @@ def yt_transcribe(yt_url):
179
  # html_embed_str = _return_yt_html_embed(yt_url)
180
  # stream = yt.streams.filter(only_audio=True)[0]
181
  # stream.download(filename="audio.mp3")
182
-
 
 
 
183
  ydl_opts = {
184
  'format': 'bestvideo*+bestaudio/best',
185
  'postprocessors': [{
@@ -189,6 +192,8 @@ def yt_transcribe(yt_url):
189
  }],
190
  'outtmpl':'audio.%(ext)s',
191
  'cookiefile': 'cookies.txt',
 
 
192
  }
193
 
194
  with yt_dlp.YoutubeDL(ydl_opts) as ydl:
@@ -203,12 +208,15 @@ def convert_time(secs):
203
  def get_youtube(video_url):
204
  # yt = YouTube(video_url)
205
  # abs_video_path = yt.streams.filter(progressive=True, file_extension='mp4').order_by('resolution').desc().first().download()
206
-
 
207
  ydl_opts = {
208
  'format': 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best',
209
  'cookiefile': 'cookies.txt',
 
 
210
  }
211
-
212
  with yt_dlp.YoutubeDL(ydl_opts) as ydl:
213
  info = ydl.extract_info(video_url, download=False)
214
  abs_video_path = ydl.prepare_filename(info)
 
179
  # html_embed_str = _return_yt_html_embed(yt_url)
180
  # stream = yt.streams.filter(only_audio=True)[0]
181
  # stream.download(filename="audio.mp3")
182
+ yt_username = os.getenv('YT_USERNAME')
183
+ yt_password = os.getenv('YT_PASSWORD')
184
+
185
+ print(yt_username, yt_password)
186
  ydl_opts = {
187
  'format': 'bestvideo*+bestaudio/best',
188
  'postprocessors': [{
 
192
  }],
193
  'outtmpl':'audio.%(ext)s',
194
  'cookiefile': 'cookies.txt',
195
+ 'username': yt_username,
196
+ 'password': yt_password,
197
  }
198
 
199
  with yt_dlp.YoutubeDL(ydl_opts) as ydl:
 
208
  def get_youtube(video_url):
209
  # yt = YouTube(video_url)
210
  # abs_video_path = yt.streams.filter(progressive=True, file_extension='mp4').order_by('resolution').desc().first().download()
211
+ yt_username = os.getenv('YT_USERNAME')
212
+ yt_password = os.getenv('YT_PASSWORD')
213
  ydl_opts = {
214
  'format': 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best',
215
  'cookiefile': 'cookies.txt',
216
+ 'username': yt_username,
217
+ 'password': yt_password,
218
  }
219
+ print(yt_username, yt_password)
220
  with yt_dlp.YoutubeDL(ydl_opts) as ydl:
221
  info = ydl.extract_info(video_url, download=False)
222
  abs_video_path = ydl.prepare_filename(info)