From 90802e3f3cb7788a2f937eb6e69ad2eae26dc5dc Mon Sep 17 00:00:00 2001 From: girst Date: Sun, 28 May 2023 15:53:52 +0000 Subject: [PATCH] use other 'params' value 8AEB is apparently used by shorts, and doesn't return viewCount. this patch makes viewCount optional, but uses the other cargo-culted value that does return viewCount (for now, at least). --- 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 1b4571a..f268577 100644 --- a/app/common/common.py +++ b/app/common/common.py @@ -276,7 +276,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": "8AEB", # ANDROID needs this, or video URLs will stop working when accessed twice (buffering, scrubbing) + "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"}) if not r or r.status_code == 429: @@ -390,7 +390,7 @@ def video_metadata(metadata): 'author': meta1['author'], 'channel_id': meta1['channelId'], 'published': published_at, - 'views': int(meta1['viewCount']), + 'views': int(meta1['viewCount']) if 'viewCount' in meta1 else None, 'length': length, 'aspect': aspect_ratio or 16/9, 'livestream': meta1['isLiveContent'], -- 2.39.3