Vinsmart06 commited on
Commit
7e3ef48
·
verified ·
1 Parent(s): 9385d12

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -52,10 +52,10 @@ def read_image(file_path):
52
  def youtube_captions(self, url):
53
  try:
54
  ydl_opts = {"skip_download": True, "writesubtitles": True, "writeautomaticsub": True}
55
- with yt_dlp.YoutubeDL(ydl_opts) as ydl:
56
- info = ydl.extract_info(url, download=False)
57
  # Return first available captions
58
- return str(info.get("subtitles") or info.get("automatic_captions"))[:5000]
59
  except Exception as e:
60
  return f"YouTube error: {e}"
61
 
 
52
  def youtube_captions(self, url):
53
  try:
54
  ydl_opts = {"skip_download": True, "writesubtitles": True, "writeautomaticsub": True}
55
+ with yt_dlp.YoutubeDL(ydl_opts) as ydl:
56
+ info = ydl.extract_info(url, download=False)
57
  # Return first available captions
58
+ return str(info.get("subtitles") or info.get("automatic_captions"))[:5000]
59
  except Exception as e:
60
  return f"YouTube error: {e}"
61