mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-12 14:26:49 +01:00
[ivi] fallback to old extraction method for unknown error codes
This commit is contained in:
parent
f9c4a45210
commit
76d9eca43d
@ -93,29 +93,36 @@ def _real_extract(self, url):
|
||||
]
|
||||
}).encode()
|
||||
|
||||
for site in (353, 183):
|
||||
content_data = data % site
|
||||
if site == 353:
|
||||
try:
|
||||
from Crypto.Cipher import Blowfish
|
||||
from Crypto.Hash import CMAC
|
||||
from Cryptodome.Cipher import Blowfish
|
||||
from Cryptodome.Hash import CMAC
|
||||
pycryptodomex_found = True
|
||||
except ImportError:
|
||||
pycryptodomex_found = False
|
||||
continue
|
||||
|
||||
timestamp = self._download_json(
|
||||
timestamp = (self._download_json(
|
||||
self._LIGHT_URL, video_id,
|
||||
'Downloading timestamp JSON', data=json.dumps({
|
||||
'method': 'da.timestamp.get',
|
||||
'params': []
|
||||
}).encode())['result']
|
||||
}).encode(), fatal=False) or {}).get('result')
|
||||
if not timestamp:
|
||||
continue
|
||||
|
||||
data = data % 353
|
||||
query = {
|
||||
'ts': timestamp,
|
||||
'sign': CMAC.new(self._LIGHT_KEY, timestamp.encode() + data, Blowfish).hexdigest(),
|
||||
'sign': CMAC.new(self._LIGHT_KEY, timestamp.encode() + content_data, Blowfish).hexdigest(),
|
||||
}
|
||||
except ImportError:
|
||||
data = data % 183
|
||||
else:
|
||||
query = {}
|
||||
|
||||
video_json = self._download_json(
|
||||
self._LIGHT_URL, video_id,
|
||||
'Downloading video JSON', data=data, query=query)
|
||||
'Downloading video JSON', data=content_data, query=query)
|
||||
|
||||
error = video_json.get('error')
|
||||
if error:
|
||||
@ -126,13 +133,17 @@ def _real_extract(self, url):
|
||||
self.raise_geo_restricted(message, self._GEO_COUNTRIES)
|
||||
elif origin == 'NoRedisValidData':
|
||||
extractor_msg = 'Video %s does not exist'
|
||||
elif message:
|
||||
if 'недоступен для просмотра на площадке s183' in message:
|
||||
elif site == 353:
|
||||
continue
|
||||
elif not pycryptodomex_found:
|
||||
raise ExtractorError(
|
||||
'pycryptodome not found. Please install it.',
|
||||
expected=True)
|
||||
elif message:
|
||||
extractor_msg += ': ' + message
|
||||
raise ExtractorError(extractor_msg % video_id, expected=True)
|
||||
else:
|
||||
break
|
||||
|
||||
result = video_json['result']
|
||||
title = result['title']
|
||||
|
Loading…
Reference in New Issue
Block a user