From 7671ce8f00efaf85edce7a23b828000525e76ef9 Mon Sep 17 00:00:00 2001 From: Laura Liberda Date: Sat, 21 Nov 2020 00:56:20 +0100 Subject: [PATCH] [youtube] fix yet another UnboundLocalError --- haruhi_dl/extractor/youtube.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/haruhi_dl/extractor/youtube.py b/haruhi_dl/extractor/youtube.py index a2b98c72c..3ebd0c280 100644 --- a/haruhi_dl/extractor/youtube.py +++ b/haruhi_dl/extractor/youtube.py @@ -1671,6 +1671,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor): streaming_formats = try_get(player_response, lambda x: x['streamingData']['formats'], list) or [] streaming_formats.extend(try_get(player_response, lambda x: x['streamingData']['adaptiveFormats'], list) or []) + player_url = None if not is_live and (streaming_formats or len(video_info.get('url_encoded_fmt_stream_map', [''])[0]) >= 1 or len(video_info.get('adaptive_fmts', [''])[0]) >= 1): formats = [] formats_spec = {} @@ -1731,14 +1732,13 @@ class YoutubeIE(YoutubeBaseInfoExtractor): continue format_id = compat_str(format_id) - player_url = None if cipher: if 's' in url_data or self._downloader.params.get('youtube_include_dash_manifest', True): ASSETS_RE = r'"jsUrl":"(/s/player/.*?/player_ias.vflset/.*?/base.js)' player_url = self._search_regex( ASSETS_RE, - embed_webpage if age_gate else video_webpage, '', default=None) + embed_webpage if age_gate else video_webpage, '', default=player_url) if not player_url and not age_gate: # We need the embed website after all