From 29a59682784daa2143aabdb334ebd3b93eb2205d Mon Sep 17 00:00:00 2001 From: grqx_wsl <173253225+grqx@users.noreply.github.com> Date: Fri, 26 Jul 2024 03:07:32 +1200 Subject: [PATCH] - Applied try_look to festival videos - Removed redundant calls to `_download_playinfo` --- yt_dlp/extractor/bilibili.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/yt_dlp/extractor/bilibili.py b/yt_dlp/extractor/bilibili.py index 8e53f59dc1..b9b0487264 100644 --- a/yt_dlp/extractor/bilibili.py +++ b/yt_dlp/extractor/bilibili.py @@ -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')):