aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAstound <kirito@disroot.org>2024-03-30 10:10:35 +0800
committerAstound <kirito@disroot.org>2024-03-30 10:10:35 +0800
commit80b7f3cd0005b8353eec00d4e59a23e43f1e2fa4 (patch)
tree603c812bbe476c0833d69f6b8f34fb4fc1a29087
parent8b79e067bc8ead97794d41aaec74b1fa8c69f887 (diff)
downloadyt-local-80b7f3cd0005b8353eec00d4e59a23e43f1e2fa4.tar.lz
yt-local-80b7f3cd0005b8353eec00d4e59a23e43f1e2fa4.tar.xz
yt-local-80b7f3cd0005b8353eec00d4e59a23e43f1e2fa4.zip
Update user-agents and update android client parameters to fix blockage
-rw-r--r--youtube/channel.py4
-rw-r--r--youtube/comments.py2
-rw-r--r--youtube/util.py22
3 files changed, 15 insertions, 13 deletions
diff --git a/youtube/channel.py b/youtube/channel.py
index cd0d539..b520121 100644
--- a/youtube/channel.py
+++ b/youtube/channel.py
@@ -264,7 +264,7 @@ def get_channel_tab(channel_id, page="1", sort=3, tab='videos', view=1,
'hl': 'en',
'gl': 'US',
'clientName': 'WEB',
- 'clientVersion': '2.20180830',
+ 'clientVersion': '2.20240327.00.00',
},
},
'continuation': ctoken,
@@ -371,7 +371,7 @@ def get_channel_search_json(channel_id, query, page):
'hl': 'en',
'gl': 'US',
'clientName': 'WEB',
- 'clientVersion': '2.20180830',
+ 'clientVersion': '2.20240327.00.00',
},
},
'continuation': ctoken,
diff --git a/youtube/comments.py b/youtube/comments.py
index d808876..92a89e1 100644
--- a/youtube/comments.py
+++ b/youtube/comments.py
@@ -53,7 +53,7 @@ def request_comments(ctoken, replies=False):
'hl': 'en',
'gl': 'US',
'clientName': 'MWEB',
- 'clientVersion': '2.20210804.02.00',
+ 'clientVersion': '2.20240328.08.00',
},
},
'continuation': ctoken.replace('=', '%3D'),
diff --git a/youtube/util.py b/youtube/util.py
index 07d80b1..4c077f6 100644
--- a/youtube/util.py
+++ b/youtube/util.py
@@ -395,22 +395,22 @@ def head(url, use_tor=False, report_text=None, max_redirects=10):
return response
-mobile_user_agent = 'Mozilla/5.0 (Linux; Android 7.0; Redmi Note 4 Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Mobile Safari/537.36'
+mobile_user_agent = 'Mozilla/5.0 (Linux; Android 14) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.6312.80 Mobile Safari/537.36'
mobile_ua = (('User-Agent', mobile_user_agent),)
-desktop_user_agent = 'Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0'
+desktop_user_agent = 'Mozilla/5.0 (Windows NT 10.0; rv:124.0) Gecko/20100101 Firefox/124.0'
desktop_ua = (('User-Agent', desktop_user_agent),)
json_header = (('Content-Type', 'application/json'),)
desktop_xhr_headers = (
('Accept', '*/*'),
('Accept-Language', 'en-US,en;q=0.5'),
('X-YouTube-Client-Name', '1'),
- ('X-YouTube-Client-Version', '2.20180830'),
+ ('X-YouTube-Client-Version', '2.20240327.00.00'),
) + desktop_ua
mobile_xhr_headers = (
('Accept', '*/*'),
('Accept-Language', 'en-US,en;q=0.5'),
- ('X-YouTube-Client-Name', '2'),
- ('X-YouTube-Client-Version', '2.20180830'),
+ ('X-YouTube-Client-Name', '1'),
+ ('X-YouTube-Client-Version', '2.20240328.08.00'),
) + mobile_ua
@@ -674,11 +674,12 @@ INNERTUBE_CLIENTS = {
'hl': 'en',
'gl': 'US',
'clientName': 'ANDROID',
- 'clientVersion': '18.11.34',
+ 'clientVersion': '19.12.36',
'osName': 'Android',
- 'osVersion': '12',
- 'androidSdkVersion': 30,
- 'userAgent': 'com.google.android.youtube/18.11.34 (Linux; U; Android 12) gzip'
+ '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': {
@@ -699,6 +700,7 @@ INNERTUBE_CLIENTS = {
'gl': 'US',
'clientName': 'TVHTML5_SIMPLY_EMBEDDED_PLAYER',
'clientVersion': '2.0',
+ 'clientScreen': 'EMBED',
},
# https://github.com/yt-dlp/yt-dlp/pull/575#issuecomment-887739287
'thirdParty': {
@@ -715,7 +717,7 @@ INNERTUBE_CLIENTS = {
'INNERTUBE_CONTEXT': {
'client': {
'clientName': 'WEB',
- 'clientVersion': '2.20220801.00.00',
+ 'clientVersion': '2.20240327.00.00',
'userAgent': desktop_user_agent,
}
},