Browse Source

[safari] Fix authentication

Sergey M․ 9 years ago
parent
commit
e9c8999ede
1 changed files with 7 additions and 4 deletions
  1. 7 4
      youtube_dl/extractor/safari.py

+ 7 - 4
youtube_dl/extractor/safari.py

@@ -27,12 +27,13 @@ class SafariBaseIE(InfoExtractor):
     LOGGED_IN = False
     LOGGED_IN = False
 
 
     def _real_initialize(self):
     def _real_initialize(self):
-        # We only need to log in once for courses or individual videos
-        if not self.LOGGED_IN:
-            self._login()
-            SafariBaseIE.LOGGED_IN = True
+        self._login()
 
 
     def _login(self):
     def _login(self):
+        # We only need to log in once for courses or individual videos
+        if self.LOGGED_IN:
+            return
+
         (username, password) = self._get_login_info()
         (username, password) = self._get_login_info()
         if username is None:
         if username is None:
             return
             return
@@ -68,6 +69,8 @@ class SafariBaseIE(InfoExtractor):
                 'Login failed; make sure your credentials are correct and try again.',
                 'Login failed; make sure your credentials are correct and try again.',
                 expected=True)
                 expected=True)
 
 
+        SafariBaseIE.LOGGED_IN = True
+
         self.to_screen('Login successful')
         self.to_screen('Login successful')