From 63afc7936dea6918b4cdc08b43c158c879ae830e Mon Sep 17 00:00:00 2001 From: insaneracist Date: Tue, 10 Nov 2020 22:49:55 -0800 Subject: [PATCH] [youtube] INNERTUBE_CONTEXT regex adjustment --- youtube_dlc/extractor/youtube.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/youtube_dlc/extractor/youtube.py b/youtube_dlc/extractor/youtube.py index 502d994be..1148dfacc 100644 --- a/youtube_dlc/extractor/youtube.py +++ b/youtube_dlc/extractor/youtube.py @@ -36,6 +36,7 @@ from ..utils import ( get_element_by_attribute, get_element_by_id, int_or_none, + js_to_json, mimetype2ext, orderedSet, parse_codecs, @@ -2899,10 +2900,10 @@ class YoutubePlaylistIE(YoutubePlaylistBaseInfoExtractor): api_key = self._search_regex( r'"INNERTUBE_API_KEY":"([^"]+)"', page, 'api key', default="AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", fatal=False) - api_client_context_string = self._search_regex( - r'ytcfg\.set\({"INNERTUBE_CONTEXT":(.*?)}\)', - page, 'client context', fatal=False) - api_client_context = self._parse_json(api_client_context_string, 'client context') + ytcfg_string = self._search_regex( + r'ytcfg\.set\(({.*?"INNERTUBE_CONTEXT".*?})\);', + page, 'client context') + api_client_context = self._parse_json(ytcfg_string, 'client context', transform_source=js_to_json)['INNERTUBE_CONTEXT'] while playlist_items: item = playlist_items.pop(0)