mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 06:10:12 +01:00
[ie/litv] Fix premium content extraction (#8842)
Closes #8654 Authored by: bashonly
This commit is contained in:
parent
13b3cb3c2b
commit
f45c4efcd9
|
@ -6,6 +6,7 @@
|
||||||
int_or_none,
|
int_or_none,
|
||||||
smuggle_url,
|
smuggle_url,
|
||||||
traverse_obj,
|
traverse_obj,
|
||||||
|
try_call,
|
||||||
unsmuggle_url,
|
unsmuggle_url,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -96,13 +97,22 @@ def _real_extract(self, url):
|
||||||
r'uiHlsUrl\s*=\s*testBackendData\(([^;]+)\);',
|
r'uiHlsUrl\s*=\s*testBackendData\(([^;]+)\);',
|
||||||
webpage, 'video data', default='{}'), video_id)
|
webpage, 'video data', default='{}'), video_id)
|
||||||
if not video_data:
|
if not video_data:
|
||||||
payload = {
|
payload = {'assetId': program_info['assetId']}
|
||||||
'assetId': program_info['assetId'],
|
puid = try_call(lambda: self._get_cookies('https://www.litv.tv/')['PUID'].value)
|
||||||
'watchDevices': program_info['watchDevices'],
|
if puid:
|
||||||
'contentType': program_info['contentType'],
|
payload.update({
|
||||||
}
|
'type': 'auth',
|
||||||
|
'puid': puid,
|
||||||
|
})
|
||||||
|
endpoint = 'getUrl'
|
||||||
|
else:
|
||||||
|
payload.update({
|
||||||
|
'watchDevices': program_info['watchDevices'],
|
||||||
|
'contentType': program_info['contentType'],
|
||||||
|
})
|
||||||
|
endpoint = 'getMainUrlNoAuth'
|
||||||
video_data = self._download_json(
|
video_data = self._download_json(
|
||||||
'https://www.litv.tv/vod/ajax/getMainUrlNoAuth', video_id,
|
f'https://www.litv.tv/vod/ajax/{endpoint}', video_id,
|
||||||
data=json.dumps(payload).encode('utf-8'),
|
data=json.dumps(payload).encode('utf-8'),
|
||||||
headers={'Content-Type': 'application/json'})
|
headers={'Content-Type': 'application/json'})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user