diff options
author | dirkf <fieldhouse@gmx.net> | 2025-04-04 11:10:29 +0100 |
---|---|---|
committer | dirkf <fieldhouse@gmx.net> | 2025-04-08 01:59:00 +0100 |
commit | 6c40d9f8472b5e98ca3a3880cfce01a8403f3a9f (patch) | |
tree | 397538c078be7753c7d08e6260cf79a9338bb4bb | |
parent | 1b08d3281d3343a62007aacdc5b669c263bcebeb (diff) |
[YouTube] Remove remaining hard-coded API keys
* no longer required for these cases
-rw-r--r-- | youtube_dl/extractor/youtube.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py index 556ef7577..7f8c0c532 100644 --- a/youtube_dl/extractor/youtube.py +++ b/youtube_dl/extractor/youtube.py @@ -342,14 +342,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor): if not self._login(): return - _DEFAULT_API_DATA = { - 'context': { - 'client': { - 'clientName': 'WEB', - 'clientVersion': '2.20201021.03.00', - }, - }, - } + _DEFAULT_API_DATA = {'context': _INNERTUBE_CLIENTS['web']['INNERTUBE_CONTEXT']} _YT_INITIAL_DATA_RE = r'(?:window\s*\[\s*["\']ytInitialData["\']\s*\]|ytInitialData)\s*=\s*({.+?})\s*;' _YT_INITIAL_PLAYER_RESPONSE_RE = r'ytInitialPlayerResponse\s*=\s*({.+?})\s*;' @@ -497,11 +490,15 @@ class YoutubeBaseInfoExtractor(InfoExtractor): data['params'] = params for page_num in itertools.count(1): search = self._download_json( - 'https://www.youtube.com/youtubei/v1/search?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8', + 'https://www.youtube.com/youtubei/v1/search', video_id='query "%s"' % query, note='Downloading page %s' % page_num, errnote='Unable to download API page', fatal=False, data=json.dumps(data).encode('utf8'), + query={ + # 'key': 'AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8', + 'prettyPrint': 'false', + }, headers={'content-type': 'application/json'}) if not search: break |