# 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)]
"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'