Skip to content

Commit

Permalink
Update android client parameters to fix blockage
Browse files Browse the repository at this point in the history
Fixes #205

Culprit appears to have been androidSdkVersion
  • Loading branch information
user234683 committed Mar 30, 2024
1 parent 8402e42 commit 4e94b0f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions youtube/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,13 +396,13 @@ def head(url, use_tor=False, report_text=None, max_redirects=10):
('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.20240304.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-Version', '2.20240304.08.00'),
) + mobile_ua


Expand Down Expand Up @@ -664,11 +664,12 @@ def to_valid_filename(name):
'hl': 'en',
'gl': 'US',
'clientName': 'ANDROID',
'clientVersion': '18.11.34',
'clientVersion': '19.09.36',
'osName': 'Android',
'osVersion': '12',
'androidSdkVersion': 30,
'userAgent': 'com.google.android.youtube/18.11.34 (Linux; U; Android 12) gzip'
'androidSdkVersion': 31,
'platform': 'MOBILE',
'userAgent': 'com.google.android.youtube/19.09.36 (Linux; U; Android 12; US) gzip'
},
# https://github.com/yt-dlp/yt-dlp/pull/575#issuecomment-887739287
#'thirdParty': {
Expand All @@ -689,6 +690,7 @@ def to_valid_filename(name):
'gl': 'US',
'clientName': 'TVHTML5_SIMPLY_EMBEDDED_PLAYER',
'clientVersion': '2.0',
'clientScreen': 'EMBED',
},
# https://github.com/yt-dlp/yt-dlp/pull/575#issuecomment-887739287
'thirdParty': {
Expand Down

0 comments on commit 4e94b0f

Please sign in to comment.