[ie/wrestleuniverse:vod] Fix extractor (#16685)

Closes #13818
Authored by: Sec-Wayne, tewhalen, 0xvd, bashonly

Co-authored-by: tewhalen <6964120+tewhalen@users.noreply.github.com>
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
This commit is contained in:
Wayne 2026-07-02 05:55:14 +01:00 committed by GitHub
parent 16bdcc525e
commit 498e51f5da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,6 +6,7 @@ import uuid
from .common import InfoExtractor
from ..dependencies import Cryptodome
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
int_or_none,
@ -155,15 +156,35 @@ class WrestleUniverseBaseIE(InfoExtractor):
def _get_formats(self, data, path, video_id=None):
hls_url = traverse_obj(data, path, get_all=False)
if not hls_url and not data.get('canWatch'):
self.raise_no_formats(
'This account does not have access to the requested content', expected=True)
elif not hls_url:
self.raise_no_formats('No supported formats found')
if not hls_url:
if not data.get('canWatch'):
self.raise_no_formats(
'This account does not have access to the requested content', expected=True)
else:
self.raise_no_formats('No supported formats found')
return []
return self._extract_m3u8_formats(hls_url, video_id, 'mp4', m3u8_id='hls', live=True)
def _extract_hls_aes_info(self, video_data, decrypt):
if decrypt is None:
return {}
hls_aes_key = traverse_obj(video_data, ('hls', 'key', {decrypt}))
if hls_aes_key:
return {
'hls_aes': {
'key': hls_aes_key,
'iv': traverse_obj(video_data, ('hls', 'iv', {decrypt})),
},
}
elif traverse_obj(video_data, ('hls', 'encryptType', {int})):
self.report_warning('HLS AES-128 key was not found in API response')
return {}
class WrestleUniverseVODIE(WrestleUniverseBaseIE):
IE_NAME = 'wrestleuniverse:vod'
_VALID_URL = WrestleUniverseBaseIE._VALID_URL_TMPL % 'videos'
_TESTS = [{
'url': 'https://www.wrestle-universe.com/en/videos/dp8mpjmcKfxzUhEHM2uFws',
@ -191,11 +212,19 @@ class WrestleUniverseVODIE(WrestleUniverseBaseIE):
def _real_extract(self, url):
lang, video_id = self._match_valid_url(url).group('lang', 'id')
metadata = self._download_metadata(url, video_id, lang, 'videoEpisodeFallbackData')
video_data = self._call_api(video_id, ':watch', 'watch', data={'deviceId': self._DEVICE_ID})
decrypt = None
try:
video_data = self._call_api(video_id, ':watch', 'watch', data={'deviceId': self._DEVICE_ID})
except ExtractorError as error:
if not isinstance(error.cause, HTTPError) or error.cause.status != 400:
raise
video_data, decrypt = self._call_encrypted_api(video_id, ':watch', 'watch', data={'method': 1})
return {
'id': video_id,
'formats': self._get_formats(video_data, ('protocolHls', 'url', {url_or_none}), video_id),
**self._extract_hls_aes_info(video_data, decrypt),
**traverse_obj(metadata, {
'title': ('displayName', {str}),
'description': ('description', {str}),
@ -205,7 +234,7 @@ class WrestleUniverseVODIE(WrestleUniverseBaseIE):
'thumbnail': ('keyVisualUrl', {url_or_none}),
'cast': ('casts', ..., 'displayName', {str}),
'duration': ('duration', {int}),
'chapters': ('videoChapters', lambda _, v: isinstance(v.get('start'), int), {
'chapters': ('videoChapters', lambda _, v: isinstance(v['start'], int), {
'title': ('displayName', {str}),
'start_time': ('start', {int}),
'end_time': ('end', {int}),
@ -215,6 +244,7 @@ class WrestleUniverseVODIE(WrestleUniverseBaseIE):
class WrestleUniversePPVIE(WrestleUniverseBaseIE):
IE_NAME = 'wrestleuniverse:ppv'
_VALID_URL = WrestleUniverseBaseIE._VALID_URL_TMPL % 'lives'
_TESTS = [{
'note': 'HLS AES-128 key obtained via API',
@ -300,13 +330,6 @@ class WrestleUniversePPVIE(WrestleUniverseBaseIE):
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}))
if hls_aes_key:
info['hls_aes'] = {
'key': hls_aes_key,
'iv': traverse_obj(video_data, ('hls', 'iv', {decrypt})),
}
elif traverse_obj(video_data, ('hls', 'encryptType', {int})):
self.report_warning('HLS AES-128 key was not found in API response')
info.update(self._extract_hls_aes_info(video_data, decrypt))
return info