- Applied try_look to festival videos

- Removed redundant calls to `_download_playinfo`
This commit is contained in:
grqx_wsl 2024-07-26 03:07:32 +12:00
parent e187799c58
commit 29a5968278

View File

@ -645,8 +645,7 @@ def _real_extract(self, url):
raise ExtractorError(
'This video may be deleted or geo-restricted. '
'You might want to try a VPN or a proxy server (with --proxy)', expected=True)
play_info = traverse_obj(play_info_obj, ('data', {dict}))
if not play_info:
if not traverse_obj(play_info_obj, ('data', {dict})):
if traverse_obj(play_info_obj, 'code') == 87007:
toast = get_element_by_class('tips-toast', webpage) or ''
msg = clean_html(
@ -681,11 +680,10 @@ def _real_extract(self, url):
aid = video_data.get('aid')
old_video_id = format_field(aid, None, f'%s_part{part_id or 1}')
cid = traverse_obj(video_data, ('pages', part_id - 1, 'cid')) if part_id else video_data.get('cid')
play_info = self._download_playinfo(video_id, cid, headers=headers, try_look=1)
festival_info = {}
if is_festival:
play_info = self._download_playinfo(video_id, cid, headers=headers)
festival_info = traverse_obj(initial_state, {
'uploader': ('videoInfo', 'upName'),
'uploader_id': ('videoInfo', 'upMid', {str_or_none}),
@ -721,7 +719,6 @@ def _real_extract(self, url):
duration=traverse_obj(initial_state, ('videoData', 'duration', {int_or_none})),
__post_extractor=self.extract_comments(aid))
else:
play_info = self._download_playinfo(video_id, cid, headers=headers, try_look=1)
formats = self.extract_formats(play_info)
if not traverse_obj(play_info, ('dash')):