diff options
author | Astound <kirito@disroot.org> | 2024-03-31 04:43:11 +0800 |
---|---|---|
committer | Astound <kirito@disroot.org> | 2024-03-31 04:43:11 +0800 |
commit | 70cb453280a748733b36946ea81866d1de4a056a (patch) | |
tree | cbb0c98c6a82b8482df1f60bdc4f7d96cb2df200 | |
parent | 7a106331e7315c6cc1955addda4c48e9279c8f63 (diff) | |
download | yt-local-70cb453280a748733b36946ea81866d1de4a056a.tar.lz yt-local-70cb453280a748733b36946ea81866d1de4a056a.tar.xz yt-local-70cb453280a748733b36946ea81866d1de4a056a.zip |
Set 'ios' client to bypass
absidue notes that blockage of the android client is collateral
damage due to YouTube's war with ReVanced. Switching to iOS should
keep us out of the line of fire for now:
https://github.com/yt-dlp/yt-dlp/issues/9554#issuecomment-2026828421
-rw-r--r-- | youtube/util.py | 16 | ||||
-rw-r--r-- | youtube/watch.py | 12 |
2 files changed, 17 insertions, 11 deletions
diff --git a/youtube/util.py b/youtube/util.py index 1dfdf7b..6e501bc 100644 --- a/youtube/util.py +++ b/youtube/util.py @@ -709,6 +709,22 @@ INNERTUBE_CLIENTS = { 'REQUIRE_JS_PLAYER': False, }, + 'ios': { + 'INNERTUBE_API_KEY': 'AIzaSyB-63vPrdThhKuerbB2N_l7Kwwcxj6yUAc', + 'INNERTUBE_CONTEXT': { + 'client': { + 'hl': 'en', + 'gl': 'US', + 'clientName': 'IOS', + 'clientVersion': '19.12.3', + 'deviceModel': 'iPhone14,3', + 'userAgent': 'com.google.ios.youtube/19.12.3 (iPhone14,3; U; CPU iOS 15_6 like Mac OS X)' + } + }, + 'INNERTUBE_CONTEXT_CLIENT_NAME': 5, + 'REQUIRE_JS_PLAYER': False + }, + # This client can access age restricted videos (unless the uploader has disabled the 'allow embedding' option) # See: https://github.com/zerodytrash/YouTube-Internal-Clients 'tv_embedded': { diff --git a/youtube/watch.py b/youtube/watch.py index cd0eb53..33b2742 100644 --- a/youtube/watch.py +++ b/youtube/watch.py @@ -372,17 +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), - - # Get video URLs by spoofing as android client because its urls don't - # require decryption - # The URLs returned with WEB for videos requiring decryption - # couldn't be decrypted with the base.js from the web page for some - # reason - # https://github.com/yt-dlp/yt-dlp/issues/574#issuecomment-887171136 - - # Update 4/26/23, these URLs will randomly start returning 403 - # mid-playback and I'm not sure why - gevent.spawn(fetch_player_response, 'android_music', video_id) + gevent.spawn(fetch_player_response, 'ios', video_id) ) gevent.joinall(tasks) util.check_gevent_exceptions(*tasks) |