Skip to content

Commit

Permalink
[extractor/sonyliv] Fix login with token (#7223)
Browse files Browse the repository at this point in the history
Authored by: bashonly
  • Loading branch information
bashonly committed Jun 4, 2023
1 parent 97d60ad commit 4815d35
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion yt_dlp/extractor/sonyliv.py
Expand Up @@ -10,6 +10,8 @@
from ..utils import (
ExtractorError,
int_or_none,
jwt_decode_hs256,
try_call,
try_get,
)

Expand Down Expand Up @@ -77,8 +79,10 @@ def _perform_login(self, username, password):
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}')

Expand Down

0 comments on commit 4815d35

Please sign in to comment.