[youtube] INNERTUBE_CONTEXT regex adjustment

pr/150
insaneracist 4 years ago
parent 2fd829049c
commit 63afc7936d

@ -36,6 +36,7 @@ from ..utils import (
get_element_by_attribute, get_element_by_attribute,
get_element_by_id, get_element_by_id,
int_or_none, int_or_none,
js_to_json,
mimetype2ext, mimetype2ext,
orderedSet, orderedSet,
parse_codecs, parse_codecs,
@ -2899,10 +2900,10 @@ class YoutubePlaylistIE(YoutubePlaylistBaseInfoExtractor):
api_key = self._search_regex( api_key = self._search_regex(
r'"INNERTUBE_API_KEY":"([^"]+)"', r'"INNERTUBE_API_KEY":"([^"]+)"',
page, 'api key', default="AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", fatal=False) page, 'api key', default="AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", fatal=False)
api_client_context_string = self._search_regex( ytcfg_string = self._search_regex(
r'ytcfg\.set\({"INNERTUBE_CONTEXT":(.*?)}\)', r'ytcfg\.set\(({.*?"INNERTUBE_CONTEXT".*?})\);',
page, 'client context', fatal=False) page, 'client context')
api_client_context = self._parse_json(api_client_context_string, 'client context') api_client_context = self._parse_json(ytcfg_string, 'client context', transform_source=js_to_json)['INNERTUBE_CONTEXT']
while playlist_items: while playlist_items:
item = playlist_items.pop(0) item = playlist_items.pop(0)

Loading…
Cancel
Save