From 6039589f24cd2368b1f14e063b46d4aa78f7b0df Mon Sep 17 00:00:00 2001 From: Astound Date: Sat, 6 Apr 2024 22:04:14 +0800 Subject: Update `android` params Discovered by LuanRT - https://github.com/LuanRT/YouTube.js/pull/624 --- youtube/util.py | 8 ++------ youtube/watch.py | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/youtube/util.py b/youtube/util.py index 6e501bc..0416fc1 100644 --- a/youtube/util.py +++ b/youtube/util.py @@ -698,12 +698,8 @@ INNERTUBE_CLIENTS = { 'osVersion': '14', 'androidSdkVersion': 34, 'platform': 'MOBILE', - 'userAgent': 'com.google.android.youtube/19.12.36 (Linux; U; Android 14; US) gzip' - }, - # https://github.com/yt-dlp/yt-dlp/pull/575#issuecomment-887739287 - #'thirdParty': { - # 'embedUrl': 'https://google.com', # Can be any valid URL - #} + 'userAgent': 'com.google.android.youtube/19.13.36 (Linux; U; Android 14; en_US; Google Pixel 6 Pro) gzip' + } }, 'INNERTUBE_CONTEXT_CLIENT_NAME': 3, 'REQUIRE_JS_PLAYER': False, diff --git a/youtube/watch.py b/youtube/watch.py index 33b2742..09a3b76 100644 --- a/youtube/watch.py +++ b/youtube/watch.py @@ -343,7 +343,7 @@ def _add_to_error(info, key, additional_message): def fetch_player_response(client, video_id): return util.call_youtube_api(client, 'player', { 'videoId': video_id, - 'params': 'CgIQBg', + 'params': 'CgIIAQ==', }) @@ -372,7 +372,7 @@ def extract_info(video_id, use_invidious, playlist_id=None, index=None): tasks = ( # Get video metadata from here gevent.spawn(fetch_watch_page_info, video_id, playlist_id, index), - gevent.spawn(fetch_player_response, 'ios', video_id) + gevent.spawn(fetch_player_response, 'android', video_id) ) gevent.joinall(tasks) util.check_gevent_exceptions(*tasks) -- cgit v1.2.3