]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/wppilot.py
[ie/mlbtv] Fix extraction (#10296)
[yt-dlp.git] / yt_dlp / extractor / wppilot.py
index 5e590e2f4f5e77795b4d17e6844afc5ef28ad8c4..b4cc1abc59d448fa0057ac9ffd586a0355dee6c4 100644 (file)
@@ -1,13 +1,13 @@
+import json
+import random
+import re
+
 from .common import InfoExtractor
 from ..utils import (
-    try_get,
     ExtractorError,
+    try_get,
 )
 
-import json
-import random
-import re
-
 
 class WPPilotBaseIE(InfoExtractor):
     _VIDEO_URL = 'https://pilot.wp.pl/api/v1/channel/%s'
@@ -103,7 +103,7 @@ def _real_extract(self, url):
 
         is_authorized = next((c for c in self.cookiejar if c.name == 'netviapisessid'), None)
         # cookies starting with "g:" are assigned to guests
-        is_authorized = True if is_authorized is not None and not is_authorized.value.startswith('g:') else False
+        is_authorized = is_authorized is not None and not is_authorized.value.startswith('g:')
 
         video = self._download_json(
             (self._VIDEO_URL if is_authorized else self._VIDEO_GUEST_URL) % video_id,
@@ -120,7 +120,7 @@ def _real_extract(self, url):
                 data=json.dumps({
                     'channelId': video_id,
                     't': stream_token,
-                }).encode('utf-8'))
+                }).encode())
             if try_get(close, lambda x: x['data']['status']) == 'ok':
                 return self.url_result(url, ie=WPPilotIE.ie_key())