[ie/wrestleuniverse] Avoid partial stream formats (#9800)

Authored by: bashonly
This commit is contained in:
bashonly 2024-05-04 11:07:15 -05:00 committed by GitHub
parent ac817bc83e
commit c4853655cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -12,6 +12,7 @@ from ..utils import (
jwt_decode_hs256, jwt_decode_hs256,
traverse_obj, traverse_obj,
try_call, try_call,
url_basename,
url_or_none, url_or_none,
urlencode_postdata, urlencode_postdata,
variadic, variadic,
@ -194,8 +195,7 @@ class WrestleUniverseVODIE(WrestleUniverseBaseIE):
return { return {
'id': video_id, 'id': video_id,
'formats': self._get_formats(video_data, ( 'formats': self._get_formats(video_data, ('protocolHls', 'url', {url_or_none}), video_id),
(('protocolHls', 'url'), ('chromecastUrls', ...)), {url_or_none}), video_id),
**traverse_obj(metadata, { **traverse_obj(metadata, {
'title': ('displayName', {str}), 'title': ('displayName', {str}),
'description': ('description', {str}), 'description': ('description', {str}),
@ -259,6 +259,10 @@ class WrestleUniversePPVIE(WrestleUniverseBaseIE):
'params': { 'params': {
'skip_download': 'm3u8', 'skip_download': 'm3u8',
}, },
}, {
'note': 'manifest provides live-a (partial) and live-b (full) streams',
'url': 'https://www.wrestle-universe.com/en/lives/umc99R9XsexXrxr9VjTo9g',
'only_matching': True,
}] }]
_API_PATH = 'events' _API_PATH = 'events'
@ -285,12 +289,16 @@ class WrestleUniversePPVIE(WrestleUniverseBaseIE):
video_data, decrypt = self._call_encrypted_api( video_data, decrypt = self._call_encrypted_api(
video_id, ':watchArchive', 'watch archive', data={'method': 1}) video_id, ':watchArchive', 'watch archive', data={'method': 1})
info['formats'] = self._get_formats(video_data, ( # 'chromecastUrls' can be only partial videos, avoid
('hls', None), ('urls', 'chromecastUrls'), ..., {url_or_none}), video_id) info['formats'] = self._get_formats(video_data, ('hls', (('urls', ...), 'url'), {url_or_none}), video_id)
for f in info['formats']: for f in info['formats']:
# bitrates are exaggerated in PPV playlists, so avoid wrong/huge filesize_approx values # bitrates are exaggerated in PPV playlists, so avoid wrong/huge filesize_approx values
if f.get('tbr'): if f.get('tbr'):
f['tbr'] = int(f['tbr'] / 2.5) f['tbr'] = int(f['tbr'] / 2.5)
# prefer variants with the same basename as the master playlist to avoid partial streams
f['format_id'] = url_basename(f['url']).partition('.')[0]
if not f['format_id'].startswith(url_basename(f['manifest_url']).partition('.')[0]):
f['preference'] = -10
hls_aes_key = traverse_obj(video_data, ('hls', 'key', {decrypt})) hls_aes_key = traverse_obj(video_data, ('hls', 'key', {decrypt}))
if hls_aes_key: if hls_aes_key: