From 0e0784b085b5099fa546ca6c52ce1d4abc958824 Mon Sep 17 00:00:00 2001 From: girst Date: Wed, 20 Mar 2024 17:32:42 +0000 Subject: [PATCH] update youtube api calls to client version 18 same as yt-dlp: https://github.com/yt-dlp/yt-dlp/pull/9317 --- app/common/common.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/common/common.py b/app/common/common.py index 17cad11..a745727 100644 --- a/app/common/common.py +++ b/app/common/common.py @@ -260,7 +260,7 @@ def get_video_info(video_id, *, metaOnly=False, _agegate_bypass=False): # TVHTML5* returns throttled and possibly ciphered streams, but bypasses age-gate. atm, we don't decipher them. # TODO: unscramble TVHTML5* streams (especially &n= throttling) client = { - (False, False): { 'clientName': 'ANDROID', 'clientVersion': '17.33.42', 'androidSdkVersion': 31}, + (False, False): { 'clientName': 'ANDROID', 'clientVersion': '18.11.34', 'androidSdkVersion': 30}, (False, True): { 'clientName': 'TVHTML5_SIMPLY_EMBEDDED_PLAYER', 'clientVersion': '2.0' }, (True, False): { 'clientName': 'WEB', 'clientVersion':f'2.{today}.01.01' }, }[(metaOnly, _agegate_bypass)] @@ -277,7 +277,7 @@ def get_video_info(video_id, *, metaOnly=False, _agegate_bypass=False): "racyCheckOk": True, # seems to do nothing, cargo-culted "contentCheckOk": True, # fix "This video may be inappropriate for some users." "params": "CgIQBg%3D%3D", # otherwise googlevideo URLs become 403/Forbidden after a few accesses (breaks buffering/scrubbing) - }, cookies=cookies, headers={"User-Agent": "com.google.android.youtube/17.33.42 (Linux; U; Android 12; US) gzip"}) + }, cookies=cookies, headers={"User-Agent": "com.google.android.youtube/18.11.34 (Linux; U; Android 11) gzip"}) if not r or r.status_code == 429: return None, None, None, 'banned', 'possible IP ban' -- 2.39.3