]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/playplustv.py
[extractor] Deprecate `_sort_formats`
[yt-dlp.git] / yt_dlp / extractor / playplustv.py
index fd72a3717aad70632bc1d03ab5032b699ce39c4a..316f220f799db70483cf066a6f0186c1f8cc325e 100644 (file)
@@ -1,6 +1,3 @@
-# coding: utf-8
-from __future__ import unicode_literals
-
 import json
 
 from .common import InfoExtractor
@@ -38,14 +35,10 @@ def _call_api(self, resource, video_id=None, query=None):
             'Authorization': 'Bearer ' + self._token,
         }, query=query)
 
-    def _real_initialize(self):
-        email, password = self._get_login_info()
-        if email is None:
-            self.raise_login_required()
-
+    def _perform_login(self, username, password):
         req = PUTRequest(
             'https://api.playplus.tv/api/web/login', json.dumps({
-                'email': email,
+                'email': username,
                 'password': password,
             }).encode(), {
                 'Content-Type': 'application/json; charset=utf-8',
@@ -61,6 +54,10 @@ def _real_initialize(self):
 
         self._profile = self._call_api('Profiles')['list'][0]['_id']
 
+    def _real_initialize(self):
+        if not self._token:
+            self.raise_login_required(method='password')
+
     def _real_extract(self, url):
         project_id, media_id = self._match_valid_url(url).groups()
         media = self._call_api(
@@ -82,7 +79,6 @@ def _real_extract(self, url):
                 'width': int_or_none(file_info.get('width')),
                 'height': int_or_none(file_info.get('height')),
             })
-        self._sort_formats(formats)
 
         thumbnails = []
         for thumb in media.get('thumbs', []):