]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/njpwworld.py
[ie/dailymotion] Improve `_VALID_URL` (#7692)
[yt-dlp.git] / yt_dlp / extractor / njpwworld.py
index 89380d039ca7dad36c279b4d03911a2ac121cfa0..6078381330497ef94a54708fe6378370650297e4 100644 (file)
@@ -1,6 +1,3 @@
-# coding: utf-8
-from __future__ import unicode_literals
-
 import re
 
 from .common import InfoExtractor
@@ -43,15 +40,7 @@ class NJPWWorldIE(InfoExtractor):
 
     _LOGIN_URL = 'https://front.njpwworld.com/auth/login'
 
-    def _real_initialize(self):
-        self._login()
-
-    def _login(self):
-        username, password = self._get_login_info()
-        # No authentication to be performed
-        if not username:
-            return True
-
+    def _perform_login(self, username, password):
         # Setup session (will set necessary cookies)
         self._request_webpage(
             'https://njpwworld.com/', None, note='Setting up session')
@@ -62,7 +51,7 @@ def _login(self):
             data=urlencode_postdata({'login_id': username, 'pw': password}),
             headers={'Referer': 'https://front.njpwworld.com/auth'})
         # /auth/login will return 302 for successful logins
-        if urlh.geturl() == self._LOGIN_URL:
+        if urlh.url == self._LOGIN_URL:
             self.report_warning('unable to login')
             return False
 
@@ -80,8 +69,6 @@ def _real_extract(self, url):
             formats += self._extract_m3u8_formats(
                 player_url, video_id, 'mp4', 'm3u8_native', m3u8_id=kind, fatal=False, quality=int(kind == 'high'))
 
-        self._sort_formats(formats)
-
         tag_block = get_element_by_class('tag-block', webpage)
         tags = re.findall(
             r'<a[^>]+class="tag-[^"]+"[^>]*>([^<]+)</a>', tag_block