BladeSzaSza commited on
Commit
05f99bb
·
verified ·
1 Parent(s): 17bdecb

Update backend/gradio_labanmovementanalysis/video_downloader.py

Browse files
backend/gradio_labanmovementanalysis/video_downloader.py CHANGED
@@ -19,16 +19,20 @@ class VideoDownloader:
19
  # Gradio component compatibility
20
  events = {}
21
 
22
- def __init__(self, temp_dir: Optional[str] = None, cookies_path: Optional[str] = None):
23
  """
24
  Initialize video downloader.
25
-
26
  Args:
27
  temp_dir: Directory for temporary files
28
  cookies_path: Path to cookies.txt for yt-dlp authentication (optional)
 
29
  """
30
  self.temp_dir = temp_dir or tempfile.mkdtemp(prefix="laban_video_")
31
- self.cookies_path = cookies_path or os.environ.get("LABAN_YT_COOKIES")
 
 
 
32
  self.supported_platforms = {
33
  'youtube': self._download_youtube,
34
  'vimeo': self._download_vimeo,
@@ -132,7 +136,6 @@ class VideoDownloader:
132
 
133
  # yt-dlp options
134
  ydl_opts = {
135
- 'format': 'best',
136
  'outtmpl': output_path,
137
  'quiet': True,
138
  'no_warnings': True,
 
19
  # Gradio component compatibility
20
  events = {}
21
 
22
+ def __init__(self, temp_dir: Optional[str] = None, cookies_path: Optional[str] = None, fallback_cookies_path: Optional[str] = None):
23
  """
24
  Initialize video downloader.
25
+
26
  Args:
27
  temp_dir: Directory for temporary files
28
  cookies_path: Path to cookies.txt for yt-dlp authentication (optional)
29
+ fallback_cookies_path: Fallback path to cookies.txt if others are not set
30
  """
31
  self.temp_dir = temp_dir or tempfile.mkdtemp(prefix="laban_video_")
32
+ self.cookies_path = (
33
+ cookies_path
34
+ or "./cookies.txt"
35
+ )
36
  self.supported_platforms = {
37
  'youtube': self._download_youtube,
38
  'vimeo': self._download_vimeo,
 
136
 
137
  # yt-dlp options
138
  ydl_opts = {
 
139
  'outtmpl': output_path,
140
  'quiet': True,
141
  'no_warnings': True,