aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbashonly <88596187+bashonly@users.noreply.github.com>2023-06-04 08:49:10 -0500
committerGitHub <noreply@github.com>2023-06-04 13:49:10 +0000
commit4815d35c191e7d375b94492a6486dd2ba43a8954 (patch)
treed6960f3e66f6b09635bd592c0dd913851a7fcfe8
parent97d60ad8cd6c99f01e463a9acfce8693aff2a609 (diff)
downloadhypervideo-pre-4815d35c191e7d375b94492a6486dd2ba43a8954.tar.lz
hypervideo-pre-4815d35c191e7d375b94492a6486dd2ba43a8954.tar.xz
hypervideo-pre-4815d35c191e7d375b94492a6486dd2ba43a8954.zip
[extractor/sonyliv] Fix login with token (#7223)
Authored by: bashonly
-rw-r--r--yt_dlp/extractor/sonyliv.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/yt_dlp/extractor/sonyliv.py b/yt_dlp/extractor/sonyliv.py
index aaad420f1..5ebe20df7 100644
--- a/yt_dlp/extractor/sonyliv.py
+++ b/yt_dlp/extractor/sonyliv.py
@@ -10,6 +10,8 @@ from ..compat import compat_HTTPError
from ..utils import (
ExtractorError,
int_or_none,
+ jwt_decode_hs256,
+ try_call,
try_get,
)
@@ -77,8 +79,10 @@ class SonyLIVIE(InfoExtractor):
self._HEADERS['device_id'] = self._get_device_id()
self._HEADERS['content-type'] = 'application/json'
- if username.lower() == 'token' and len(password) > 1198:
+ if username.lower() == 'token' and try_call(lambda: jwt_decode_hs256(password)):
self._HEADERS['authorization'] = password
+ self.report_login()
+ return
elif len(username) != 10 or not username.isdigit():
raise ExtractorError(f'Invalid username/password; {self._LOGIN_HINT}')