mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-12 14:26:49 +01:00
[vessel] Use main_video_asset
when searching for video_asset (Fixes #5623)
This commit is contained in:
parent
09b412dafa
commit
46be82b811
@ -38,9 +38,13 @@ def make_json_request(url, data):
|
|||||||
return req
|
return req
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def find_assets(data, asset_type):
|
def find_assets(data, asset_type, asset_id=None):
|
||||||
for asset in data.get('assets', []):
|
for asset in data.get('assets', []):
|
||||||
if asset.get('type') == asset_type:
|
if not asset.get('type') == asset_type:
|
||||||
|
continue
|
||||||
|
elif asset_id is not None and not asset.get('id') == asset_id:
|
||||||
|
continue
|
||||||
|
else:
|
||||||
yield asset
|
yield asset
|
||||||
|
|
||||||
def _check_access_rights(self, data):
|
def _check_access_rights(self, data):
|
||||||
@ -82,11 +86,13 @@ def _real_extract(self, url):
|
|||||||
req = VesselIE.make_json_request(
|
req = VesselIE.make_json_request(
|
||||||
self._API_URL_TEMPLATE % asset_id, {'client': 'web'})
|
self._API_URL_TEMPLATE % asset_id, {'client': 'web'})
|
||||||
data = self._download_json(req, video_id)
|
data = self._download_json(req, video_id)
|
||||||
|
video_asset_id = data.get('main_video_asset')
|
||||||
|
|
||||||
self._check_access_rights(data)
|
self._check_access_rights(data)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
video_asset = next(VesselIE.find_assets(data, 'video'))
|
video_asset = next(
|
||||||
|
VesselIE.find_assets(data, 'video', asset_id=video_asset_id))
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
raise ExtractorError('No video assets found')
|
raise ExtractorError('No video assets found')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user